WorkspaceAsyncToolRegistry
public class WorkspaceAsyncToolRegistry implements AsyncToolRegistry
io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:43–205工作区异步工具注册表,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.agent.bus 包,实现 AsyncToolRegistry。核心成员包括 register、complete、fail、markTimeout、findStale、WorkspaceAsyncToolRegistry。
AsyncToolRegistry backed by AbstractFilesystem.
Each async tool record is persisted as a JSON file under
{registryRoot}/async-tools/{sessionId}/{recordId}.json. This ensures records survive
process crashes — io.agentscope.harness.agent.middleware.InboxMiddleware can detect
stale RUNNING records on session recovery and notify the LLM.
Works with any filesystem backend (local, remote, sandbox).
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public WorkspaceAsyncToolRegistry(AbstractFilesystem filesystem, String registryRoot) | 初始化 `WorkspaceAsyncToolRegistry` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<Void> register(AsyncToolRecord record) | 设置注册。 Performs the register operation. |
public Mono<Void> complete(String id, String result) | 执行 `complete` 方法。 Performs the complete operation. |
public Mono<Void> fail(String id, String error) | 执行 `fail` 方法。 Performs the fail operation. |
public Mono<Void> markTimeout(String id) | 设置该参数。 Performs the mark timeout operation. |
public Mono<List<AsyncToolRecord>> findStale(String sessionId, Duration ttl) | 查找过期。 Finds the stale. |
构造器详情Constructor Detail
WorkspaceAsyncToolRegistry
public WorkspaceAsyncToolRegistry(AbstractFilesystem filesystem, String registryRoot)
初始化 WorkspaceAsyncToolRegistry 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filesystem | AbstractFilesystem | 文件系统(类型 `AbstractFilesystem`)。any `AbstractFilesystem` implementation |
registryRoot | String | 注册表根(类型 `String`)。absolute path within the filesystem (e.g. `"/bus/async-tools"`) |
io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:55–61方法详情Method Detail
register
public Mono<Void> register(AsyncToolRecord record)
设置注册。
Performs the register operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
record | AsyncToolRecord | 记录(类型 `AsyncToolRecord`)。The record. |
Mono<Void>io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:63–79complete
public Mono<Void> complete(String id, String result)
执行 complete 方法。
Performs the complete operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 标识(类型 `String`)。The id. |
result | String | 结果(类型 `String`)。The result. |
Mono<Void>io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:81–84fail
public Mono<Void> fail(String id, String error)
执行 fail 方法。
Performs the fail operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 标识(类型 `String`)。The id. |
error | String | 错误(类型 `String`)。The error. |
Mono<Void>io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:86–89markTimeout
public Mono<Void> markTimeout(String id)
设置该参数。
Performs the mark timeout operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 标识(类型 `String`)。The id. |
Mono<Void>io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:91–94findStale
public Mono<List<AsyncToolRecord>> findStale(String sessionId, Duration ttl)
查找过期。
Finds the stale.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
ttl | Duration | 存活时间(类型 `Duration`)。The ttl. |
Mono<List<AsyncToolRecord>>io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:96–123