Glossary
AI guardrails
Controls around a language model or AI agent that check its inputs, outputs and actions against rules, and block, rewrite or escalate anything that breaks them.
AI guardrails are controls placed around a large language model or AI agent that check its inputs, outputs and actions against a set of rules, and block, rewrite or escalate anything that breaks them. They run in code outside the model, so they hold even when the model has been confused or manipulated, which is what separates them from instructions written into a prompt.
Types of guardrails
Guardrails are usually grouped by where they sit in the request. A production system tends to use several layers at once, each catching a different kind of failure.
Type | What it checks | Examples |
|---|---|---|
Input | What reaches the model | Prompt injection detection, personal data redaction, off-topic filters |
Output | What the model returns | Toxicity filters, schema validation, checks that claims are supported by sources |
Action | What an agent is about to do | Tool allowlists, spend limits, approval for irreversible actions |
Data | What the agent can read and write | Per-tenant isolation, scoped credentials, file scanning |
Input guardrails defend against prompt injection and jailbreaks, including indirect prompt injection hidden in documents or web pages the agent reads. Output guardrails catch hallucinations, unsafe text and malformed responses; structured output with a JSON schema is a simple and reliable output guardrail for anything a program will parse. Action guardrails matter most for agents, because a bad answer can be ignored but a bad tool call changes something.
How guardrails are built
The simplest guardrails are rules: regular expressions for card numbers, blocklists of terms, hard limits on refund amounts. Classifiers trained for a narrow job, such as spotting injection attempts or toxic language, catch what rules miss at a small cost in latency. LLM-as-a-judge checks use a second model to assess the first, which handles subtle cases but adds a full model call. Constrained decoding prevents some failures outright by only letting the model produce valid output.
Every check trades safety against speed and false positives. A filter that blocks too much frustrates users and gets switched off, so teams tune thresholds on real traffic and run expensive checks only where the risk justifies them. Several agent frameworks include guardrail hooks, and the comparison of LangGraph and the OpenAI Agents SDK compares two of the most widely used.
Guardrails and other agent controls
Instructions in a system prompt shape behaviour but can be overridden by a determined input, so they work best as a first layer with enforced checks behind them. Guardrails sit alongside a few related controls. Agent permissions and least privilege decide what the agent can reach at all. Human-in-the-loop review covers the few actions too costly to automate. Agent observability shows what got through, and agent rollback repairs what went wrong. No single layer is enough on its own, and attacks such as tool poisoning and memory poisoning target the gaps between them.
Guardrails and Exabase
Exabase is not a guardrails product: content filters, injection classifiers and approval logic belong in your application. It provides several of the data and action controls that guardrails depend on. Each Base is an isolated environment, so a call scoped to one tenant cannot reach another tenant’s files, memories or search index whatever the query says, which removes a whole class of cross-tenant data leakage; the multi-tenant solution explains the model. Exabase Workers can be restricted to specific tools and specific resources through their configuration, as the worker tools guide describes.
Uploaded images and video are scanned for malware, with an infected flag in their metadata. For output checks, Deep Search returns the exact passage behind an answer with a page number or timestamp, which makes it practical to test whether a response is grounded in its sources. And when something gets past every layer, filesystem snapshotting lets you see and recover what an agent changed inside a Base. 5 ways tenant data leaks in RAG apps covers the data side in more depth, and the customer support agents use case shows these controls in a live product.
FAQs
What are AI guardrails?
AI guardrails are checks that run around a model or agent to stop unsafe inputs, outputs and actions. They are enforced in code, so they apply whatever the model decides.
What is the difference between input and output guardrails?
Input guardrails inspect what is sent to the model, such as user messages and retrieved documents. Output guardrails inspect what the model returns before it reaches a user or another system.
Can a system prompt act as a guardrail?
Only weakly. A system prompt asks the model to follow rules, and a crafted input can talk it out of them. Treat prompt instructions as a first layer and enforce important rules in code.
Do guardrails stop prompt injection?
They reduce it. Detection catches many attempts, but new phrasings get through, especially indirect injections inside documents. Limiting what the agent can do with least privilege contains the damage when one succeeds.
Do guardrails slow down responses?
Yes, by an amount that depends on the check. Rules are near instant, classifiers add a short delay, and an LLM-based check adds a full model call. Teams often run cheap checks on everything and expensive ones only on risky actions.
What guardrails do AI agents need?
Agents need action guardrails on top of input and output checks: a list of allowed tools, limits on what each tool can change, approval for irreversible steps, and a way to recover from mistakes.
Does Exabase provide guardrails?
Exabase provides data and action controls rather than content filters: isolated Bases per tenant, Worker tool and resource restrictions, malware scanning on uploads and filesystem snapshotting for recovery.
Related pages: Human-in-the-loop, Agent permissions, Least privilege, Prompt injection, Tool poisoning, Agent observability, Agent rollback, Multi-tenant solution, Agent undo solution, The security questions your AI product will be asked, Self-correction.