Tests, guardrails and monitoring
Agree what good enough means
No AI system is right every time. So before launch, agree with Priya what "good enough" means.
Some things must be right every single time. Others can be right most of the time. Saying which is which is part of the scope.
How do you check those before launch?
Build tests from real chats
Collect real messages, and for each one write down what a good reply must do. Run the agent on all of them before every change.
This fixed set of test cases is called an evaluation set, or eval set.
A good one mixes common questions, tricky ones, and risky ones.
Then each reply needs a grade.
Grade the replies
"Looks fine" isn't a grade. Use the same short checklist for every reply: are the facts right, does it follow the rules, does it take the right action, is the tone right?
With hundreds of tests, a second model can grade with the same checklist. That's called an LLM judge. You still check a sample of its grades by hand.
Now work out some pass rates.
✏️ Practice 7.1
pass rate = passed ÷ total × 100%
Guardrails
Tests run before launch. But every live reply needs checking too.
Simple code runs on every reply before it's sent: does it mention a fee that isn't in the sheet? Does it promise a job? Does it share a phone number? If so, it's blocked and a person takes over.
Checks like these are called guardrails. They're plain code, so they never have an off day.
After launch, how do you know it's still working?
Watch it after launch
Track a few numbers every day: how fast replies go out, how many chats are handed over, how many replies the guardrails block, and how many complaints come in. Watching these is called monitoring.
When a number jumps, don't guess. Read the conversations behind it.
Practise reading those numbers.
✏️ Practice 7.2
rate = count ÷ total × 100%
Do it for real
Now prove it works. In the notebook you'll turn real chats into an eval set, grade the agent with code and with an LLM judge, and decide if it's ready to launch.
Then you'll add guardrails, see what they catch and what they miss, and spot the problem day in Northstar's first week live.
Colab runs Python in your browser for free. Replay mode needs no key. About 45 minutes.
Then check what stuck.
Lesson test
Five questions, all on new examples.