Skip to content

AI safety guardrails

Guardrails are off unless you add a safety: block. Without one, nothing is checked, no extra model is called and no latency is added.

safety:
mode: enforce # enforce (default) | monitor: only record what would have happened
pii: redact # redact (default) | block | off
injection: block # block (default) | flag | off
blockedTerms: [project-falcon, "internal only"]
judge: # optional AI review
model: openai/gpt-4o-mini
on: flagged # flagged (default): only text the rules flagged | all: everything

safety: {} turns on the defaults. safety: { mode: monitor } is the way to try it: everything is recorded and nothing is changed or blocked. agent-platform init (Advanced) asks whether to add it.

Check What Action
PII Emails, phone numbers, card numbers (Luhn-checked), US SSNs, IBANs Replaced by [EMAIL], [CARD]…, or blocked with pii: block
Secrets AWS keys, sk-… keys, Stripe, GitHub, Slack, Google and Groq keys, platform keys, JWTs, private keys Always replaced by [SECRET]; a tool call carrying one is not run
Prompt injection “Ignore previous instructions”, “reveal your system prompt”, “developer mode”, chat-template tokens, hidden Unicode Blocked (or flagged)
Blocked terms Your words or phrases, whole-word, case-insensitive Blocked
System-prompt leak A reply repeating 60+ characters of the instructions Blocked
AI judge Violence, self-harm, sexual content involving minors, hate, harassment, illegal weapons or drugs, subtle injection Blocked

Injection is only looked for in text from outside: user messages, tool results and agent-to-agent traffic.

  • Assistants: user messages before the model sees them; tool arguments before a tool runs; tool results before they go back to the model (an injected result is withheld and the turn goes on); replies before they’re returned. A blocked message gets “I can’t help with that.” and a safety list in the response. The Playground trace shows each check as a SAFE step.
  • Code agents through the LLM gateway: new user and tool messages are checked (blocked → HTTP 400 content_policy_violation); replies are redacted, and a blocked one returns finish_reason: content_filter.
  • Agent-to-agent calls: the request is checked against the called agent’s policy, the response against the caller’s. Blocked → 403 with x-agent-platform-safety: blocked.
  • The deployment’s Observability panel has a Safety section with counts by kind and action and the latest findings.
  • Findings also appear on the distributed trace page.
  • Only a redacted sample is stored — never the flagged text itself.
  • With safety: on, assistant logs replace message and tool text with [hidden: safety on].

It uses your own provider key — the gateway key, or for an assistant without the gateway, the assistant’s own key (so the judge must use the same provider as assistant.model). If the judge can’t be reached, the rules’ result stands; the agent is never blocked just because the judge is down.

  • Code agents that call a provider directly are not inspected — use llm.gateway: true.
  • Streamed gateway replies are checked after they’re sent (recorded, not redacted).
  • Only text is checked; images and audio pass through.
  • Rules are heuristics. Keep approval: true on tools that move money or send messages.