Articles / Guardrails: What They Can and Cannot Do
AI Architecture · Guardrails

Guardrails: What They Can and Cannot Do

“We added guardrails” has become the reflexive answer to every AI risk, and it is doing a lot of unearned work. A guardrail is a filter that sits around the model — checking what goes in, checking what comes out, and blocking what looks dangerous. That is genuinely useful. It is also frequently sold as a solution to problems it cannot solve, because a guardrail is itself a classifier making a probabilistic judgement about adversarial text. Understanding where the guarantee is real and where it evaporates is the whole point of this article.

What a guardrail actually is

Strip away the branding and a guardrail is a check placed at a boundary. An input guardrail inspects the request before the model sees it — screening for prompt-injection patterns, disallowed topics, PII, or off-limits instructions. An output guardrail inspects the model's response before it reaches the user or a tool — catching leaked secrets, unsafe content, or a tool call that should never fire. The checks themselves range from cheap regexes and blocklists to dedicated classifier models trained to score safety. Placement is the architecture: input guardrail, then model, then output guardrail, each a gate that can allow, block, or rewrite.

if allowedif allowedUser / tool inputInput guardrailclassify & filterModelgenerates a responseOutput guardrailscan & blockResponse / tool callParaphrase /encoding slips pastthe filterInjection hiddeninside allowedcontentSecret leaks beforethe block lands
The two placements that matter — an input gate before the model, an output gate before anything acts on the result.

What they can do well

Guardrails are excellent at enforcing clear, checkable rules against non-adversarial or lightly adversarial input. Redacting recognisable secrets from an output. Blocking a known category of request. Catching an obviously malformed or dangerous tool call. Keeping casual misuse and honest mistakes out of the system. For these jobs a guardrail is a real control with a real, measurable effect — the equivalent of input validation and output encoding in a web app. Use them, and treat them as defence in depth.

They are also cheap insurance against the volume problem. Most of what hits a production model is not a crafted attack — it is ordinary users straying into unsafe territory, buggy upstream systems, or automated traffic that stumbles into a bad request. A guardrail that quietly deflects that noise keeps it from ever reaching the model or a tool, and does so at a fraction of the cost of the model call itself. That is genuine value, and it is exactly why the technique became popular. The trouble starts only when a control built to filter the ordinary is asked to withstand the deliberate.

The right mental model: A guardrail is a seatbelt, not a force field. It measurably reduces harm from ordinary events and buys you margin — but a determined adversary aiming at exactly the gap it doesn't cover will get through, and the guardrail was never going to stop them.

What they structurally cannot do

The hard limit is this: a guardrail that judges natural language is itself a model making a fallible call about adversarial text, and it inherits every weakness of the thing it protects. Attackers paraphrase, translate, encode in base64, split a payload across turns, or wrap the malicious instruction in content the guardrail was told to allow. Every published jailbreak is, in effect, a demonstration that a safety classifier can be talked around. A guardrail raises the cost of an attack; it does not make the attack impossible, and marketing that implies otherwise is selling theatre.

Two failure modes deserve naming. Bypass: the malicious input is rephrased until it scores as safe — the classifier's decision boundary is the attack surface. Leakage before block: with streaming or tool calls, the damage can be done before the output guardrail finishes judging — a secret already streamed, an API already hit. An output check that runs after the side effect is a smoke alarm behind the fire.

Test for it — in practice
  • Take one request your input guardrail blocks and rephrase it — a synonym, another language, a base64 wrapper. If a paraphrase gets through, the guardrail is scoring surface form, not intent.
  • Confirm your output guardrail runs before any irreversible effect. If the model can stream a secret or fire a tool call while the check is still deciding, the gate is in the wrong place.

Systematically probing where a guardrail bends — across phrasings, encodings and multi-turn attacks — and proving it holds under adversarial load is what our assessment and SecStudio red-team tooling are built to do.

Using guardrails without fooling yourself

  • Layer them, never rely on them alone. Guardrails are one control in depth — pair them with least privilege, scoped tools and human review for irreversible actions.
  • Put the real limit in the architecture. If an agent physically cannot send external mail, no jailbreak makes it send mail. Structural constraints beat classifier judgement every time.
  • Guard before the side effect. Output checks must complete before anything irreversible happens — gate the tool call and the stream, not just the final text.
  • Measure and expect bypass. Track how often paraphrasing defeats the filter, and design as if a fraction always will, because it will.

Guardrails earn their place — as one honest layer among several. The failure is not using them; it is believing them, letting “we added guardrails” stand in for an architecture that limits what the model can do when a guardrail is inevitably bypassed. The strongest control is never the classifier at the boundary; it is the blast radius you designed underneath it. And you cannot size that blast radius until you know every model, tool and data path a guardrail is supposed to be standing in front of.

Keep reading
Non-Determinism as a Security Property