bodhi-realtime-agent / PersistentSubagentInstance
Interface: PersistentSubagentInstance
Defined in: src/agent/persistent-subagent-types.ts:19
A persistent subagent instance that can be reused across multiple tool calls.
Implementors wrap a provider-specific client/session (e.g., Claude Code session, OpenClaw gateway session) and expose a simple invoke/dispose contract.
Properties
key
readonlykey:string
Defined in: src/agent/persistent-subagent-types.ts:21
Unique key identifying this persistent instance (matches the subagentKey used to acquire it).
Methods
dispose()
dispose():
Promise<void>
Defined in: src/agent/persistent-subagent-types.ts:52
Release provider resources held by this instance. Must be idempotent — safe to call multiple times.
Returns
Promise<void>
invoke()
invoke(
taskDescription,args,signal?):Promise<string>
Defined in: src/agent/persistent-subagent-types.ts:32
Execute a task using this persistent instance. The instance retains context from prior invocations.
Parameters
taskDescription
string
Description of the task to execute.
args
Record<string, unknown>
Tool call arguments.
signal?
AbortSignal
Abort signal for cancellation.
Returns
Promise<string>
Result text from the subagent.
invokeWithScheduling()?
optionalinvokeWithScheduling(taskDescription,args,signal?):Promise<string|BackgroundToolResult>
Defined in: src/agent/persistent-subagent-types.ts:42
Optional: like invoke, but the result may also set how it is delivered (PersistentSubagentResult). When present, the session calls this instead of invoke.
Parameters
taskDescription
string
args
Record<string, unknown>
signal?
AbortSignal
Returns
Promise<string | BackgroundToolResult>