AS AgentScopeAPI 手册 / API Reference

WorkspaceAsyncToolRegistry

public class WorkspaceAsyncToolRegistry implements AsyncToolRegistry
源码Source 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.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。any `AbstractFilesystem` implementation
registryRootString注册表根(类型 `String`)。absolute path within the filesystem (e.g. `"/bus/async-tools"`)
源码Source io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:55–61

方法详情Method Detail

register

public Mono<Void> register(AsyncToolRecord record)

设置注册。

Performs the register operation.

参数Parameters
名称Name类型Type说明Description
recordAsyncToolRecord记录(类型 `AsyncToolRecord`)。The record.
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:63–79

complete

public Mono<Void> complete(String id, String result)

执行 complete 方法。

Performs the complete operation.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
resultString结果(类型 `String`)。The result.
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:81–84

fail

public Mono<Void> fail(String id, String error)

执行 fail 方法。

Performs the fail operation.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
errorString错误(类型 `String`)。The error.
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:86–89

markTimeout

public Mono<Void> markTimeout(String id)

设置该参数。

Performs the mark timeout operation.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:91–94

findStale

public Mono<List<AsyncToolRecord>> findStale(String sessionId, Duration ttl)

查找过期。

Finds the stale.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
ttlDuration存活时间(类型 `Duration`)。The ttl.
返回Returns Mono<List<AsyncToolRecord>>
返回Mono>。Returns mono.
源码Source io/agentscope/harness/agent/bus/WorkspaceAsyncToolRegistry.java:96–123
基于官方固定版本源码静态生成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.