
Guardrails: checks that keep AI output in bounds
In short: AI guardrails are checks on inputs, outputs and actions that block or fix off-policy behaviour, and the dependable ones are plain code outside the model.
Guardrails are checks placed around a language model or AI agent that inspect inputs, outputs or proposed actions and block, rewrite or escalate anything outside policy. They include schema validation, content filters, PII detection, allow-lists for tools and spending limits. The OWASP Top 10 for LLM Applications 2025 puts prompt injection first among the risks these checks are meant to reduce.
Guardrails in plain words
Bumpers in a bowling lane. They do not make you a better bowler, but they stop the worst throws from going somewhere expensive.
How it works
Checks sit at three points:
- Input: detect prompt injection attempts, secrets or disallowed requests before the model sees them.
- Output: validate format, scan for sensitive data, check claims against sources.
- Action: before a tool runs, check it against allow-lists, budgets and permissions.
Checks can be code (regex, schemas), classifiers or a second model acting as a judge. OWASP's prompt injection entry lists input and output filtering, least-privilege access and human approval for high-risk actions among its mitigations. It also says it is unclear whether any fool-proof prevention exists, so guardrails reduce risk and do not make an unsafe design safe.
Example
As an illustration, a support agent may only call issue_refund for amounts under a limit, only for the authenticated customer's orders, and only once per order. Those three rules are plain code, and they hold even if the model is tricked.
Where you'll meet it
- Libraries and services such as NeMo Guardrails, Guardrails AI and cloud provider safety filters
- Model providers' built-in moderation
- Agent harness permission systems
- Compliance requirements in regulated industries
What it changes for you
The strongest guardrails are deterministic and live outside the model: scoped credentials, argument validation, rate limits. For developers, that means normal engineering beats clever prompts. For security teams, guardrails need tests and monitoring like any other control.
Guardrails vs alignment
Alignment is training the model itself to behave well. Guardrails are external checks that assume it sometimes will not.
Common mistake
My view: relying on a model-based filter to stop prompt injection. Another model can be fooled the same way. Put the hard limits in code and permissions, and use model-based checks as an extra layer.
Related terms
Prompt injection · Human-in-the-loop · Agent sandbox · LLM-as-a-judge · Lethal trifecta
From the archive: Guardrail benchmarks are graded before the attacker moves
Put the hard limits in code and permissions, and treat model-based filters as an extra layer.


