AS AgentScopeAPI 手册 / API Reference

SessionSearchTool

public class SessionSearchTool
源码Source io/agentscope/harness/agent/tool/SessionSearchTool.java:42–342

会话搜索工具,封装可被智能体调用的能力。位于 io.agentscope.harness.agent.tool 包。核心成员包括 sessionSearch、sessionList、sessionHistory、SessionSearchTool。

Tool for searching past session transcripts and viewing session history.

Operates exclusively on the local session cache. Remote synchronisation is handled by io.agentscope.harness.agent.memory.session.SessionTree#load() in write paths (e.g. io.agentscope.harness.agent.memory.MemoryFlushManager), keeping this tool lightweight and fast for in-process search.

构造器摘要Constructor Summary

构造器Constructor说明Description
public SessionSearchTool(WorkspaceManager workspaceManager)
初始化 `SessionSearchTool` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String sessionSearch(RuntimeContext runtimeContext, String query, String agentId, Integer maxResults)
执行会话搜索相关操作。
Performs the session search operation.
public String sessionList(RuntimeContext runtimeContext, String agentId)
执行会话列表相关操作。
Performs the session list operation.
public String sessionHistory(RuntimeContext runtimeContext, String agentId, String sessionId, Integer lastN)
执行会话历史相关操作。
Performs the session history operation.

构造器详情Constructor Detail

SessionSearchTool

public SessionSearchTool(WorkspaceManager workspaceManager)

初始化 SessionSearchTool 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
workspaceManagerWorkspaceManager工作区管理器(类型 `WorkspaceManager`)。The workspace manager.
源码Source io/agentscope/harness/agent/tool/SessionSearchTool.java:48–50

方法详情Method Detail

sessionSearch

public String sessionSearch(RuntimeContext runtimeContext, String query, String agentId, Integer maxResults)

执行会话搜索相关操作。

Performs the session search operation.

参数Parameters
名称Name类型Type说明Description
runtimeContextRuntimeContext运行时上下文(类型 `RuntimeContext`)。The runtime context.
queryString查询文本(类型 `String`)。The query.
agentIdString智能体标识(类型 `String`)。The agent id.
maxResultsInteger最大结果(类型 `Integer`)。The max results.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/tool/SessionSearchTool.java:52–101

sessionList

public String sessionList(RuntimeContext runtimeContext, String agentId)

执行会话列表相关操作。

Performs the session list operation.

参数Parameters
名称Name类型Type说明Description
runtimeContextRuntimeContext运行时上下文(类型 `RuntimeContext`)。The runtime context.
agentIdString智能体标识(类型 `String`)。The agent id.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/tool/SessionSearchTool.java:103–163

sessionHistory

public String sessionHistory(RuntimeContext runtimeContext, String agentId, String sessionId, Integer lastN)

执行会话历史相关操作。

Performs the session history operation.

参数Parameters
名称Name类型Type说明Description
runtimeContextRuntimeContext运行时上下文(类型 `RuntimeContext`)。The runtime context.
agentIdString智能体标识(类型 `String`)。The agent id.
sessionIdString会话标识(类型 `String`)。The session id.
lastNInteger最后 N(类型 `Integer`)。The last n.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/tool/SessionSearchTool.java:165–219
基于官方固定版本源码静态生成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.