Guardrails: how we keep an AI system from saying the wrong thing

Guardrails are the layers around a model that catch wrong, off-topic or harmful output before a customer sees it. What each layer does.

4 minread 788words last updated

The short answer

Any AI system will occasionally produce something wrong, off-topic or harmful: a price that does not exist, a refund it had no authority to promise, a paragraph of medical advice on a plumber’s website. Guardrails are the layers around the model that catch those cases before a customer sees them. They are not instructions inside the prompt, though the prompt is the first layer. They are checks on the input, grounding in your documents, validation of the output, limits on what the system may do, escalation to a person, and logging of everything that fired. Designed against the specific failures that matter to your business, they turn a clever demo into something people can rely on.

The layers

LayerWhat it doesExample
Input checksScreens what comes in: length, language, injection attempts, off-scope requestsA message that tries to override the instructions is flagged, not obeyed
GroundingRequires answers about facts to come from retrieved documentsPrices and policies are quoted from the source or not at all
Scope limitsDefines what the assistant may discuss and what it must declineLegal, medical and financial questions get a polite redirect
Output validationChecks the answer against rules before it is shownNo numbers that do not appear in the sources; no promises from a forbidden list; no personal data echoed
Action allow-listRestricts what the system can do, not just sayIt can draft a refund request; it cannot issue a refund
EscalationRoutes low confidence, high stakes or repeated failure to a personAn angry customer or an unusual request goes to a human
LoggingRecords inputs, outputs, sources and every guardrail that firedThe weekly review sees what was caught and what slipped

Designing against your own failures

  1. List the ways this system could embarrass or harm the business: wrong facts, unauthorised promises, data in the wrong place, forbidden topics, rude tone.
  2. For each, choose the layer that catches it: grounding, validation rules, scope checks, allow-lists.
  3. Decide the escalation rule: what confidence, what stakes, what topics always go to a person.
  4. Write the validation as code, not as prompt text: a check that numbers appear in the sources, a forbidden-phrase list, a personal-data detector.
  5. Test with adversarial cases: people trying to break it, not only people using it well.
  6. Log everything and review weekly; tighten the rules from what fired.

What it looks like in a live system

A customer asks about a return. The input check passes. Retrieval finds the return policy. The model drafts an answer grounded in it, citing the clause. Output validation confirms every date and amount appears in the policy text. The answer is shown. A second customer asks whether they can have a refund outside the policy. Grounding finds no basis; the scope rule identifies a commitment; the case is escalated to a person with the draft and the context. Both interactions are logged. Neither embarrasses anyone.

What this means for you

Expect any AI system to fail sometimes, and build so that the failures are caught before they reach anyone. Input checks, grounding, scope limits, output validation, action allow-lists, escalation and logging, each chosen against the specific failures that would hurt your business. The prompt is layer one. The rest is what makes the system safe to rely on, and it is what separates the assistants that stay in service from the ones quietly switched off after the first incident.

Written by the CivSec S.M.A.R.T team

We build and run websites, software and AI systems for businesses. We write about what we see in that work, in plain language, and we update articles when things change.

Last checked . Spotted something outdated? Tell us.

Frequently asked questions

Is a well-written system prompt not enough?

It is necessary and not sufficient. A prompt lowers the rate of bad output; it does not make it zero, and it cannot check its own work. Guardrails outside the model verify the output against rules and facts, restrict what the system may do, and route uncertain cases to a person. The prompt is the first layer, not the only one.

What are the most important failures to guard against for a small business?

Stating wrong facts such as prices, availability or policy; making commitments the business has not authorised; handling personal data outside the intended path; and being drawn off topic into legal, medical or financial advice. Each has a specific guardrail: grounding for facts, an allow-list for commitments, data rules for privacy, scope checks for topics.

Do guardrails make the assistant less useful?

They make it narrower and more trustworthy, which is what a business assistant should be. An assistant that answers only what it can ground and escalates the rest is more useful than one that answers everything and is wrong sometimes, because people can rely on it.

Sources

  1. OWASP GenAI LLM Top 10 (2026) (accessed 2026-09-14)