ModelRefs / Guardrailed Agent — Agent Pattern
Guardrailed Agent — Agent Pattern
Wrap agent inputs and outputs with explicit validators that block unsafe behavior before it ships. Both run as deterministic checks, not the LLM itself.
Overview
Input guardrails check for prompt injection, PII, and policy violations. Output guardrails enforce schema, content policy, and grounding. Both run as deterministic checks, not the LLM itself.
When to use it: Your agent ships to end users or executes actions and needs hard safety guarantees.
Pattern details
| Pattern class | safety |
|---|---|
| Difficulty | intermediate |
| Autonomy | guided |
| Also known as | input-output guardrails, safety wrapper |
| Last reviewed | 2026-06-07 |
Known failure modes
- Guard bypass — Attack obscures payload to bypass the guard. Mitigation: Layer rule + LLM-judge guards; track bypass rate.
- Over-blocking — Guards reject benign requests. Mitigation: Tune thresholds and surface override paths.
When not to use it
- Relying on the agent's own prompt for safety.
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Guardrailed Agent — Agent Pattern.
Frequently asked questions
When should I use the Guardrailed Agent agent pattern?
Your agent ships to end users or executes actions and needs hard safety guarantees.
What are common failure modes of Guardrailed Agent?
Guard bypass • Over-blocking
Is Guardrailed Agent production-ready?
Yes when paired with the safety controls and observability hooks documented on the pattern page.