What guardrails are and where they sit
What it is
A guardrail is a check that stops an agent doing, saying or accepting something it should not. Guardrails sit at four points in every run:
- Input: before the model sees the request.
- Tool call: after the model asks for an action, before it runs.
- Tool result: after the action, before the result enters the context.
- Output: before the reply reaches the user.
Around these sit run-level limits: steps, cost, time and rate.
Why it matters
An agent takes actions, so a mistake is not a bad sentence but a real event.
- No single check catches everything. Layers cover each other's gaps; this is called defence in depth.
- The most important layer is the one before a tool runs, because that is the last moment a wrong action can be stopped.
- Guardrails are designed from the worst case backwards: what is the most damaging thing this agent could do, and which line of code prevents it?
In the real world: A bank's agent has eleven guardrails across the four points; an internal red-team exercise got past four of them and was stopped by the fifth, which is the argument for having eleven.
Visual example
PlacementThe third box is the last chance to stop a wrong action.
One guardrail at the front door and nothing after. An input filter cannot see what the agent will decide ten steps later, or what a tool result will bring in.