Agent guardrails: reviewing the message and the response
How XBASE checks the contact's message and reviews the AI agent's response before it goes out, and what to do when the response is rejected.
Updated on
Guardrails check your AI agent's conversation at two moments: the contact's message, before the agent reads it, and the agent's response, before it goes out. When the response is not good (it makes up information, doesn't answer what was asked, strays from the objectives), it is blocked and the agent replies again, already knowing what to fix. They apply to the agent on every channel: WhatsApp, Instagram, email, webchat and Test Agent.
Where to find it
Open the agent and click the Guardrails tab. The screen has two parts:
- Input Guardrails: run before the agent, on every contact message. At the top is the Pre-decision (Dcision), which decides whether the message goes to the agent, to the team or gets a ready-made reply.
- Output Guardrails: review the agent's response before it goes out to the contact.
Turn on what you want, choose each one's Action and click Save.
What the response review checks
| Guardrail | Rejects when |
|---|---|
| Not grounded in instructions (hallucination) | the response states something (price, hours, deadline, rule) that is not in the instructions, in the sources the agent consulted or in the conversation |
| Did not answer (fallback) | the agent did not answer what the contact asked, repeated a question already answered or asked for information already given |
| Off objective | the response does not move forward any of the agent's objectives |
| Contradicts a rule in the instructions | the response promises or does something the instructions forbid |
| Email not allowed, Phone not allowed, Sensitive number | the response includes data that is not in the instructions or in Can share |
| Offensive language | the response has an offensive or disrespectful tone |
| Long response | the response exceeds the maximum number of characters |
Not every email or phone number is sensitive: the ones in the agent's instructions (the company contact, for example) and the ones you write in Can share are allowed.
Add the agent's objectives in the Panel: without them, Off objective has nothing to evaluate against.
Reject and retry or Record only
Each output guardrail has an Action:
- Record only: the response goes out normally and the review is recorded for you to follow. Start here to see how the agent performs.
- Reject and retry: the rejected response does not go out. The agent replies again to the same message, receiving what was wrong and guidance on how to fix it. The blocked response is removed from the agent's history.
If the second response is also rejected:
- for a serious reason (not grounded in instructions, contradicts a rule, data not allowed or offensive language): the contact receives the Holding message (for example, "I'll confirm this information with the team and get back to you shortly.") and the conversation gets the Atendimento Humano (human support) tag;
- for a minor reason (did not answer, off objective or long response): the second response goes out with the Caso não previsto (unexpected case) tag.
If the review cannot run (instability), the response goes out normally and the error is recorded.
Send the agent's instructions to the review
In Output Guardrails, the Send the agent's instructions to the review option comes on: the review reads the agent's instructions (and the route's, when the agent uses routes) to compare them with the response.
Turn it off when the checks you use do not depend on the instructions, like Offensive language, Email not allowed and Phone not allowed. The review becomes smaller and faster. In that case, write the official contacts in Can share.
With the option off, Not grounded in instructions and Contradicts a rule in the instructions have no reference and tend to reject correct responses. The screen warns you when this happens.
Input Guardrails
| Guardrail | What it does |
|---|---|
| Offensive language | detects swearing and insults in the contact's message |
| Personal data | detects tax IDs, card numbers, passwords and other sensitive data sent by the contact |
| Attempt to change instructions | detects requests for the agent to ignore or reveal its instructions |
| Input length limit | cuts or blocks messages that are too long |
| Remove HTML | removes HTML tags from the message before the agent reads it |
For the first three you choose the Action: Record only, Warn the agent (the agent gets a notice, for example not to repeat the personal data), Block (nothing is replied) or Hand off to the team (the contact receives the Holding message and the conversation goes to the team).
Where to see the reviewed responses
- In the Guardrails tab: the Last 7 days card shows how many responses were reviewed, rejected, retried and handed off to the team, and the rejections by reason.
- In Learnings → Reviewed responses: the list of reviews, with the blocked response, what rejected it and the guidance. Each one leads to the conversation.
- In Chatcenter: when a response is blocked, the conversation shows the Reviewed response notice (only the team sees it). Click it to see the details.
Webchat and Test Agent
With any guardrail on, the response must be checked before it appears. That is why, in the webchat and in Test Agent, it arrives all at once, instead of appearing bit by bit. Use Test Agent to see the guardrails in action before turning on Reject and retry on the channels.
External agent
With an External agent, XBASE does not generate the response, so the agent itself requests the review. In the Guardrails tab, the Output part shows the Integration with your agent card, with the API key, the review address, examples and the instructions to paste into your agent. The Pre-decision (Dcision) still applies on input.
Usage
When the agent replies again after a rejection, that new response uses credits like any other and shows up in Usage & consumption.
Frequently asked questions
See also
Conversation evaluation
How XBASE scores the AI agent's conversations against its objectives: how to turn it on, when it runs, where to see the scores and how much it uses.
Create an agent
Step by step to create a Native AI agent in XBASE from your company's website and Instagram and put it to work on your website chat.