A guardrail’s value is set by where it sits, not by how good it is
Twelve steps, four parts — six families of check, three streams of traffic, six arrangements, and no arrangement winning twice.
- All 12 steps, read online
- Runnable labs to download (plain Python, runs offline)
- Free updates whenever it's revised
- 14-day refund (conditions)
Introduction
You are about to put guardrails on an agent, and the advice available to you is a list of things to install: a safety filter, a policy check, a grounding step, a review queue.
The list is not the hard part. This volume runs the same six families of check over three streams of traffic, in six different arrangements, and gets three different winners with no arrangement winning twice. Four of those arrangements contain the identical six families and differ only in where the checks sit.
The whole thing, before any of the argument
Every box below is something you can install, and the rest of this volume is about which of them your own traffic actually needs.
What a guardrail is
A guardrail is a check that can refuse.
Not a policy document, not a system prompt, not a warning in the output, not a dashboard somebody looks at on Tuesday. It runs while a request is in flight and it has the authority to stop it. Everything hard about the subject comes from taking that definition seriously:
| because it… | the consequence |
|---|---|
| decides now | it runs in the request's own time. Whatever it knows at the moment it runs is all it will ever know |
| decides from what it can see | a check at the door sees a request. What the agent will do with it has not happened yet, and this is the constraint the rest of the volume is built on |
| refuses real people | a guardrail that stops a harmful request and one that refuses a legitimate user are the same event seen from two sides |
The result, up front
| stream | what it is | cheapest set | cost | position spread |
|---|---|---|---|---|
A · ordinary | mostly legitimate traffic, and the harm in it is crude | door | $254.80 | 2.2x |
B · adversarial | the same harms, phrased to get past a check at the door | acting | $515.48 | 13.7x |
C · leaky | benign requests whose answers leak or invent | exit | $449.90 | 9.6x |
Why position decides it
A check cannot run before the evidence it needs exists. A grounding check at the door is not badly tuned — there is no claim yet. That single rule empties most of the design space and creates the trade the whole volume turns on: early is cheap and blind, late is informed and expensive.
| family | earliest stage it can run | why not before |
|---|---|---|
| safety | input | harmful phrasing is in the request itself |
| policy | input | so is regulated content the user sent |
| tool | planning | nothing to permission until a tool has been chosen |
| data | execution | nothing to check until a source has been touched |
| behavior | execution | drift is only visible once the agent is acting |
| grounding | evaluation | a claim and a source must both exist to compare them |
The four kinds of money
Three of them are usually left off the comparison, and one of those three is paid entirely by people who did nothing wrong.
| what costs money | how much | who pays it |
|---|---|---|
| screening one request with one detector | $0.002 | you, on every request, whether or not anything fires |
| one harmful request that got through | $40.00 | you, once, when it reaches the world |
| one legitimate request wrongly refused | $2.50 | a real person who wanted something reasonable |
| a stage of finished work thrown away | $0.40 | you, every time a check fires late |
Is this for you?
| if… | then |
|---|---|
| you are deciding which guardrail product to buy | step 10 — the gap between the best and worst arrangement of the same checks is larger than any gap between checks |
| your input filter is not catching what you expected | step 8. There are two different reasons for that and they need opposite fixes |
| your requests look fine and your answers do not | step 9. No improvement to the input filter can help |
| somebody wants every check turned on everywhere | step 7, then step 10 |
| you are arguing about how much an incident is worth | step 12, which measures how little that argument decides |
The three streams of traffic
Twelve hundred requests each. They are premises rather than a survey — constructed to disagree, and labeled as constructions everywhere they appear.
| stream | harmful | of those, invisible everywhere | what it teaches |
|---|---|---|---|
A · ordinary | 88 | 2 | the cheapest check at the door catches everything catchable |
B · adversarial | 232 | 5 | the door catches nothing, and costs more than nothing |
C · leaky | 172 | 3 | nothing is observable until the answer exists |
How to read the source labels
| label | means |
|---|---|
| concept | argued from first principles. Quotes nothing from a lab |
| measured | a lab measured it. Every figure is read from labs/design.json |
| hands-on | you run it yourself, on your own traffic |