agentscope.rpc

Import all rpc related modules in the package.

class agentscope.rpc.RpcAgentClient(host: str, port: int, agent_id: str = '')[源代码]

基类:object

A client of Rpc agent server

__init__(host: str, port: int, agent_id: str = '') None[源代码]

Init a rpc agent client

参数:
  • host (str) – the hostname of the rpc agent server which the

  • connected. (is)

  • port (int) – the port of the rpc agent server which the client

  • connected.

  • agent_id (str) – the agent id of the agent being called.

call_func(func_name: str, value: str | None = None, timeout: int = 300) str[源代码]

Call the specific function of rpc server.

参数:
  • func_name (str) – the name of the function being called.

  • x (str, optional) – the seralized input value. Defaults to None.

返回:

serialized return data.

返回类型:

str

create_agent(agent_configs: dict) None[源代码]

Create a new agent for this client.

delete_agent() None[源代码]

Delete the agent created by this client.

class agentscope.rpc.ResponseStub[源代码]

基类:object

A stub used to save the response of an rpc call in a sub-thread.

__init__() None[源代码]
set_response(response: str) None[源代码]

Set the message.

get_response() str[源代码]

Get the message.

class agentscope.rpc.RpcMsg

基类:Message, Message

DESCRIPTOR = <google._upb._message.Descriptor object>
class agentscope.rpc.RpcAgentServicer[源代码]

基类:object

Servicer for rpc agent server

call_func(request, context)[源代码]

Missing associated documentation comment in .proto file.

class agentscope.rpc.RpcAgentStub(channel)[源代码]

基类:object

Servicer for rpc agent server

__init__(channel)[源代码]

Constructor.

参数:

channel – A grpc.Channel.

agentscope.rpc.call_in_thread(client: RpcAgentClient, value: str, func_name: str) ResponseStub[源代码]

Call rpc function in a sub-thread.

参数:
  • client (RpcAgentClient) – the rpc client.

  • x (str) – the value of the reqeust.

  • func_name (str) – the name of the function being called.

返回:

a stub to get the response.

返回类型:

ResponseStub

agentscope.rpc.add_RpcAgentServicer_to_server(servicer, server)[源代码]