Agent response guardrails
Check each reply against your own rules on calls and in chat, block the ones the caller doesn't need, and have the agent answer again when a reply breaks a rule.
Agent response guardrails check every reply the agent writes against your own rules, on calls and in chat. A classifier answers a few yes or no questions about the reply, and the answers decide what happens to it. They're the Agent response guardrails card on the agent's Guardrails page. There are two kinds of question.
- Block unless. The reply is blocked unless one of these is yes. The agent stops talking and says nothing more for it. Use them when the agent should stay quiet while a caller reports a job in pieces, and still answer a question, warn about a hazard and close the job.
- Regenerate when. A yes means the reply broke a rule, such as "Does the reply quote a price?". The agent cuts the reply off, says a short filler line such as "Hmm." on a call, and answers again with the broken rule in front of it. If that answer breaks a rule too, the caller hears the fallback line instead. The card calls these Answer again when.
Leave Block unless empty and every reply that breaks no rule goes out. The card keeps it under Stay quiet unless. They apply to calls, chat and text tests.
In chat a reply is checked before it's sent, so nothing has to be cut off. A blocked reply is never shown, a broken rule shows only the second answer with no filler line, and a second break shows the fallback line.
Each Block unless question checks one of two things, set by its Checks field. The card shows them as Reads the reply and Reads the caller's words.
- Agent response, the default. The reply starts playing straight away and its check runs beside it. The check takes about a quarter of a second once the model finishes writing, so the caller can hear the start of a reply before a block stops it.
- User turn. The question reads the caller's words and never the reply. It's asked the moment the model starts writing, and the reply's first words wait for the answer. That answer is usually back before the model has written a word, so the caller waits no longer. A yes lets the reply out.
Regenerate when questions always check the reply. In chat and in a text test a blocked reply is never shown.
How a reply is judged
The classifier reads the job context, what the agent last said out loud, everything the caller has said since, and the reply.
A blocked reply ends the caller's turn. Their next line is judged on its own, against what the agent last said out loud. So when someone in the room says something the agent shouldn't answer, it isn't read again with what the caller says next. After a regenerated reply the caller's words stay in the turn, and the agent's second answer is judged against all of them.
A technician changing a tyre, for example:
| Caller | The agent writes | What happens |
|---|---|---|
| "Chocks in, nuts cracked." | "Received." | Blocked |
| "Wheel's off, spare going on." | "Received." | Blocked |
| "Jacked it, going under to check the diff." | "Received." | Cut off, then "Hmm." and "Stop. Never get under a car on the jack." |
| "Done." | "Logged, record four eight one." | Plays in full |
The third reply broke a rule asking whether the caller said something unsafe that the reply doesn't stop. The agent then answered with the stop.
Checking the caller's turn
When every User turn answer is no, the reply is blocked unless an Agent response question in Block unless says yes.
- With no Agent response questions in Block unless, the reply is dropped as the model writes it. Not a word plays, and no Regenerate when question is asked about it.
- With Agent response questions, the reply plays as it's written and is checked when the model finishes, like any other reply. It's cut off unless one of them says yes, so a short reply can be over before that check comes back.
Block unless never makes the agent answer again. Only a broken Regenerate when question does that, and it only checks replies that play. A reply written again after one is checked against Regenerate when only, so the turn that called for a new answer can't block it.
Ask about the caller's turn when their words answer the question on their own, such as whether they asked for something, said they're done, are a new starter or described something unsafe. A short acknowledgement such as "Roger." is over before an Agent response check comes back, so to keep those off the air, ask every Block unless question on the caller's turn.
Writing the questions
Ask about the reply as well as the caller. The model has already read the whole call and its procedure when it writes a reply, so a question such as "Is the agent's reply dealing with something unsafe the caller just said?" catches hazards a question about the caller's words alone misses.
Each list takes up to eight questions. Keep each question to one idea, and give it yes and no wording under Yes when and No when. Each answer at or above its threshold counts as yes. A false yes on a Regenerate when question makes the caller hear the filler line, so give those a high bar, such as 0.5. A Block unless question can sit lower, such as 0.3, when missing it means a warning never reaches the caller.
Question ids are unique across both lists. Every question reads the job context unless you switch Reads the job context off for it, which checks it in a second call beside the others.
Job context
The classifier gets the job two ways.
- Job context text. Text you write once. Variables like
{{site}}are filled in from the agent's plain variables when the call starts. - Context tools. The latest result of a tool in the call, narrowed to a
field, such as a
start_jobtool with the fieldprocedure.
With context tools set, replies go out unchecked until one of them returns, so the greeting and the caller's name and job get normal replies. A reply is judged against the job as it stood when the caller spoke, so the reply that opens the job goes out too.
Name the tools that end a job under Tools that end a job. Once one of them returns, replies go out unchecked again until the next job opens.
The agent's instructions
The guardrails decide which replies play out. The instructions decide what the agent writes. Tell the agent what a reply with nothing for the caller looks like, such as a bare "Received.", and show it in an example. A short reply is easy for the questions to tell apart from one the caller needs, and little of it plays before a block stops it.
Limits and failures
| Setting | Default | What it does |
|---|---|---|
| Filler line | "Hmm." | Said once in a caller's turn on a call when a reply breaks a guardrail, while the agent answers again. Chat shows nothing |
| Fallback line | "Sorry, I can't help with that. Is there something else I can do for you?" | Said instead when the agent's second answer in the turn breaks a guardrail too |
| Check timeout | 1 second | How long one check may take, from 0.2 to 5 seconds |
| When a check fails | Let the reply out | Or Block the reply |
When the caller speaks over a reply, the check for it is dropped. A reply that runs a tool still runs it when the reply is blocked or regenerated, and the agent answers again once the tool returns.
Set them up
Switch on Check replies against your rules in the Agent response
guardrails card on the agent's Guardrails page and add a rule under Answer
again when. Try a
conversation in the card runs a transcript through them. Through the MCP or
the Builder, set them with set_agent_response_guardrails and try them with
test_agent_response_guardrails. All of these act on the draft. Publish to use
them on new calls and chats. While they're on, an agent set to speech to speech
runs on separate listening, reply and voice models.
The test takes a transcript with one line each time someone speaks. A line
starting Agent: is a reply the agent wrote, and every other line is the
caller. Each agent line after the caller's first line is one check. As on a
call, a reply that goes out or is blocked starts a fresh caller turn for the
next caller line, and a regenerated reply leaves the caller's words in it. If
you use context tools, paste a sample result for each one, or every reply reads
as unchecked. Nothing runs but the classifier: no model, no tools and no audio.
On the call record
Each decision shows on the call timeline as an Agent response check, with what the caller got, why, each answer's probability and how long the check took. The reply itself isn't stored with it. The filler and fallback lines show on the transcript, marked as an agent response check.
A call from a web page also gets each decision as a response_check server
message, with the action, the reason, each answer's probability, the broken
questions and the context the check read. stage says whether the caller's
turn or the reply decided it, turnMs is how long the caller's turn took to
check, and heldMs is how long the first words of a reply that played waited
for it.