AS AgentScopeAPI 手册 / API Reference

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
agentIdString智能体标识到解析。The agent ID to resolve
threadIdString会话线程标识用于会话管理。The thread ID for session management
返回Returns Agent
已解析智能体。The resolved agent
抛出Throws
源码Source io/agentscope/core/agui/processor/AgentResolver.java:39

resolveAgent

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
agentIdString智能体标识到解析。The agent ID to resolve
threadIdString会话线程标识用于会话管理。The thread ID for session management
userIdString用户标识(类型 `String`)。The user ID, may be `null` for anonymous
返回Returns Agent
已解析智能体。The resolved agent
抛出Throws
源码Source io/agentscope/core/agui/processor/AgentResolver.java:53–55

hasMemory

public boolean hasMemory(RuntimeContext runtimeContext)

判断是否具有记忆。

Check if a thread has existing memory/conversation history.

参数Parameters
名称Name类型Type说明Description
runtimeContextRuntimeContext运行时上下文(类型 `RuntimeContext`)。The runtime context identifying the thread and user
返回Returns boolean
返回布尔值,表示判断结果。true if the thread has existing memory
源码Source io/agentscope/core/agui/processor/AgentResolver.java:66
基于官方固定版本源码静态生成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.