Guardrails: PII, content policy, output validation
Notebook· 04.04· 120–150 min· Lesson 36 of 129
The notebook opens in your lab, in a new tab. If your server is stopped, it starts first (a few seconds).
By the end you can
- Protect personal data with
PIIMiddleware:redact,mask,hashandblock, on input, output and tool results, with built-in and custom detectors. - Build a deterministic before-agent guardrail that blocks a request before any model call.
- Validate the final answer with an after-agent guardrail and replace it when it breaks a rule.
- Run a bring-your-own-policy check with
openai/gpt-oss-safeguard-20bon Groq, parse its verdict, and fail closed when it is unavailable.
Before you start
Lessons 04.01–04.03.
