Agent Wealth HubFree public resources
中文 EN العربية

Back to catalog / Agent safety

Validate inputs and final outputs in an agent workflow

Add testable rejection conditions for user input and final answers, distinguishing per-tool checks.

Goal

Prevent inputs or answers that violate application rules from proceeding.

Steps

  1. Separate structural schema validation from business/policy checks: the former constrains field shape, the latter judges whether a request or result is allowed. [openai-guardrails]
  2. Use @input_guardrail for the first input and @output_guardrail for final output; return GuardrailFunctionOutput(..., tripwire_triggered=True) to block. [openai-guardrails]
  3. For policy checks on every custom function-tool call, attach @tool_input_guardrail / @tool_output_guardrail rather than relying on agent-level checks. [openai-guardrails]
  4. Add tool-level checks to each side-effecting custom tool; do not assume agent-level checks cover handoffs. [openai-guardrails]
  5. Trigger each check with allowed and rejected cases and confirm failures stop at the intended boundary. [openai-guardrails]

How to verify

Record trigger tests and blocked execution points for each guardrail; verify handoff and tool boundaries are covered.

Troubleshooting

If a check does not run, verify which agent or tool owns that workflow boundary; handoffs and hosted tools may follow different paths.

Permissions

Prerequisites

Permissions

Limitations

Agent input checks run only on the first agent and output checks only on the final agent; tool checks do not cover handoffs or most hosted tools. Parallel input checks may fire after model work starts.

Pinned upstream source

https://github.com/openai/openai-agents-python/blob/f53c62451c7f34c15f0c87fa745e05404025420f/docs/guardrails.md

Repository
openai/openai-agents-python
File path
docs/guardrails.md
Pinned commit
f53c62451c7f34c15f0c87fa745e05404025420f
Source checked
2026-10-14 · Reviewed against the pinned upstream source

Repository metrics

These values describe the upstream repository, not popularity or likes for an individual skill or playbook.

Stars
Not collected
Forks
Not collected
Observed at
Not collected

No metrics snapshot is available yet.

License: MIT

Main topic

Make Agent behavior safer and easier to verify

Related resources