agentscope.server.launcher module
Server of distributed agent
- class RpcAgentServerLauncher(host: str = 'localhost', port: int | None = None, capacity: int = 32, pool_type: str = 'local', redis_url: str = 'redis://localhost:6379', max_pool_size: int = 8192, max_expire_time: int = 7200, max_timeout_seconds: int = 5, local_mode: bool = False, agent_dir: str | None = None, custom_agent_classes: list | None = None, server_id: str | None = None, studio_url: str | None = None)[source]
Bases:
object
The launcher of AgentServer.
- as_server() None [source]
Launch an agent server with terminal command.
Note
The arguments of as_server are listed as follows:
–host: the hostname of the server.
–port: the socket port of the server.
–capacity: the number of concurrent agents in the server.
–pool-type: the type of the async message pool, which can be local or redis. If redis is specified, you need to start a redis server before launching the server. Defaults to local.
–redis-url: the url of the redis server, defaults to redis://localhost:6379.
–max-pool-size: max number of agent reply messages that the server can accommodate. Note that the oldest message will be deleted after exceeding the pool size.
–max-expire: max expire time for async function result.
–max-timeout-seconds: max timeout for rpc call.
–local-mode: whether the started agent server only listens to local requests.
–model-config-path: the path to the model config json file
–agent-dir: the directory containing your customized agent python files
–studio-url: the url of agentscope studio
In most cases, you only need to specify the –host, –port and –model-config-path, and –agent-dir.
as_server start --host localhost \ --port 12345 \ --model-config-path config.json \ --agent-dir ./my_agents