AI agent guardrails: input, output and action guardrails compared
"Guardrails" now means at least three different things, and most products marketed as AI guardrails only do one of them. If your agent can write to production, the kind you need is the one that is least talked about: the guardrail on actions. Here is how the three kinds differ, and what we measured when we compared approaches on 62 real and realistic agent sessions.
In short
- Input guardrails filter what goes into the model. Output guardrails filter what comes out as text.
- Action guardrails decide whether a tool call runs. They sit outside the model, where injected text can't reach them.
- "Ask for everything" stops harm but held 40 of 41 routine steps in our benchmark. People stop reading.
- Checking whole sessions stopped 65 of 66 harmful steps while holding 3 routine ones.
Three kinds of guardrail
- Input guardrails screen prompts and retrieved content: jailbreak detection, PII redaction, topic limits. Useful for chatbots. They are usually a model judging text, so they share the model's weaknesses.
- Output guardrails check what the model writes: toxicity, leaked secrets, format, grounding. Useful when text is the product.
- Action guardrails sit between the agent and its tools and decide whether each call runs, waits for a person, or is refused. When the agent can delete, pay, push or email, this is the layer that matters.
What an action guardrail needs
- Out of the model's reach. If the guardrail lives in the system prompt, injected text can argue with it. It has to run as a separate process the agent can't edit.
- Reads the real action. Parse the shell command, the SQL, the API request.
rm -rf ./buildandrm -rf ~/are one character apart. - Remembers. Single calls look fine; chains don't. Backups off, then a delete. A secret read, then an upload.
- Has a middle answer. Allow and block aren't enough. Most risky actions are legitimate sometimes; they need a person, with the effect shown.
- Deterministic. The same call gets the same answer, so you can test it, review it in a pull request and explain it to an auditor.
What we measured
Show as a table
| Approach | Harmful stopped (of 66) | Routine held (of 41) |
|---|---|---|
| Auto-run (no checks) | 0 | 0 |
| Ask for everything | 65 | 40 |
| Allowlist of dev tools | 53 | 10 |
| Squidbrake, one step | 62 | 2 |
| Squidbrake, whole session | 65 | 3 |
Two things stand out. Asking a person about everything stops nearly as much harm, but it held 40 of 41 routine steps
and asked 112 times; nobody reads the 112th prompt. An allowlist of common developer tools is quieter but stopped only
53 of 66 harmful steps, because it can't tell a safe curl from one that posts your config to an address a
web page named. We kept our 3 false positives in the published numbers rather than tune them away.
Guardrails compared with what you already have
| Action guardrail | IAM | Policy engine (OPA, Cedar) | Text guardrail | |
|---|---|---|---|---|
| Remembers what the agent did before | Yes | No | No, stateless | Only in the prompt |
| Reads the actual command | Yes, parsed | API action only | If you write it | As text |
| Out of the model's reach | Yes | Yes | Yes | Often not |
| Holds one step for a person | Yes | No | No | Asks in the chat |
| Shows the effect before approval | Rows, resources, commits | No | No | No |
You still want IAM and least privilege. The action guardrail covers what they can't: the gray area where the agent is allowed to do something, but not right now, not this way, or not without someone else agreeing.
Rolling one out
- Start in shadow mode: log what would have been held or blocked, change nothing.
- After a week, read the would-have-held list. Tune the rules that fired on routine work.
- Enforce for irreversible actions first: deletes, destructive SQL, infrastructure, money, outbound messages.
- Route approvals to the right people (finance for refunds, the on-call for infra) where they already are, such as Slack or their phone.
FAQ
What are AI agent guardrails?
Controls that limit what an AI agent can do. Input and output guardrails filter text going into and out of the model; action guardrails decide whether each tool call the agent makes is allowed, held for a person or blocked.
What is the difference between LLM guardrails and agent guardrails?
LLM guardrails are mostly about text: what the model is asked and what it says. Agent guardrails add control over actions: commands, API calls, database writes, payments and messages.
Do guardrails use an LLM?
Many input and output guardrails do. Squidbrake does not: decisions come from rules, a command parser and the agent's recent history, so the same call always gets the same answer.
How do you avoid approval fatigue?
Only ask about what can't be undone, show the effect rather than the raw call, and look at sessions instead of single steps. In our benchmark that held 3 of 41 routine steps, against 40 for asking about everything.
Try it on your own agents. pipx install squidbrake, then
squidbrake connect all. Start in shadow mode: nothing is blocked in week one, you see what would have been.
Quickstart · Benchmark · Book a demo