SessionsTool
public class SessionsTool
io/agentscope/harness/coding/session/tool/SessionsTool.java:61–577会话工具,封装可被智能体调用的能力。位于 io.agentscope.harness.coding.session.tool 包。核心成员包括 sessionsSpawn、sessionsSend、sessionsList、sessionsHistory、sessionsPendingCompletions、SessionsTool。
Tool facade exposing managed subagent session operations to the agent.
Mirrors the OpenClaw sessions tool set:
-
sessions_spawn— spawn an isolated subagent session -
sessions_send— send a message to an existing session by key or label -
sessions_list— list managed sessions with optional filters -
sessions_history— read a session's conversation transcript
Async operations (timeout_seconds=0) submit work to TaskRepository and return
a task_id for retrieval via the companion TaskTool. The same completion may
also be queued for the requester as a structured PendingCompletion (poll with sessions_pending_completions).
Uses SessionAgentManager for full session lifecycle management.
构造器摘要Constructor Summary
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String sessionsSpawn(String agentId, String task, String label, String mode, Integer timeoutSeconds) | 执行 `sessionsSpawn` 方法。 Performs the sessions spawn operation. |
public String sessionsSend(String sessionKey, String label, String message, Integer timeoutSeconds) | 执行会话发送相关操作。 Performs the sessions send operation. |
public String sessionsList(String kinds, Integer limit, Integer activeMinutes) | 执行会话列表相关操作。 Performs the sessions list operation. |
public String sessionsHistory(String sessionKey, Integer limit) | 执行会话历史相关操作。 Performs the sessions history operation. |
public String sessionsPendingCompletions(String requesterSessionKey, Integer limit) | 执行会话待处理补全相关操作。 Performs the sessions pending completions operation. |
构造器详情Constructor Detail
SessionsTool
public SessionsTool(SessionAgentManager sessionAgentManager, TaskRepository taskRepository, String parentSessionKey, int parentSpawnDepth)
初始化 SessionsTool 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionAgentManager | SessionAgentManager | 会话智能体管理器(类型 `SessionAgentManager`)。full session lifecycle manager |
taskRepository | TaskRepository | 任务仓库(类型 `TaskRepository`)。background task store (for async fire-and-forget) |
parentSessionKey | String | 父级会话键(类型 `String`)。session key of the agent that owns this tool instance (null = main) |
parentSpawnDepth | int | 父级 Spawn Depth(类型 `int`)。spawn depth of the owning agent (0 = main agent) |
io/agentscope/harness/coding/session/tool/SessionsTool.java:86–96方法详情Method Detail
sessionsSpawn
public String sessionsSpawn(String agentId, String task, String label, String mode, Integer timeoutSeconds)
执行 sessionsSpawn 方法。
Performs the sessions spawn operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识(类型 `String`)。The agent id. |
task | String | 任务(类型 `String`)。The task. |
label | String | 标签(类型 `String`)。The label. |
mode | String | 模式(类型 `String`)。The mode. |
timeoutSeconds | Integer | 超时秒(类型 `Integer`)。The timeout seconds. |
Stringio/agentscope/harness/coding/session/tool/SessionsTool.java:102–251sessionsSend
public String sessionsSend(String sessionKey, String label, String message, Integer timeoutSeconds)
执行会话发送相关操作。
Performs the sessions send operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | String | 会话键(类型 `String`)。The session key. |
label | String | 标签(类型 `String`)。The label. |
message | String | 消息(类型 `String`)。The message. |
timeoutSeconds | Integer | 超时秒(类型 `Integer`)。The timeout seconds. |
Stringio/agentscope/harness/coding/session/tool/SessionsTool.java:257–352sessionsList
public String sessionsList(String kinds, Integer limit, Integer activeMinutes)
执行会话列表相关操作。
Performs the sessions list operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
kinds | String | kinds(类型 `String`)。The kinds. |
limit | Integer | 数量上限(类型 `Integer`)。The limit. |
activeMinutes | Integer | active 分钟(类型 `Integer`)。The active minutes. |
Stringio/agentscope/harness/coding/session/tool/SessionsTool.java:358–422sessionsHistory
public String sessionsHistory(String sessionKey, Integer limit)
执行会话历史相关操作。
Performs the sessions history operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | String | 会话键(类型 `String`)。The session key. |
limit | Integer | 数量上限(类型 `Integer`)。The limit. |
Stringio/agentscope/harness/coding/session/tool/SessionsTool.java:428–463sessionsPendingCompletions
public String sessionsPendingCompletions(String requesterSessionKey, Integer limit)
执行会话待处理补全相关操作。
Performs the sessions pending completions operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
requesterSessionKey | String | requester 会话键(类型 `String`)。The requester session key. |
limit | Integer | 数量上限(类型 `Integer`)。The limit. |
Stringio/agentscope/harness/coding/session/tool/SessionsTool.java:469–520