AgentResolver
public interface AgentResolver
源码Source
io/agentscope/core/agui/processor/AgentResolver.java:29–67定义智能体解析器契约的接口。位于 io.agentscope.core.agui.processor 包。核心成员包括 resolveAgent、hasMemory。
Interface for resolving agents from various sources.
This interface abstracts the agent resolution logic, allowing different implementations for different scenarios (e.g., simple registry lookup, session-based resolution with memory management).
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Agent resolveAgent(String agentId, String threadId) | 解析智能体。 Resolve an agent by its ID and thread ID. |
default public Agent resolveAgent(String agentId, String threadId, String userId)default | 解析智能体。 Resolve an agent by its ID, thread ID and user ID. |
public boolean hasMemory(RuntimeContext runtimeContext) | 判断是否具有记忆。 Check if a thread has existing memory/conversation history. |
方法详情Method Detail
resolveAgent
public Agent resolveAgent(String agentId, String threadId)
解析智能体。
Resolve an agent by its ID and thread ID.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识到解析。The agent ID to resolve |
threadId | String | 会话线程标识用于会话管理。The thread ID for session management |
Agent已解析智能体。The resolved agent
AguiException.AgentNotFoundException当if 智能体是不找到时抛出 `AguiException.AgentNotFoundException`。if the agent is not found
源码Source
io/agentscope/core/agui/processor/AgentResolver.java:39resolveAgent
default public Agent resolveAgent(String agentId, String threadId, String userId)
default
解析智能体。
Resolve an agent by its ID, thread ID and user ID.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识到解析。The agent ID to resolve |
threadId | String | 会话线程标识用于会话管理。The thread ID for session management |
userId | String | 用户标识(类型 `String`)。The user ID, may be `null` for anonymous |
Agent已解析智能体。The resolved agent
AguiException.AgentNotFoundException当if 智能体是不找到时抛出 `AguiException.AgentNotFoundException`。if the agent is not found
源码Source
io/agentscope/core/agui/processor/AgentResolver.java:53–55hasMemory
public boolean hasMemory(RuntimeContext runtimeContext)
判断是否具有记忆。
Check if a thread has existing memory/conversation history.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context identifying the thread and user |
boolean返回布尔值,表示判断结果。true if the thread has existing memory
源码Source
io/agentscope/core/agui/processor/AgentResolver.java:66