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