Skip to content

AgentToolOptions

type AgentToolOptions<TContext, TAgent, TParameters> = object;
Type Parameter

TContext

TAgent extends Agent<TContext, any>

TParameters extends AgentToolInputParameters

optional customOutputExtractor?: (output) => string | Promise<string>;

A function that extracts the output text from the agent. If not provided, the last message from the agent will be used.

Parameter Type

output

CompletedAgentToolInvocationRunResult<TContext, TAgent>

string | Promise<string>


optional includeInputSchema?: boolean;

Include the full JSON Schema for the structured tool input when invoking the agent.


optional inputBuilder?: AgentToolInputBuilder<TParameters>;

Builds the nested agent input from structured tool input data.


optional isEnabled?: boolean | ((args) => boolean | Promise<boolean>);

Determines whether this tool should be exposed to the model for the current run.


optional needsApproval?: boolean | ToolApprovalFunction<TParameters>;

Whether invoking this tool requires approval, matching the behavior of tool helpers. When provided as a function it receives the tool arguments and can implement custom approval logic.


optional onStream?: (event) => void | Promise<void>;

Optional hook to receive streamed events from the nested agent run.

Parameter Type

event

AgentToolStreamEvent<TAgent>

void | Promise<void>


optional parameters?: TParameters;

The schema used to validate tool input. Defaults to { input: string }.


optional resumeState?: AgentToolResumeStateOptions;

Controls how context is applied when resuming from serialized run state.


optional runConfig?: Partial<RunConfig>;

Run configuration for initializing the internal agent runner.


optional runOptions?: AgentToolRunOptions<TContext, TAgent>;

Additional run options for the agent (as tool) execution.


optional toolDescription?: string;

The description of the tool, which should indicate what the tool does and when to use it.


optional toolName?: string;

The name of the tool. If not provided, the name of the agent will be used.