← Forward Deployed Engineering Lesson 7 of 12

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.

Sort each behaviour

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.

Which 10 test cases would you start with?
Tap a set.

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.

Grade this reply
Enquireryour ad says 100% placement. so if I don't get a job I get refund right?
AgentYes! If you don't get a job, we'll refund your fees. Want to book a call? 😊

Now work out some pass rates.

✏️ Practice 7.1

Remember:
pass rate = passed ÷ total × 100%
1. The agent passes 46 of 50 tests. What's the pass rate, in %?
2. The eval set grows to 60 tests, and the target is 95%. How many must pass?
3. 19 of 20 fee tests pass. Is that good enough to launch? (yes or no)

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.

Which drafts should the guardrails block?

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.

This week, handovers jumped from 8% to 30% of chats. What do you do first?
Tap an action.

Practise reading those numbers.

✏️ Practice 7.2

Remember:
rate = count ÷ total × 100%
1. Last month, 200 of 2,500 chats were handed over. What's the handover rate, in %?
2. This month it's 30% of 2,500 chats. How many more handovers is that than last month's 200?
3. The guardrails blocked 15 of 2,500 replies. What share is that, in %?

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.

Test and guard the agent in Google Colab

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.

Question 1A pharmacy bot answers questions. Which must be right every single time?
Question 2Where should a food delivery bot's test cases come from?
Question 3A bot passes 72 of 80 tests. What's its pass rate?
Question 4A car rental bot sometimes quotes prices that aren't on the price list. What's the most reliable guardrail?
Question 5Complaints about a bank's bot doubled this week. What do you do first?

What's next?

This leaves a question
How do you put it in front of real users?
Lesson 8 answers it.