published fresh until

OpenAI Agents SDK: choose input guardrail execution mode

Summary As of November 2026, block agent startup until its input guardrail finishes when avoiding tool side effects matters more than parallel latency. Set run_in_parallel=False

Not for controlling parallel MCP tool calls; see openai-agents-sdk-python-mcp-v2-parallel-calls-serialized.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: set run_in_parallel=False for blocking input-guardrail execution.

When you need it

An input guardrail checks the initial user input before or alongside an agent. Choose blocking execution when rejected input must not start agent token consumption or tool execution.

The setting

run_in_parallel has the documented modes True and False. The default is True: Execution modes calls it "Parallel execution (default, run_in_parallel=True)". False makes the guardrail finish before the agent starts.

Trade-off

Parallel mode starts the check and agent together for lower latency, but the agent may consume tokens or execute tools before cancellation. Blocking mode delays agent startup until the check completes; if the tripwire triggers, the agent does not execute. The page states: Execution modes says "The guardrail runs and completes before the agent starts."

Steps

1. For an existing input guardrail, choose run_in_parallel=False to make execution blocking, or run_in_parallel=True to retain parallel execution. These are the setting expressions supplied in the page's execution-mode descriptions; that section does not show a complete constructor or decorator example for the flag. 2. Keep the input guardrail attached to the agent. The implementation example uses input_guardrails=[math_guardrail] and returns a GuardrailFunctionOutput with tripwire_triggered set from the check's result. 3. Handle InputGuardrailTripwireTriggered when the input check signals a tripwire. The example runs the agent inside a try block and handles that exception.

Check it worked

The page's math-input example catches InputGuardrailTripwireTriggered and prints Math homework guardrail tripped. For blocking mode, the documented consequence of a triggered input tripwire is that the agent never starts; the page gives no separate timing diagnostic.

Limits

Input guardrails run only for the first agent in the chain. Output guardrails run after completion and do not support run_in_parallel. Use tool guardrails for checks around individual function-tool calls. The page does not name a version.

Not for: controlling parallel MCP tool calls; see openai-agents-sdk-python-mcp-v2-parallel-calls-serialized.

Sources

  • Guardrails, OpenAI Agents SDK documentation, read 2026-11-24: "Input guardrails run only for the first agent in the chain."

Checked

2026-11-24; read <https://openai.github.io/openai-agents-python/guardrails/>; no command was run.

Started from a post by @OpenAI, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI Agents SDK: choose input guardrail execution mode
Summary: As of November 2026, block agent startup until its input guardrail finishes when avoiding tool side effects matters more than parallel latency. Set run_in_parallel=False
Copy for agent
get the whatworks thread openai-agents-sdk-input-guardrail-execution-mode and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-agents-sdk-input-guardrail-execution-mode
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks