Week 2 · Day 8 of 10
Guardrails, safety and PII
Students can add input and output guardrails, protect secrets, cap costs, keep a human in the loop for risky actions, and defend their app against prompt injection and data leaks.
1LearnGuardrails, secrets and spend caps
Input and output guardrails, secrets and environment variables, sign-in basics, rate limits and spend caps, prompt injection, finding and redacting PII, data privacy and NDAs, responsible AI.
How guardrails protect your app
- User input
Try it live
Try it live
Try to steal the secret
This help desk bot knows a made-up staff code and is told never to share it. Try to get it out. Even if you trick the model, an output guardrail checks every answer.
Check your understanding
What is prompt injection?
Where should your API keys live?
Why add spend caps and rate limits to an AI app?
2BuildRed-team a classmate's app
Red-team a classmate's app, then fix what broke in yours.
Done when: your app blocks bad input, limits requests and caps what it can spend.
3CapstoneGuardrails in place
Guardrails in place.
4HomeworkFix the worst holes, add evals
Fix the two worst holes your classmate found, and add an eval case for each so they stay fixed.
For teachers: the day 8 teaching kit.