Learn · Guardrails
AI guardrails, explained
IntSen team · Updated 12 November 2026 · 7 min read
Short answer
AI guardrails are automated checks applied to what goes into and comes out of an AI model: prompts, responses and the tool results agents read. They look for problems such as prompt injection, personal data, secrets and harmful content, and then record the finding, mask the sensitive part, or block the call.
What guardrails check
Most guardrail sets cover four families of risk:
- Prompt injection and jailbreaks: text that tries to override the model's instructions, including instructions hidden in web pages, files or tool results the agent reads.
- Personal data: names, emails, phone numbers, account and card numbers or national IDs going to a model or coming back in a response.
- Secrets: API keys, tokens and passwords pasted into prompts or leaked in responses.
- Harmful content: violence, self-harm, harassment and similar categories, usually checked with a moderation model.
Teams also add their own rules, such as 'never quote internal price lists' or 'don't give legal advice', written as patterns or in plain language and checked by a model.
Where the checks run
Guardrails can run inside each application, in a shared library, or at a gateway in front of the model provider. Checks inside each application are flexible but drift apart team by team. A gateway applies the same checks to every governed call and records every verdict in one place, which is what risk and security teams usually need.
For agents, the important addition is checking at three points: the input before the model sees it, the output before the application uses it, and the tool results the agent feeds back to the model, because injected instructions often arrive through tools.
Record, mask or block
When a check finds something, a guardrail takes one of three actions:
| Action | What happens | Good for |
|---|---|---|
| Record | The call proceeds; the finding is logged with a verdict | Measuring a new check on real traffic before enforcing it |
| Mask | The sensitive part is replaced before the call proceeds | Personal data the model doesn't need to do its job |
| Block | The call is refused with an explanation | Injection attempts, secrets, clearly prohibited content |
A sensible rollout starts every new check in record mode, reviews the verdicts for false positives, then moves the checks you trust to mask or block.
Checks across a whole agent turn
Some risks only show up across several calls. An agent may collect a little personal data in each step, or a user may try several jailbreak variations in a row. Task-level checks look at the turn or the session as a whole and can act when a threshold is crossed, which single-call checks miss.
What happens when a guardrail fails
Guardrails are services, and services fail or time out. Every deployment needs a decision on what happens then: let the call continue and record the failure (fail open), or refuse the call (fail closed). The trade-off between availability and protection is covered in our explainer on fail-open versus fail-closed guardrails.
What guardrails cannot do
No detector catches everything, and attackers adapt. Guardrails reduce risk; they don't remove it. Pair them with least-privilege tool access for agents, human review where decisions matter, and evaluations that test your agent against known attacks before each release.
How IntSen does it
Guardrails in IntSen
IntSen applies guardrails at its AI Gateway to every governed call. The base checks cover prompt injection (including in tool results), personal data, secrets and harmful content, plus custom rules written in plain English. Task-level checks look for patterns across a turn, such as personal data accumulating or repeated jailbreak attempts.
Each check can record, mask (personal data) or block, so you can measure before you enforce. Platform teams set defaults, and individual teams can only make them stricter. Every decision is kept as a verdict, and check results store the category found, never the content checked.
Common questions
What is the difference between guardrails and evaluations?
Guardrails act on each call as it happens: they record, mask or block. Evaluations score quality, such as whether an agent completed the user's goal, usually on a sample of turns or on test suites before release. Most teams need both.
Should guardrails run on tool results?
Yes, for agents. Instructions injected into a web page, email or document reach the model through tool results, so checking only the user's prompt misses a common attack path.
Do guardrails slow down AI responses?
Each check takes time, and model-based checks take more than pattern matches. Run the checks you need, measure them on your own traffic, and use record mode first to see their effect before enforcing them.
Can we write our own guardrail rules?
Most guardrail systems allow custom rules, either as patterns or as plain-language instructions checked by a model. Start them in record mode, because custom rules are where false positives are most common.