Package io.agentscope.harness.agent.bus
Class WorkspaceAsyncToolRegistry
java.lang.Object
io.agentscope.harness.agent.bus.WorkspaceAsyncToolRegistry
- All Implemented Interfaces:
AsyncToolRegistry
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 — InboxMiddleware can detect
stale RUNNING records on session recovery and notify the LLM.
Works with any filesystem backend (local, remote, sandbox).
-
Constructor Summary
ConstructorsConstructorDescriptionWorkspaceAsyncToolRegistry(AbstractFilesystem filesystem, String registryRoot) -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>Mark an async tool execution as completed.reactor.core.publisher.Mono<Void>Mark an async tool execution as failed.reactor.core.publisher.Mono<List<AsyncToolRecord>>Find async tool records for the given session that have been in RUNNING status longer than the specified TTL.reactor.core.publisher.Mono<Void>markTimeout(String id) Mark a stale async tool record as timed out.reactor.core.publisher.Mono<Void>register(AsyncToolRecord record) Register a new async tool execution.
-
Constructor Details
-
WorkspaceAsyncToolRegistry
- Parameters:
filesystem- anyAbstractFilesystemimplementationregistryRoot- absolute path within the filesystem (e.g."/bus/async-tools")
-
-
Method Details
-
register
Description copied from interface:AsyncToolRegistryRegister a new async tool execution.- Specified by:
registerin interfaceAsyncToolRegistry- Parameters:
record- the async tool record with statusAsyncToolRecord.RUNNING
-
complete
Description copied from interface:AsyncToolRegistryMark an async tool execution as completed.- Specified by:
completein interfaceAsyncToolRegistry- Parameters:
id- the async tool record idresult- the tool execution result text
-
fail
Description copied from interface:AsyncToolRegistryMark an async tool execution as failed.- Specified by:
failin interfaceAsyncToolRegistry- Parameters:
id- the async tool record iderror- the error message
-
markTimeout
Description copied from interface:AsyncToolRegistryMark a stale async tool record as timed out. Prevents it from being returned by subsequentAsyncToolRegistry.findStale(java.lang.String, java.time.Duration)calls.- Specified by:
markTimeoutin interfaceAsyncToolRegistry- Parameters:
id- the async tool record id
-
findStale
Description copied from interface:AsyncToolRegistryFind async tool records for the given session that have been in RUNNING status longer than the specified TTL. These are likely orphaned due to process crash.- Specified by:
findStalein interfaceAsyncToolRegistry- Parameters:
sessionId- the session to checkttl- records older than this duration are considered stale- Returns:
- stale RUNNING records
-