AS AgentScopeAPI 手册 / API Reference

AgentRegistry

public interface AgentRegistry
源码Source 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.

参数Parameters
名称Name类型Type说明Description
agentAgent智能体(类型 `Agent`)。The agent.
源码Source io/agentscope/spring/boot/admin/registry/AgentRegistry.java:37

unregister

public void unregister(String agentId)

设置注销。

Performs the unregister operation.

参数Parameters
名称Name类型Type说明Description
agentIdString智能体标识(类型 `String`)。The agent id.
源码Source io/agentscope/spring/boot/admin/registry/AgentRegistry.java:39

find

public Optional<Agent> find(String agentId)

设置查找。

Performs the find operation.

参数Parameters
名称Name类型Type说明Description
agentIdString智能体标识(类型 `String`)。The agent id.
返回Returns Optional<Agent>
返回可选。Returns optional.
源码Source io/agentscope/spring/boot/admin/registry/AgentRegistry.java:41

list

public List<Agent> list()

返回列表。

All registered agents in insertion order.

返回Returns List<Agent>
返回列出。Returns list.
源码Source io/agentscope/spring/boot/admin/registry/AgentRegistry.java:44

size

public int size()

返回大小。

Returns the size.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/spring/boot/admin/registry/AgentRegistry.java:46
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.