A. Module overview
| Field | Value |
|---|---|
| Module ID | L3-M04 |
| Level | 3 - AI Agent Quality Engineer |
| Description | Evaluating the path an agent takes, not only where it stops: the trajectory record of a run (what to record, why, who records it), a lint that separates errors of the record from things worth a look, and redaction of secrets before storing; reference paths with five matching modes (exact, in_order, any_order, superset, subset), per-tool argument rules, precision and recall of calls, and several valid paths; a step judge calibrated against human step labels (kappa, false-accept rate, a threshold chosen by a person, bias probes); efficiency measures (step ratio, redundant calls, loops, retries after an error, wasted cost); and an evaluator that combines outcome, process and efficiency into a report with flags, with a gate that fails closed and a table of "which view sees which defect". The module's lab is twelve simulated agents on the fake tool layer of the fictional product ThuVien Mini (a school library helper), plus a simulated step judge; deterministic, run offline: no model call, no real server, no API key; tools run only in memory and in one temporary folder. What is known about trajectory evaluation is quoted from sources read on 2026-11-04: Anthropic's article on agent evals, the agentevals README, the Google Cloud page "Evaluate Gen AI agents", two arXiv papers (τ-bench, Zheng et al. on model judges) and two Wikipedia pages (Cohen's kappa, multiset). The reading depth of each source is recorded in §12 of each lesson. |
| Why this module matters | A right end state does not say the agent worked the right way: an agent can borrow a book without checking and be lucky, ask the same question three times, or ask again for something that was blocked. The sources even disagree on whether to grade the path at all, and the same matching-mode name means different things in two tools. The module teaches recording the path correctly, comparing it with a reference under written rules, scoring each step with a judge that was compared with people, measuring waste, and combining the views so that each defect is seen by at least one of them, without turning them into one "good" number. The module lays the ground for multi-turn conversation evaluation (L3-M05), reliability, cost and latency (L3-M06) and agent safety (L3-M07). |
| Target job competency | Level 3, learning outcome 3: "Evaluate task success, partial success and trajectories, with documented matching rules". L3-M03 covers task success and partial success; this module covers trajectories, with documented matching rules. The module does not measure reliability over several trials (pass^k), does not measure real cost or latency, does not use a real model as a judge, and does not measure real agents. |
| Estimated duration | 5 lessons × 120 minutes = 10 hours, plus the module assignment (~4 hours) = ≈ 14 hours for someone who has completed L3-M03. An estimate, not measured with real learners. |
| Prerequisites | L3-M03 (the first lesson needs L3-M03-L04). The module reuses, without repeating: the end-state oracle and scope (L3-M03-L01), the workflow graph, process rules and the coverage of a scenario suite (L3-M03-L02), a gate that fails closed and mutation testing on a results table (L3-M03-L03), the fake tool layer with the statuses applied, rejected, blocked... and idempotency keys (L3-M02-L04), stop reasons and the loop guard (L3-M01-L02), traces and redaction (L3-M01-L04), judges, biases and calibration with kappa (L2-M04-L01 to L2-M04-L04). No API key needed. |
| Module deliverable | A trajectory evaluator: a record schema with lint and redaction, a matcher with tests, a calibrated step judge with a threshold chosen by a person, efficiency measures, and an evaluator combining outcome, process and efficiency with a gate that fails closed; plus the small product of each lesson |
| Cost | 0 |
What the learner builds. Step by step, in code-labs/l3-m04: (L01) the thuvien.trajectory/1 record written by the harness, WHY, lint_trace with errors and warnings, redact, build_record; (L02) match with five modes, the argument rules exact, subset, any with ignore and normalise, maximum matching, match_any, validate_path; (L03) the simulated judge with a four-item checklist, parse_rating, judge_run, sweep, suggest_threshold, policy_threshold, probe, consistency; (L04) step_ratio, redundant, loops, retries_after_error, wasted_cost, report; (L05) evaluate_run, run_suite, gate, sensitivity. The lab copies the files it needs from the L3-M02, L3-M03 and L2-M04 labs, imports from none of them, and needs only pytest.
What the module does not do. It does not measure real models or agents, does not state the price, speed or reliability of any model, agent or vendor, and does not rank or recommend any framework or provider (the two tools quoted are only used to compare matching-mode names): every number of the lab describes a simulation. The lab's judge is a checklist with biases invented for teaching, not a model. No shell command, no network, no file outside the temporary folder. No reliability over several trials, no real cost or latency (the lab's units are made-up cu and ticks). No automated workflow is created or changed in the repository. No legal statement. The lint, the matcher, the judge, the measures and the gate only flag; the gate fails closed and has no word that means "approved"; a person chooses the judge threshold, decides which flags are accepted, and makes every real-world decision.
Terms reused with another meaning (each lesson has a separating sentence). trajectory is the ordered record of the steps of a run, unlike the trace of L3-M01-L04 (a span tree), the call history the L3-M03 oracle reads and the effect log of L3-M02-L04 (L01); a reference path differs from the reference answer of L1-M01-L05 and L2-M04-L02, and "subset" as a matching mode differs from "subset" as an argument rule (L02); a step judge scores one call, unlike the judge of L2-M04 that scores an answer, and the lab's "self-claim" bias differs from self-preference (Zheng et al. call it self-enhancement) of L2-M04-L03 (L03); efficiency measures the path, unlike the real cost and latency of L3-M06, a loop is measured after the run, unlike the loop_detected guard of L3-M01-L02, and redundant differs from the tool layer's duplicate status (L04); the gate reads the reports of a whole suite, unlike the gate of L3-M03-L03 and the regression gate of L2-M07-L04 (L05).
B. Learning objectives
| ID | Objective |
|---|---|
| MO1 | Design a trajectory record with a reason for each field, run the lint and tell apart errors of the record from warnings, redact secrets and state what the lint and the redaction do not check. |
| MO2 | Define the five matching modes and map them to the mode names of the sources, choose argument rules, read precision, recall, missing, extra, uncounted, and use several valid paths. |
| MO3 | Calibrate a step judge against human step labels (confusion matrix, kappa, false-accept rate on dev, report on test), handle unreadable verdicts, run bias probes, and leave the threshold to a person. |
| MO4 | Measure efficiency (step ratio, redundant calls, loops, retries after an error, wasted cost in cu and ticks) and read it next to the outcome, never alone. |
| MO5 | Combine outcome, process (the matcher and the step judge; the judge has its own column in the sensitivity table) and efficiency into a report with flags, run a gate that fails closed, read the sensitivity table, and explain why the list of allowed flags is a person's decision. |
| MO6 | Test the matcher, the judge and the measures themselves with mutation testing on a golden table and state which broken versions survive and why. |
C. Lessons
| ID | Lesson | Duration | Prerequisite | Concepts | Practical output |
|---|---|---|---|---|---|
| L3-M04-L01 | Trajectories: what to record and why | 120' | L3-M03-L04 | trajectory record, harness, WHY, lint errors and warnings, redaction, a forged but consistent record |
A record schema with lint and redaction |
| L3-M04-L02 | Reference trajectories and matching rules (exact, in-order, any-order, subset) | 120' | L01 | reference path, five modes and their implications, mode names in two sources, counted calls, argument rules, precision and recall | A matcher with tests |
| L3-M04-L03 | Step-level judges and their calibration | 120' | L02 | checklist, unreadable verdicts, step labels, kappa, false-accept rate, a threshold chosen by a person, bias probes | A calibrated step judge |
| L3-M04-L04 | Efficiency: step count, redundant calls, loops | 120' | L03 | step ratio, call key, redundant calls, loops, retries after an error, wasted cost, efficiency is not quality | Efficiency measures |
| L3-M04-L05 | Building a trajectory evaluator | 120' | L04 | the report of one run, three views, always-hold flags, allowed flags, a gate that fails closed, the sensitivity table | An evaluator combining outcome, process and efficiency |
D. Module assignment
The module assignment exercises.md: a trajectory evaluation suite for ThuVien Mini v2 (student S0101; six tasks v01 to v06 mapped from the lab's tasks, 30 step labels pointing at the v2 runs, 12 agents times 6 tasks = 72 cells). The learner builds the package trajectory_suite/ and one command that writes six Markdown reports plus the table table.json: records (lint, warnings, redactions, unfinished runs), matching (per mode, an edit distance and a first divergence written by the learner), the step judge (default and fair judge, threshold sweep, the test split at the threshold chosen by a named person, probes), efficiency, the evaluator (gate per agent, sensitivity per view, which view is blind to which agent, the person's decision left empty), mutations (at least 10 broken versions, killed or surviving with reasons) and a 72-cell golden table rebuilt twice with identical output; criteria AC1-AC6 and a 100-point rubric, plus an independent challenge. The five independent exercises of each lesson are in code-labs/l3-m04/exercises/ and in §9 of each lesson: predicting the lint errors and redactions of five records (L01), predicting the matching modes and writing additional paths (L02), computing kappa by hand and proposing a threshold under a requirement (L03), finding the waste in a ten-call run (L04), finding the smallest list of flags a person must accept (L05).
E. Module assessment
The module quiz quiz.md (12 questions, 20 points, pass mark 70%; 5 multiple-choice, 3 true/false, 2 calculation and 2 analysis questions, on new data not used in the lessons, practice or exercises), the module assignment with acceptance criteria and a rubric (exercises.md); the solutions and the instructor guide are for instructors only. The per-lesson practice files are practice-01.md to practice-05.md (with .en.md versions), public and with reference solutions. The instructors' solutions and checks are in code-labs/l3-m04/instructor/ and are for instructors only.
F. References
The shared list is in references.md (7 sources fetched on 2026-11-04, with the access date and reading depth of each). Each lesson also has its own references table in §12.
Objectives ↔ assessment matrix
| Objective | Lesson | Independent exercise (§9) | Quiz questions | Module assignment criterion |
|---|---|---|---|---|
| MO1 | L01 | exercises/test_l01_trace.py |
Q1, Q6 | AC1 (and AC6 for the whole module) |
| MO2 | L02 | exercises/test_l02_match.py |
Q2, Q7, Q11 | AC2 (and AC6 for the whole module) |
| MO3 | L03 | exercises/test_l03_judge.py |
Q3, Q9, Q12 | AC3 (and AC6 for the whole module) |
| MO4 | L04 | exercises/test_l04_efficiency.py |
Q4, Q8, Q10 | AC4 (and AC6 for the whole module) |
| MO5 | L05 | exercises/test_l05_evaluator.py |
Q5, Q11, Q12 | AC5 (and AC6 for the whole module) |
| MO6 | L3-M03-L03 (recalled in L05 §6.1 and practice-05 P09) | no separate exercise; mutations belong to the module assignment | no separate question | AC6 |