AgentRegistry
public interface AgentRegistry
io/agentscope/spring/boot/admin/registry/AgentRegistry.java:35–47定义智能体注册表契约的接口。位于 io.agentscope.spring.boot.admin.registry 包。核心成员包括 register、unregister、find、list、size。
SPI for tracking live agents the admin surface can inspect or act on.
AgentScope-Java exposes ReActAgent as a prototype-scoped bean by default, so a
Spring Map<String, Agent> scan will only find singleton agents (or none). To make the
inventory complete, application code should call #register(Agent) after constructing a
long-lived agent — typically in a @PostConstruct on a Service that owns it, or wrapped
inside the agent factory.
The default InMemoryAgentRegistry is fine for single-node deployments; for
cluster-aware deployments, swap in an implementation backed by Nacos, Redis, or another shared
store.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public void register(Agent agent) | 设置注册。 Performs the register operation. |
public void unregister(String agentId) | 设置注销。 Performs the unregister operation. |
public Optional<Agent> find(String agentId) | 设置查找。 Performs the find operation. |
public List<Agent> list() | 返回列表。 All registered agents in insertion order. |
public int size() | 返回大小。 Returns the size. |
方法详情Method Detail
register
public void register(Agent agent)
设置注册。
Performs the register operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent. |
io/agentscope/spring/boot/admin/registry/AgentRegistry.java:37unregister
public void unregister(String agentId)
设置注销。
Performs the unregister operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识(类型 `String`)。The agent id. |
io/agentscope/spring/boot/admin/registry/AgentRegistry.java:39find
public Optional<Agent> find(String agentId)
设置查找。
Performs the find operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识(类型 `String`)。The agent id. |
Optional<Agent>io/agentscope/spring/boot/admin/registry/AgentRegistry.java:41list
public List<Agent> list()
返回列表。
All registered agents in insertion order.
List<Agent>io/agentscope/spring/boot/admin/registry/AgentRegistry.java:44size
public int size()
返回大小。
Returns the size.
intio/agentscope/spring/boot/admin/registry/AgentRegistry.java:46