The six guardrails
Judge means a small, fast model reads the content and decides. The five
judge-backed guardrails cost one short model call per turn each (two for a
kind that runs on both sides).
unicode is a pure text transform and costs
nothing.
Warn or block
mode says what happens when a guardrail fires:
warn(the default) records the violation and lets the turn continue. Use it first: it tells you how often a guardrail would fire on real traffic, and the threshold you want, before anyone is refused.blockends the turn. The user sees a clear sentence naming the guardrail — “This message was blocked by the agent’s content moderation guardrail.” — followed by the judge’s own reason. No answer is produced, no follow-up suggestions are offered, and the violation is recorded the same way.
block is also fail-closed: if the judge model itself cannot answer
(an outage, an invalid response), the turn stops rather than letting
unchecked content through. In warn mode a judge failure lets the message
through and logs the failure.
In between: redact, rewrite, translate
Some guardrails can do something more useful than warning or refusing. Setoptions.strategy and the guardrail takes that action instead:
With a strategy set,
mode no longer picks the action — it only decides what
a judge failure does (block = stop the turn, warn = let it through) and
how the violation is recorded.
Turning guardrails on
Guardrails live on the agent version, like tools and memory: edit the draft, publish, activate.enabled: false keeps an entry but switches it off;
"guardrails": null removes them all. A bad entry — an unknown kind, an
option that belongs to another kind, a threshold outside 0–1 — is rejected
with a 400 so a typo never saves as a guardrail that silently does nothing.
In the Studio, guardrails are a section of the agent editor: a switch per
kind, a warn/block toggle, and the options below.
Options
Every option is optional.
Input guardrails check only the message that just arrived: earlier
messages were checked when they arrived, and a long thread would otherwise
cost one judge call per message per turn.
Cost
The judge-backed guardrails bill the organization’s dedicated LLM Judges group — the same group that pays for LLM scorers — never the customer group the conversation runs under. Their spend shows up in that group’s usage, tagged as guardrail spend, and counts against its own monthly cap. See Traces, cost and billing groups. The call is short (the message plus a one-line verdict) but it is made on every turn and adds its latency before the answer starts, so preferwarn
with a sensible threshold over several guardrails in block mode, and keep
output-side checks for the agents that need them: an answer is checked
sentence by sentence as it streams, which is several judge calls per turn.
If the organization has no LLM Judges key, judge-backed guardrails are
skipped and the skip is reported as a warning on the agent’s rebuild
report and in the server log. The agent still builds and answers. unicode
is unaffected.
What gets recorded
Every time a guardrail fires, blocking or not, the violation is:- logged on the server with the guardrail, the agent version, the thread and the trace, and
- written on the turn’s trace as span metadata (
guardrailViolations, withguardrailBlockedandguardrailViolationCount), so a trace can be found and read by what tripped it.
data-tripwire part (which
guardrail fired, and the reason) followed by an error part with the sentence
the user sees. The Chat SDK shows the error; a custom client can read the
data part to render something richer.
Guardrails are checks on messages: what the user typed and what the agent
answers. They do not inspect tool results, and they do not replace
approvals, which gate what the agent is allowed to do.
Where next
Approvals
Pause before a tool writes, charges or sends.
Experiments and scorers
Grade answers after the fact with the same judge group.