Lesson 12.07 · Phase 12 · Safety, Security & Guardrails

Input & output guardrails

A guardrail is a classifier with an action attached, and every classifier is wrong sometimes. Redact before the model sees it, run blocking checks in parallel with the model, check answers against what the tools actually returned, and measure each rail's false positives before you ship it. A guardrail that blocks real customers is a bug, not a safety feature.

Learning objectives

  • Build input rails (PII redaction, topic and harm classification, jailbreak flagging) and output rails (grounding, PII leaks, policy commitments), each returning allow, redact, flag or block.
  • Run blocking input rails as tripwires in parallel with the model, and calculate the latency difference.
  • Check an answer's order ids and money amounts against tool results, so the agent can't confirm a refund it didn't make.
  • Measure every rail's precision and recall on a labelled set, and read the errors.

Your support agent tells a customer "Done: we refunded $490.00 to your card. Refunds are guaranteed." The tool actually refunded $49.00. Nothing in the agent loop checked the answer against the tool result, so the customer has a screenshot of a promise you didn't make.

Loading the full lesson…