コンテンツにスキップ

RunConfig

このコンテンツはまだ日本語訳がありません。

type RunConfig = object;

Configures settings for the entire agent run.

callModelInputFilter?: CallModelInputFilter;

Invoked immediately before calling the model, allowing callers to edit the system instructions or input items that will be sent to the model.


groupId?: string;

A grouping identifier to use for tracing, to link multiple traces from the same conversation or process. For example, you might use a chat thread ID.


handoffInputFilter?: HandoffInputFilter;

A global input filter to apply to all handoffs. If Handoff.inputFilter is set, then that will take precedence. The input filter allows you to edit the inputs that are sent to the new agent. A selected filtered handoff cannot use conversationId or previousResponseId. See the documentation in Handoff.inputFilter for more details.


inputGuardrails?: InputGuardrail[];

A list of input guardrails to run on the initial run input.


model?: string | Model;

The model to use for the entire agent run. If set, will override the model set on every agent. String model names are resolved with the configured modelProvider, or the default model provider if no explicit provider is configured.


modelProvider?: ModelProvider;

The model provider to use when looking up string model names. Defaults to OpenAI.


modelSettings?: ModelSettings;

Configure global model settings. Any non-null values will override the agent-specific model settings.


outputGuardrailBlockedMessage?: OutputGuardrailBlockedMessage<any>;

Customizes the data-free placeholder retained when an output guardrail rejects terminal tool output. A formatter receives safe run metadata and may return a string or a Promise. Invalid values and formatter failures fall back to the SDK default.


outputGuardrails?: OutputGuardrail<AgentOutputType<unknown>>[];

A list of output guardrails to run on the final output of the run.


reasoningItemIdPolicy?: ReasoningItemIdPolicy;

Controls how run items are converted into model input for subsequent turns.


sandbox?: SandboxRunConfig;

Sandbox runtime configuration used when execution reaches a sandbox agent.


sessionInputCallback?: SessionInputCallback;

Customizes how session history is combined with the current turn’s input. When omitted, history items are appended before the new input.


toolErrorFormatter?: ToolErrorFormatter;

Formats tool error messages that are returned to the model. Returning undefined falls back to the SDK default message.


toolExecution?: ToolExecutionConfig;

SDK-side execution settings for local tool calls.


toolNameCollisionPolicy?: ToolNameCollisionPolicy;

Controls collisions between enabled function tool and handoff names.

  • warn logs an actionable warning and exposes only the current dispatch winner.
  • error raises UserError before the model is called.

Defaults to warn. Existing strict validation for namespaced and deferred tools is unchanged.


toolNotFoundBehavior?: ToolNotFoundBehavior;

Controls missing function tools and deferred function tools that are not loaded.

  • raise_error preserves the default behavior and raises a ModelBehaviorError.
  • return_error_to_model returns a model-visible tool error and lets the run continue. Unloaded deferred tools must be loaded through tool_search before they can execute. Hosted search with the default query schema uses the built-in client loader on the recovery turn when no deferred hosted MCP tools are configured, to return definitions already known to the server. Recovery is model-driven; instruct the model to retry errors rather than treat them as successful function results. Recovery intent is local to the source Agent and live RunState; a restored state needs a fresh unloaded call before switching to client search.

traceId?: string;

A custom trace ID to use for tracing. If not provided, we will generate a new trace ID.


traceIncludeSensitiveData: boolean;

Whether we include potentially sensitive data (for example: inputs/outputs of tool calls or LLM generations) in traces. If false, we’ll still create spans for these events, but the sensitive data will not be included.


traceMetadata?: Record<string, string>;

An optional dictionary of additional metadata to include with the trace.


tracing?: TracingConfig;

Tracing configuration for this run. Use this to override the API key used when exporting traces.


tracingDisabled: boolean;

Whether tracing is disabled for the agent run. If disabled, we will not trace the agent run.


workflowName?: string;

The name of the run, used for tracing. Should be a logical name for the run, like “Code generation workflow” or “Customer support agent”.