Program 03 · Module 08 of 10
Module 08: Testing and Evaluation
Measure whether an agent works. You test tools and components with ordinary unit tests, build scenario tests, create evaluation datasets and rubrics, measure completion and tool selection, and guard against regressions from model and prompt changes.
- Suggested study time
- 7-9 hours
- Prerequisites
- Modules 1 to 7.; Experience with a Python test runner such as pytest or unittest.
Sign in to track your progress. Every lesson stays free to read without an account.
Learning outcomes
By the end of this module you will be able to:
- Write unit tests for tools and agent components.
- Design scenario-based and end-to-end tests with scripted models.
- Build an evaluation dataset with rubrics and expected behaviours.
- Measure accuracy, task completion and tool selection.
- Detect regressions when the model or prompt changes.
Lessons
- 8.1
Unit Tests for Tools and Agent Components
Test the ordinary code around an AI agent, such as tools, validators and safety gates, with small Python unittest tests that run in a blink and never call a model.
40 min - 8.2
Scenario-Based and End-to-End Agent Tests
Run a whole agent through a realistic situation using scripted or recorded model replies, check the final status and the tools called, and keep slow live-model tests few and clearly labelled.
45 min - 8.3
Evaluation Datasets, Rubrics and Expected Behaviours
Build a small, honest evaluation dataset for an agent: write cases that name expected behaviour instead of exact wording, cover normal and risky situations, score soft qualities with a rubric, and keep a list of what the dataset misses.
45 min - 8.4
Measuring Accuracy, Task Completion and Tool Selection
Turn eval results into four honest numbers (status accuracy, tool selection, must-include rate and completion), and learn why counts and failed cases matter more than a single percentage.
40 min - 8.5
Regression Testing and Model/Prompt Changes
Compare two versions of an agent on the same cases, sort each case into fixed, broken or unchanged, and use a simple release rule so a change cannot quietly make things worse.
40 min - 8.6
Practical Lab: Create an Agent Evaluation Suite
Build a test dataset of 28 cases, a runner that records which tools the agent called, a scoring script with four metrics, a rubric, a version comparison with a release rule and an honest reading of the results.
2 h
About 5 h 30 min of lessons in total.
Practical assignment
Practical Lab: Create an Agent Evaluation Suite
Build an evaluation suite for an agent you have built: a dataset of at least 25 cases including adversarial ones, a rubric, metrics and a comparison between two prompt or model versions. This contributes to the program's safety, testing and evaluation assignment.
Deliverables
- An evaluation dataset with expected behaviours.
- A scoring script and a rubric.
- A report comparing two versions with an honest reading of the differences.
- A list of known gaps in the dataset.
Validation checklist
Use this to check your assignment before you move on.
Knowledge check
Show the answer and explanation
Answer: B. Tools are ordinary code and should be tested as such. End-to-end results mix model and code behaviour, which makes faults hard to locate.
Show the answer and explanation
Answer: B. A shared dataset and fixed metrics make the comparison fair. One favourite example is tempting but can mislead badly.
PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.