agentscope.rpc.rpc_object module

A proxy object which represent a object located in a rpc server.

class RpcObject(cls: type, oid: str, host: str, port: int, connect_existing: bool = False, max_pool_size: int = 8192, max_expire_time: int = 7200, max_timeout_seconds: int = 5, local_mode: bool = True, retry_strategy: ~agentscope.rpc.retry_strategy.RetryBase | dict = <agentscope.rpc.retry_strategy.RetryFixedTimes object>, configs: dict | None = None)[source]

Bases: ABC

A proxy object which represent an object located in an Rpc server.

Note

When to_dist is called on an object or when using the to_dist parameter to create an object, the object is moved to an Rpc server, and an RpcObject instance is left behind in the local process. The RpcObject will automatically forward all public method invocations to the original object in the rpc server.

create(configs: dict) None[source]

create the object on the rpc server.

stop() None[source]

Stop the RpcAgent and the rpc server.

get_public_methods(cls: type) list[str][source]

Get all public methods of the given class.