Type Alias: SubAgentToolRun()
@providerprotocol/agents / index / SubAgentToolRun
Type Alias: SubAgentToolRun()
Section titled “Type Alias: SubAgentToolRun()”SubAgentToolRun = (
params,context?) =>Promise<string>
Defined in: src/subagent/index.ts:421
Function signature for a sub-agent tool’s run method.
This type represents the shape of the run function created by
createSubAgentTool. It accepts the tool parameters and an optional
execution context that provides event propagation capabilities.
Parameters
Section titled “Parameters”params
Section titled “params”Record<string, unknown>
The tool parameters as defined by the tool’s JSON Schema
context?
Section titled “context?”Optional execution context for event propagation and tracing
Returns
Section titled “Returns”Promise<string>
A promise resolving to the sub-agent’s text response
Example
Section titled “Example”// Type-safe tool invocationconst tool = createSubAgentTool({ ... });const run = tool.run as SubAgentToolRun;
const result = await run( { query: 'search term' }, { toolCallId: 'call_123', onSubagentEvent: handleEvent });