AgentToolOptions
type AgentToolOptions<TContext, TAgent, TParameters> = object;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
|
|
|
|
Properties
Section titled “Properties”customOutputExtractor?
Section titled “customOutputExtractor?”optional customOutputExtractor?: (output) => string | Promise<string>;A function that extracts the output text from the agent. By default, runs with output guardrail results or a handled error use the final output, including an empty string. Other runs prefer text from the latest model response, falling back to the final output.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”string | Promise<string>
includeInputSchema?
Section titled “includeInputSchema?”optional includeInputSchema?: boolean;Include the full JSON Schema for the structured tool input when invoking the agent.
inputBuilder?
Section titled “inputBuilder?”optional inputBuilder?: AgentToolInputBuilder<TParameters>;Builds the nested agent input from structured tool input data.
isEnabled?
Section titled “isEnabled?”optional isEnabled?: boolean | ((args) => boolean | Promise<boolean>);Determines whether this tool should be exposed to the model for the current run.
needsApproval?
Section titled “needsApproval?”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.
onStream?
Section titled “onStream?”optional onStream?: (event) => void | Promise<void>;Optional hook to receive streamed events from the nested agent run.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”void | Promise<void>
onStreamMaxPendingEvents?
Section titled “onStreamMaxPendingEvents?”optional onStreamMaxPendingEvents?: number | null;Maximum events waiting for onStream or on(…) handlers, excluding the event currently being handled. Defaults to 1024; null permits an unlimited backlog. Must be a positive safe integer when set. Overflow aborts the nested run and fails the tool through its normal error handling. Already started handler promises cannot be cancelled. This bounds event count, not event sizes or total memory, and has no effect without streaming handlers.
parameters?
Section titled “parameters?”optional parameters?: TParameters;The schema used to validate tool input. Defaults to { input: string }.
resumeState?
Section titled “resumeState?”optional resumeState?: AgentToolResumeStateOptions;Controls how context is applied when resuming from serialized run state.
runConfig?
Section titled “runConfig?”optional runConfig?: Partial<RunConfig>;Run configuration for initializing the internal agent runner. When the child uses an explicit Model object, parent transport overrides in providerData are not inherited. Supply child transport overrides here.
runOptions?
Section titled “runOptions?”optional runOptions?: AgentToolRunOptions<TContext, TAgent>;Additional run options for the agent (as tool) execution.
toolDescription?
Section titled “toolDescription?”optional toolDescription?: string;The description of the tool, which should indicate what the tool does and when to use it.
toolName?
Section titled “toolName?”optional toolName?: string;The name of the tool. If not provided, the name of the agent will be used.