Building with AI

What are AI guardrails?

In short

AI guardrails are the rules and automatic checks placed around an AI model to keep it safe, on topic and within the law. They filter what goes into the model and check what comes out before anyone sees it or any action is taken.

A system prompt asks the model to behave. Guardrails make sure it does, with separate checks: blocking personal data, refusing off-topic requests, checking that an answer cites a real source or that an action stays within limits.

Mini course

3 short lessons, about 2 minutes in total

  1. Fences around the model
  2. Common guardrails
  3. Getting the balance right

Lesson 1

Fences around the model

A language model will try to answer whatever it gets. Guardrails decide what it should get and what may leave. They sit before the model, checking input, and after it, checking output. Some are simple rules, such as 'never show a personal identity number'. Others use a small AI model to judge whether a text is off topic or harmful.

Input check
Output check
Safe answer
Checks before and after the model stop unsafe input from getting in and wrong or risky answers from getting out

Tap a box to open that concept

The point is that safety does not rest on the model alone.

Lesson 2

Common guardrails

On the way in: block or mask personal data, detect attempts to override instructions, refuse topics the tool should not cover. On the way out: check that facts come from approved sources, remove links to unknown sites, check tone, and stop answers that make promises the company cannot keep.

For AI agents, the most important guardrails limit actions: which systems they may touch, how much they may spend, and when a human must approve.

Lesson 3

Getting the balance right

Write down what must never happen, then add a guardrail for each item. Test with real and deliberately tricky questions. Log every block and review the log: too many false blocks annoy users, and misses show gaps.

  1. Customers find youHow customers and AI tools find the companySEOGEOGoogle AI Overviews
  2. AI in daily workTools staff and customers useChatbotAI copilotVoice AI
  3. Building blocksHow AI connects to data and systemsRAG (retrieval-augmented generation)AI agentMCP (Model Context Protocol)
  4. AI modelsThe models that understand and createLarge language model (LLM)Generative AIMachine learning
  5. DataCompany data, gathered and cleanedData warehouseETLData quality
  6. InfrastructureCloud, networks and systems underneathCloud computingDatabaseAPI key
Trust and rulesSecurity, law and control in every layerAI guardrailsGDPR and AIEU AI Act
Where AI guardrails sits in a company's AI setup

Guardrails, evals and human review work best together. Each catches what the others miss.

An everyday example

A bank's chatbot has a guardrail that stops any answer containing an account number and another that sends questions about loans to a human adviser.

How companies use it

Companies use guardrails to protect customer data, prevent embarrassing or harmful answers, stop AI agents from taking risky actions and meet rules such as GDPR and the EU AI Act.

Frequently asked questions

Isn't the system prompt enough?

A system prompt alone is not enough to keep AI safe. Prompts guide the model, but clever inputs can get around them. Guardrails are separate checks that do not depend on the model obeying.

Do guardrails slow the system?

Slightly. Simple rule checks take milliseconds. AI-based checks add a short extra step.

Can guardrails be too strict?

AI guardrails can be too strict: too many blocks frustrate users. Test with real questions and tune the balance.

In depth: AI guardrails

The full picture, about 4 minutes of reading

Fences, not just instructions

When a company puts an AI model to work, it usually starts by telling the model how to behave in a system prompt, the standing instruction the model reads before every conversation. "Only answer questions about our products. Never share customer data. Be polite." That is a good start, but it is only a request. Language models follow instructions most of the time, not all of the time, and a clever or unusual input can lead them off course.

Guardrails are the separate checks built around the model to catch what the instructions miss. A useful picture is a road with crash barriers. The driver, like the model, is expected to stay on the road. The barriers are there for the times when that does not happen. They work whether or not the driver is paying attention.

Checks on the way in and on the way out

Input guardrails look at what is sent to the model before it arrives. They can detect and mask personal data such as personal identity numbers, card numbers and email addresses. They can block requests that are clearly off topic or harmful. And they can spot known attempts to trick the model into ignoring its rules, such as messages that say "ignore your previous instructions".

Output guardrails look at what the model produces before anyone sees it or any action is taken. They can stop answers that contain confidential data, check that a reply only uses information from approved sources, block offensive language, check that the answer is in the right format, or flag answers about sensitive topics, such as medical or legal advice, for a person to review.

For AI agents, which are systems that take actions on their own, there is a third kind: action guardrails. These limit what the agent may do, such as a maximum amount it may refund, a list of systems it may write to, or a rule that any email to a customer must be approved by a person first.

How they are built

Guardrails come in two broad types. Rule-based checks use fixed patterns, lists and limits. A check that finds anything shaped like a card number, or blocks any refund above a set amount, is fast, cheap and predictable. It cannot be talked out of its rule. Its weakness is that it only catches what someone thought of in advance.

AI-based checks use a second, usually smaller model to judge the first model's input or output. They can catch things that are hard to describe with rules, such as a reply that is technically polite but dismissive, or a question about something the company does not offer. They are more flexible, but they cost a little more, add a short delay and can themselves make mistakes.

Most solid setups mix both. Rules handle the clear, high-stakes cases. AI checks handle the fuzzy ones. Many AI platforms and gateways offer ready-made guardrails that can be switched on and tuned, so a company rarely has to build them from scratch.

Too strict, too loose

Guardrails can fail in both directions. If they are too loose, harmful or embarrassing answers slip through. If they are too strict, the AI refuses ordinary questions, blocks harmless words or hands everything to a person, and users give up. A customer asking how to cancel an order should not be blocked because the word "cancel" sits on a list of sensitive terms.

The way to find the right balance is to test with real questions. Collect a set of typical customer and staff questions, add some awkward and hostile ones, and check how many good questions are wrongly blocked and how many bad ones get through. Then adjust. Logs from real use show where the guardrails trip most often, which tells you what to tune next.

Part of a layered defense

No single guardrail is enough, and guardrails alone are not enough either. The strongest protection comes from layers that each catch some of what the others miss. A clear system prompt sets the intended behavior. Input and output guardrails catch deviations. Limited access means the AI can only see data and use tools it actually needs, so a mistake has a small reach. Logs make it possible to see what happened and improve. And a person in the loop for high-impact actions means the final step is a human decision.

Guardrails are also a way to meet legal duties. GDPR, the EU data protection regulation, requires that personal data be protected, and the EU AI Act asks for human oversight and risk control in many uses. Guardrails that block data leaks and route sensitive cases to people are practical evidence that the company takes those duties seriously.

What it means for a small business

A small business using AI through standard tools already benefits from the guardrails the provider has built in, such as filters against harmful content. The question is what extra checks the company's own use needs.

For an internal writing assistant, a clear policy on which data may be pasted in, and business versions of tools that do not train on your data, may be enough. For a chatbot that talks to customers, a few concrete guardrails make a big difference: it should only answer from approved content, never show other customers' data, hand over to a person on complaints, prices or legal questions, and never promise refunds or deliveries on its own. Write those rules down, test them with real questions before launch and read a sample of conversations each month to see whether they hold.

Curious what this could mean for your company? Book a call.

Book a call