Skip to content

Courses / Agentic AI / Module 11

Module 11: Agent evaluation: task success, trajectory evals, simulation, regression suites in CI

12 h · theory 4 · hands-on 5 · project 2 · revision 1

You will be able to

  • Measure task success and trajectory quality
  • Simulate users and tools for repeatable tests
  • Build a regression suite that runs in CI
  • Track cost and steps per task

Capstone increment: Trajectory eval suite on 25 incident scenarios, run on every pull request.

Job-description skills: Evaluation of agents · Lab tools: deepeval, pytest

1. What to measure

Grade agents on four things: the outcome (did the task succeed: the incident fixed, the right ticket created, the right answer given), the trajectory (did it use sensible tools in a safe order), the cost (steps, tokens, money, time) and safety (any rule violated, any action without approval).

Outcome comes first. Grade the path only where it matters for safety or cost; many different paths can be fine.

Scenarioincident + expectedSimulated toolsrecorded responsesSimulated userscripted repliesk trialsnon-determinismOutcomefixed? correct answer?Trajectoryright tools, orderCost + steps₹, tokens, timeCI gatevs main branchRepeatable runsGrade three things
Grade the outcome first. Grade the path where it matters for safety or cost, not where several paths are fine.

2. Repeatable runs: simulated tools and users

Real tools make evals slow, expensive and flaky. Record tool responses for each scenario (or build small fake services) so every trial sees the same world, and check the end state of that world, not just the agent’s words: was the ticket created with the right fields, was the config value changed, was nothing else touched?

For conversational agents, simulate the user with a scripted or model-driven persona that answers clarifying questions, as τ-bench (tau-bench) does for customer-service agents. Keep scenarios in version control with their fixtures and expected outcomes.

3. Non-determinism: pass@k and pass^k

The same agent on the same scenario can succeed and fail on different runs. Run each scenario k times. pass@k (any of k tries succeeds) flatters an agent; pass^k (all k succeed), introduced with τ-bench, is closer to what users experience across many interactions. Watch how far apart they are.

pass@k versus pass^kAgents are non-deterministic, so each scenario is run many times. Change k and see two very different stories about the same agent.

Mean single-trial success 72% · pass@1 (any try works) 72% · pass^1 (every try works) 72%

ScenarioOne trialpass@1pass^1
Disk full on a worker98%98%98%
Expired TLS certificate95%95%95%
Bad deploy, clear rollback92%92%92%
Memory leak after release88%88%88%
Noisy neighbour on shared DB80%80%80%
Flaky upstream API74%74%74%
Config drift between regions65%65%65%
Two incidents at once55%55%55%
Misleading alert45%45%45%
Silent data corruption30%30%30%
Guided experiments
  1. At k = 1 all three numbers match. Raise k to 8. Which metric would a vendor put on a slide, and which would an on-call engineer care about?
  2. “Bad deploy, clear rollback” succeeds 92% of the time. What is its pass^8? If the agent handles that incident type 8 times a month, how often does at least one go wrong?
  3. pass@k is the right metric in one case: when a cheap verifier can pick the working attempt. Which scenarios here could you verify automatically?
  4. You can only afford 3 trials per scenario in CI. Why is one run per scenario not enough to tell a 90% agent from a 70% one?
Common misconception: “It passed the eval.” Once? Agents are stochastic. A scenario that passes one run in three is a production incident waiting to happen.

4. Grading: state, rules and judges

Prefer deterministic graders: end-state checks on the simulated environment, and trajectory rules (“set_config only after request_approval”, “never more than 10 steps”). Trajectory matching comes in modes: strict, unordered, subset and superset; use the loosest that still catches the failures you care about.

Use an LLM judge only for what code can’t check, such as the quality of an incident summary, and calibrate it against human labels as in the RAG Systems and GenAI courses.

5. A regression suite in CI

Start with 20 to 30 scenarios drawn from real incidents, including hard and adversarial ones. Run each 3 times on every pull request with simulated tools, report pass^3, average steps and cost per scenario against main, and fail the build on drops beyond the noise. Run the full suite with more trials nightly.

Every production failure becomes a new scenario. Over time the suite becomes the most valuable thing in the repo: it lets you change prompts, models and tools with confidence.

In production: Track cost and steps per scenario in CI too. A prompt change that keeps success but doubles steps is a regression your bill will notice.

Hands-on: coding window

The coding window and the full VS Code lab are available after you sign in.

Sign in to code

Labs

Lab 11.1: 25 scenarios with fixtures

Write 25 incident scenarios with recorded tool responses, an expected end state and tags (easy, hard, adversarial). Make the agent’s tools read from fixtures in eval mode.

Expected: evals/scenarios/ with fixtures; one command runs a scenario offline.

Lab 11.2: Graders

Add end-state checks, trajectory rules (approval before change, step cap) and a calibrated LLM judge for summaries. Report each separately.

Expected: A per-scenario report with outcome, rules, judge score, steps and cost.

Lab 11.3: CI suite (capstone increment)

Run the suite with k = 3 on every pull request, compare pass^3, steps and cost with main, post a comment and fail on real drops.

Expected: A PR that breaks the approval rule fails CI with the scenario named.

Go deeper

Videos

Further reading

GitHub repositories

Checkpoint quiz

1. What should you grade first?
2. Why simulate tools in evals?
3. A scenario succeeds 70% per trial. Its pass^3 is about…
4. A strict trajectory match fails a run that took one extra, harmless look. Better approach?
5. Where do new scenarios come from after launch?

Interview questions

  1. How do you evaluate an agent that takes actions, not just one that answers?
  2. Explain pass@k and pass^k. Which would you report to a customer?
  3. How do you make agent evals repeatable when tools and models are non-deterministic?
  4. Design a CI eval suite for an agent. What runs on every PR, and what nightly?
  5. Your agent’s success stayed flat but cost doubled after a prompt change. How would you catch and debug that?

Ask the professor

Sign in to ask questions about this module.

Discussion

Community discussion appears here once giscus is configured (see README).