Guardrails encompass all mechanisms that determine what an AI chatbot is allowed to say and what it is not. The most effective guardrails are those that operate outside the language model: binding to approved sources, checking every response prior to output, predefined dialogues for legally binding or sensitive workflows, and human handoff. Rules in the prompt help at the start of a conversation, but lose their effectiveness with every message. This article categorizes six types of guardrails based on where they are positioned and what they reliably prevent.
Comparison of Six Guardrails
Guardrail | Where it sits | What it prevents | Where its limits lie |
|---|---|---|---|
Rules in the prompt | in the language model's context | unwanted topics and tone, at the beginning of the conversation | fades over long conversations; longer lists exacerbate this |
Input filters | upstream of the language model | injected instructions, obvious abuse | only detect what they already know |
Source grounding | in search / retrieval | unsupported answers, unauthorized content | only as good as the approved sources |
Output verification | downstream of generation | statements not backed by the source | requires a source to verify against |
Predefined dialogues | in place of generation | errors in binding processes such as cancellations or complaints | must be maintained editorially |
Handoff | at the end of the chain | responses requiring a decision or missing information | requires a team to take over |
Why Prompt Rules Are Not Enough
The most intuitive guardrail is an instruction to the model: no pricing information, no health-related advice, no legal counsel. This works reliably across the first few messages. However, the longer a conversation becomes, the less weight the instructions at the beginning of the context carry. How this effect can be measured is demonstrated in Chroma's study on Context Rot.
Prompt rules still have their place, such as for tone of voice and response length. But for boundaries that must always hold, they are the weakest guardrail.
What Input Filters Deliver
Input filters evaluate a query before it reaches the language model. They recognize typical patterns of injected instructions, such as "Ignore all previous rules," as well as obvious abuse. Tools like the open-source library Guardrails AI apply at this stage and during output, using programmable rules and validations.
Their limitation: they only recognize what they know. An instruction hidden within a document that the chatbot references as a source reaches the model via a different route. Therefore, additional protection is required on the source side. The article Connecting Generative AI with Enterprise Knowledge describes this and four other integration risks.
Guardrails Operating Outside the Model
Source grounding. The chatbot searches exclusively within content approved by the organization, and only within what the user is authorized to see. What is not in the source cannot serve as a basis for an answer.
Output verification. After generation, a dedicated step verifies whether the response is substantiated by the source. This step executes for every response, regardless of how long the conversation has been ongoing.
Predefined dialogues. For workflows that must be binding and error-free, the language model does not generate text freely at all. An editorial dialogue requests the required details, validates them, and returns predefined responses.
Handoff. If knowledge is missing, a decision is required, or the customer requests a human agent, the chatbot hands over along with the conversation history. Which topics should be handled by humans from the outset is outlined in the article What a Chatbot Should Not Answer.

How Mercury.ai Configures Guardrails
In Mercury Intelligence, it is not the language model that decides which facts apply. A model orchestrator identifies the intent and selects the path: a knowledge-based answer from approved sources, a product selection with follow-up questions, or an editorial dialogue. Knowledge content can be filtered by access permissions. Responses are verified against sources prior to output, significantly reducing hallucinations. Dedicated protective mechanisms defend against prompt injection, data leakage, and manipulation of the knowledge base, and generative responses can be disabled entirely for topics with mission-critical facts. If the chatbot cannot proceed, it transfers the conversation to the team in the Agent Desk.
Modifications are made in separate environments for draft, testing, and production, supported by automated tests for core workflows. This ensures a new guardrail is validated before going live. Learn more about the architecture on the Mercury Intelligence page.
Three Questions for Every Guardrail
Where does it sit? In the model's context, upstream, downstream, or in its place?
Does it hold up in the two-hundredth message just as it did in the first?
Can it be tested before going live, and are violations visible in production?
A guardrail that answers all three questions satisfactorily controls a response. The rest merely assist.
Looking to evaluate your chatbot's guardrails? Get in touch with us.
About the Author
Dr. Maximilian Panzner
Chief Technology Officer @Mercury.ai
Dr. Maximilian Panzner is CTO and co-founder of Mercury.ai. He earned his doctorate in computer science at the CITEC institute of Bielefeld University, where he conducted research on multimodal machine learning and intelligent interaction systems. For over 20 years, he has been working on artificial intelligence, human-machine interaction, and conversational AI platforms for enterprise use.






