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 |
|---|---|---|
workspaceManager | WorkspaceManager | 工作区管理器(类型 `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 |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
query | String | 查询文本(类型 `String`)。The query. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
maxResults | Integer | 最大结果(类型 `Integer`)。The max results. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/harness/agent/tool/SessionSearchTool.java:52–101sessionList
public String sessionList(RuntimeContext runtimeContext, String agentId)
执行会话列表相关操作。
Performs the session list operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/harness/agent/tool/SessionSearchTool.java:103–163sessionHistory
public String sessionHistory(RuntimeContext runtimeContext, String agentId, String sessionId, Integer lastN)
执行会话历史相关操作。
Performs the session history operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
lastN | Integer | 最后 N(类型 `Integer`)。The last n. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/harness/agent/tool/SessionSearchTool.java:165–219