コンテンツにスキップ

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. 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.

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 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.


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. When the child uses an explicit Model object, parent transport overrides in providerData are not inherited. Supply child transport overrides here.


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.