# Guardrails

> Guardrails are the checks and controls placed around an AI model, such as input filters, output validation, topic limits and action restrictions, that keep its behaviour within safe, permitted and useful bounds in a live system.

Also called: AI guardrails, safety guardrails, LLM guardrails, safety filters, AI safety controls. Category: Delivery and quality. Source: https://aibuildindex.com/glossary/guardrails

## In the index

- Customer support chatbot: median $2,000, middle half $300 to $5,300, 1,344 priced briefs (https://aibuildindex.com/cost/support-chatbot)
- Custom AI agent: median $3,850, middle half $600 to $10,000, 2,831 priced briefs (https://aibuildindex.com/cost/custom-ai-agent)

A model's training and its [system prompt](https://aibuildindex.com/glossary/system-prompt) set intended behaviour, but they are not enough on their own for a business system. Guardrails are the extra layer of software that checks what goes into the model and what comes out, and limits what the system can do. They stop an insurance chatbot giving medical advice, block a reply that contains another customer's details, reject output that does not match the expected format, and send uncertain cases to a person. Most production AI builds include them in some form.

## How it works

Guardrails sit at different points in the flow:

- **Input checks.** Detect off-topic requests, abusive content, attempted [jailbreaks](https://aibuildindex.com/glossary/jailbreak) or personal data that should not be sent to the model.
- **Output checks.** Screen responses for harmful content, banned topics, leaked personal data, unsupported claims or broken formatting before they reach the user.
- **Action limits.** Restrict which tools an AI can use, cap amounts or quantities, and require confirmation for sensitive steps.
- **Fallbacks.** When a check fails, return a safe default message, retry, or hand the case to a person through [human-in-the-loop](https://aibuildindex.com/glossary/human-in-the-loop) review.

Checks can be simple rules (keyword lists, pattern matches, numeric limits), specialised classifiers such as [content moderation](https://aibuildindex.com/glossary/content-moderation) models, or a second language model asked to judge the first one's output. Several open-source and commercial guardrail frameworks exist, and major cloud and model providers offer built-in safety filters.

A bank's support assistant, for example, might block any reply containing what looks like an account number, refuse investment advice, check that any fee it mentions matches the official fee table, and pass complaints to a human agent.

## What it means for cost

Guardrails add build effort and some running cost. Each check needs designing, testing on real examples and tuning, because checks that are too strict block legitimate requests and frustrate users, while loose ones miss problems. Model-based checks add a further call per request, which raises cost and [latency](https://aibuildindex.com/glossary/latency).

The level needed depends on audience and stakes: an internal drafting tool needs far less than a public assistant in a regulated industry. Ask a builder which guardrails the design includes, how often they blocked legitimate requests in testing, and how blocked or failed cases are logged and reviewed.

## Common questions

### Are guardrails the same as content moderation?

Content moderation is one kind of guardrail, focused on harmful or inappropriate material. Guardrails also cover topic limits, data leakage, format checks, factual checks and restrictions on actions.

### Do guardrails stop hallucinations?

They can catch some, for example by checking figures against a database or requiring citations, but they cannot catch every invented detail. [Grounding](https://aibuildindex.com/glossary/grounding) and testing remain the main defences.

### Can guardrails make an AI assistant less useful?

Yes, if they are too strict. Over-blocking is a common complaint. Good builds measure false blocks during testing and adjust rules so legitimate users are rarely affected.

## Related terms

- [Content moderation](https://aibuildindex.com/glossary/content-moderation): Content moderation is the process of detecting and handling harmful, abusive, illegal or off-policy material in text, images, audio or video, increasingly done by AI classifiers with human reviewers for difficult cases.
- [Prompt injection](https://aibuildindex.com/glossary/prompt-injection): Prompt injection is a security attack in which hostile instructions are hidden in content an AI system processes, such as an email, web page or document, causing the model to follow the attacker's instructions instead of its own.
- [Jailbreak](https://aibuildindex.com/glossary/jailbreak): A jailbreak is an attempt by a user to trick an AI model into ignoring its safety rules or instructions, for example through role-play, hypothetical framing or carefully crafted wording, so that it produces content or actions it should refuse.
- [Hallucination](https://aibuildindex.com/glossary/hallucination): A hallucination is output from an AI model that sounds plausible but is false, unsupported or invented, such as a made-up fact, citation, figure or policy presented with the same confidence as a correct answer.
- [Human in the loop](https://aibuildindex.com/glossary/human-in-the-loop): Human in the loop is a design approach in which an automated or AI system pauses for a person to review, correct or approve its work at defined points, so that judgement and accountability stay with people where mistakes would be costly.
- [Evals (AI evaluation)](https://aibuildindex.com/glossary/evals): Evals are structured tests that measure how well an AI system performs on a fixed set of realistic inputs, scoring its outputs so that changes to prompts, models or data can be judged by evidence rather than impression.
