---
source: https://iinventedlight.com/library/notes/writing-agent-guardrails.md
title: "Run input and output guardrails, and trip a wire when a check fails"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (OpenAI Agents SDK docs; Inspect AI docs); prose restates cited source lines in own words"
license_family: mit
attribution: "Summary by iinventedlight (AI-assisted). Sources: OpenAI Agents SDK, Guardrails, MIT; Inspect AI, Tool Approval, MIT."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-22
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-22
as_of: 2026-11-22
confidence: medium
untested: "Not reproduced (2026-11-22). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coverage-gaps
topic_area: "how-to: agent guardrails"
tags: [agents, guardrails, validation, approvals, safety]
client: Librarian
sources:
  - id: S1
    title: "Guardrails"
    publisher: OpenAI Agents SDK
    url: https://github.com/openai/openai-agents-python/blob/main/docs/guardrails.md
    accessed: 2026-11-22
    license: "MIT"
  - id: S2
    title: "Tool Approval"
    publisher: Inspect AI (UK AI Security Institute)
    url: https://github.com/UKGovernmentBEIS/inspect_ai/blob/main/docs/approval.qmd
    accessed: 2026-11-22
    license: "MIT"
---
# Run input and output guardrails, and trip a wire when a check fails
**Answer:** Guardrails let you check and validate user input and agent output. Input guardrails run on the initial user input. Output guardrails run on the final agent output. A tripwire rejects the candidate final output. Approval policies cover the tool-call side of the same problem.

## Why it matters

Guardrails enable you to do checks and validations of user input and agent output. There are two kinds. Input guardrails run on the initial user input, and only for the first agent in the chain. Output guardrails run on the final agent output, and only for the agent that produces that output.

If the tripwire is triggered, an exception is raised so you can appropriately respond to the user. A tripwire rejects the candidate final output. Output guardrails always run after the agent completes.

Tool calls need a different check. Inspect's approval mode lets you create fine-grained policies for tool calls made by models. Custom approvers can approve, reject, or escalate to another approver. Use guardrails for input and output, and use approval when the model wants to act.

- `Input guardrail` Input guardrails run on the initial user input
- `Output guardrail` A tripwire rejects the candidate final output
- `Approver for tools` Approve, reject, or escalate a tool call

## See also

- [human-in-the-loop-approvals](https://iinventedlight.com/library/notes/human-in-the-loop-approvals/)
- [agent-sandbox-modes](https://iinventedlight.com/library/notes/agent-sandbox-modes/)
- [ao-security-guardrail-layers](https://iinventedlight.com/library/notes/ao-security-guardrail-layers/)

## Claims

- id: C1
  claim: Input guardrails run on the initial user input.
  source: S1
  evidence: "Input guardrails run on the initial user input"

- id: C2
  claim: A tripwire rejects the candidate final output.
  source: S1
  evidence: "A tripwire rejects the candidate final output."

- id: C3
  claim: Custom approvers can approve, reject, or escalate a tool call.
  source: S2
  evidence: "Custom approvers that decide to either approve, reject, or escalate to another approver."

## Sources

- [S1] Guardrails. OpenAI Agents SDK. https://github.com/openai/openai-agents-python/blob/main/docs/guardrails.md . License: MIT. Accessed 2026-11-22.

- [S2] Tool Approval. Inspect AI (UK AI Security Institute). https://github.com/UKGovernmentBEIS/inspect_ai/blob/main/docs/approval.qmd . License: MIT. Accessed 2026-11-22.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: OpenAI Agents SDK, Guardrails, MIT; Inspect AI, Tool Approval, MIT. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
