agentscope.server.servicer module
Server of distributed agent
- class agentscope.server.servicer.AgentServerServicer(stop_event: Event, host: str = 'localhost', port: int | None = None, server_id: str | None = None, studio_url: str | None = None, max_pool_size: int = 8192, max_timeout_seconds: int = 7200)[源代码]
-
A Servicer for RPC Agent Server (formerly RpcServerSideWrapper)
- __init__(stop_event: Event, host: str = 'localhost', port: int | None = None, server_id: str | None = None, studio_url: str | None = None, max_pool_size: int = 8192, max_timeout_seconds: int = 7200)[源代码]
Init the AgentServerServicer.
- 参数:
stop_event (Event) – Event to stop the server.
host (str, defaults to “localhost”) – Hostname of the rpc agent server.
port (int, defaults to None) – Port of the rpc agent server.
server_id (str, defaults to None) – Server id of the rpc agent server.
studio_url (str, defaults to None) – URL of the AgentScope Studio.
max_pool_size (int, defaults to 8192) – The 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_timeout_seconds (int, defaults to 7200) – Maximum time for reply messages to be cached in the server. Note that expired messages will be deleted.
- agent_exists(agent_id: str) bool [源代码]
Check whether the agent exists.
- 参数:
agent_id (str) – the agent id.
- 返回:
whether the agent exists.
- 返回类型:
bool
- get_agent(agent_id: str) AgentBase [源代码]
Get the agent by agent id.
- 参数:
agent_id (str) – the agent id.
- 返回:
the agent.
- 返回类型:
- is_alive(request: Empty, context: ServicerContext) GeneralResponse [源代码]
Check whether the server is alive.
- create_agent(request: CreateAgentRequest, context: ServicerContext) GeneralResponse [源代码]
Create a new agent on the server.
- delete_agent(request: StringMsg, context: ServicerContext) GeneralResponse [源代码]
Delete agents from the server.
- 参数:
request (StringMsg) – The value field is the agent_id of the
deleted. (agents to be)
- clone_agent(request: StringMsg, context: ServicerContext) GeneralResponse [源代码]
Clone a new agent instance from the origin instance.
- 参数:
request (StringMsg) – The value field is the agent_id of the
cloned. (agent to be)
- 返回:
The agent_id of generated agent. Empty if clone failed.
- 返回类型:
GeneralResponse
- delete_all_agents(request: Empty, context: ServicerContext) GeneralResponse [源代码]
clear all agent on the server
- call_agent_func(request: RpcMsg, context: ServicerContext) GeneralResponse [源代码]
Call the specific servicer function.
- update_placeholder(request: UpdatePlaceholderRequest, context: ServicerContext) GeneralResponse [源代码]
Update the value of a placeholder.
- get_agent_list(request: Empty, context: ServicerContext) GeneralResponse [源代码]
Get id of all agents on the server as a list.
- get_server_info(request: Empty, context: ServicerContext) GeneralResponse [源代码]
Get the agent server resource usage information.
- set_model_configs(request: StringMsg, context: ServicerContext) GeneralResponse [源代码]
Set the model configs of the agent server.