Exercises — Autonomous agent evaluation
Prerequisite links you may want open: Reinforcement Learning Basics, Benchmark Design, Human Evaluation Protocols, Tool Use in Language Models, A/B Testing, Safety Alignment.
Level 1 — Recognition
Exercise 1.1 — Name the metric
An agent must book a flight in 6 web steps. We only record, at the end, whether the flight was booked or not — a single yes/no per episode. Over 200 episodes it books correctly 128 times. Name (a) the metric being measured and (b) its point estimate .
Recall Solution 1.1
(a) This is the task success rate — a binary "goal achieved / not achieved" measure, not per-step accuracy. (b) The point estimate is the fraction of successes: Here = number of successful episodes, = total episodes. So .
Exercise 1.2 — Which paradigm?
For each task, say whether you'd use benchmark-environment, human-in-the-loop, or tool-use evaluation:
(a) "Was the customer-service reply empathetic?"
(b) "Did the code agent call execute_python with valid arguments?"
(c) "Did the web agent add the cheapest laptop to cart in a reset-able simulator?"
Recall Solution 1.2
(a) Human-in-the-loop — empathy is subjective and hard to formalize, so a human rates it (e.g. 1–5). See Human Evaluation Protocols. (b) Tool-use evaluation — we check the correctness and appropriateness of a tool call. See Tool Use in Language Models. (c) Benchmark environment — a reproducible, reset-able simulator we can instrument fully. See Benchmark Design.
Level 2 — Application
Exercise 2.1 — Compounding failure
An agent has per-step success probability and every step must succeed for the task to succeed. Compute the overall task-success probability for steps and for steps.
Recall Solution 2.1
Why multiply? "All must succeed" means the task succeeds only if step 1 succeeds and step 2 succeeds and … and step succeeds. For independent events, the probability of an "and" is the product of the probabilities — that is the definition of independence. So: (The symbol just means "multiply all these together", like means "add all these together".) For : (about ). For : (about ). What the figure shows and how to read it. The horizontal axis is the number of steps ; the vertical axis is the overall success , running from at the bottom to at the top. Three curves fall from the top-left corner: magenta (), violet (), orange (). The key visual is the shape: each curve leaves the top edge at (zero steps means nothing can fail, so success ) and then droops — gently at first, then relentlessly — because every extra step multiplies in another factor smaller than . Follow the magenta curve rightward with your eye: at it has only slipped to about (the first arrow), but by it has sagged all the way to (the second arrow), crossing below the gridline. The violet and orange curves sit underneath magenta everywhere and plunge even faster — the smaller the per-step rate, the steeper the droop. That downward bend, present in all three curves, is the compounding-failure phenomenon made visible: high per-step reliability still collapses into low whole-task reliability once enough steps chain together.

Exercise 2.2 — Confidence interval on success rate
From Exercise 1.1 we had over episodes. Give the 95% confidence interval using the binomial normal approximation.
Recall Solution 2.2
Where does the standard error come from? Each episode is a coin-flip: success (count ) with probability , failure (count ) with probability . A single such flip has variance — you can check the extremes: if or the outcome never varies so variance is , and it is largest at where the coin is most unpredictable. We estimate by averaging independent flips, and averaging independent things divides their variance by : The substitution we must make honest. This formula contains the true rate , which we do not know — if we knew we wouldn't be estimating it. So we plug in our best guess in its place, giving the approximation This is legitimate because as grows, so for large the swapped-in value is close. The standard error is the square root of that variance — how much would wobble across repeated 200-episode runs: Why is a normal curve allowed here? The Central Limit Theorem says an average of many independent flips is approximately bell-shaped. The rule of thumb for the approximation to be trustworthy is and . Here and — both comfortably above , so we're safe. The 95% interval uses the multiplier (covers the central of a normal curve): So , i.e. roughly .
Exercise 2.3 — Discounted reward
An agent earns rewards on three steps with discount factor . Compute the discounted cumulative reward .
Recall Solution 2.3
The discount factor shrinks later rewards; step is weighted by : (See Reinforcement Learning Basics for where comes from.)
Level 3 — Analysis
Exercise 3.1 — Is 68% really better than 64%?
Agent A scores over ; Agent B scores over . Using each agent's own 95% CI, can you conclude B is genuinely better? Show the intervals and reason.
Recall Solution 3.1
Agent A (from 2.2): . Agent B: . The intervals overlap heavily ( vs ), so with we cannot conclude B is better — the 4-point gap is within noise. What the figure shows. It draws two horizontal bars, one per agent: the dot marks the point estimate and the whiskers reach out to . Agent A's bar (magenta, lower) is centred at ; Agent B's bar (violet, upper) is centred at . Look at where the two bars share horizontal ground — the shaded orange band between about and : that band is the overlap, and its sheer width is the visual signal that the estimates are statistically tangled. When two error bars overlap that much, sliding one agent up or down within its own uncertainty could reverse the ranking, so we have no license to call B better. This is exactly the parent-note warning that small gives fat error bars. To separate 64% from 68% you'd need a much larger (or a paired A/B Testing design that cancels shared per-task variance).

Exercise 3.2 — Diagnose the tool-use agent
A code agent is asked to compute 2+2 and produces this trajectory:
Action: search_web("what is 2 plus 2")
Action: execute_python("print(2+2)")
Observation: 4
The optimal solution needs 1 tool call (execute_python). Both calls returned, but only the second was needed. Compute tool-use precision and recall (counting execute_python as the one correct call).
Recall Solution 3.2
- correct tool calls = 1 (
execute_python) - total tool calls = 2
- tool calls needed for optimal solution = 1
Interpretation: Recall → it found the right tool. Precision → half its calls were wasted (
search_webwas unnecessary). Low precision flags waste / hallucinated tools; recall flags missing the right tool.
Level 4 — Synthesis
Exercise 4.1 — Lexicographic safety score
A file-system agent organizing a desktop takes 12 actions. One action deleted a file (a hard-constraint violation). It nonetheless finished the sorting task correctly (task success = 1). Using the parent note's lexicographic rule, compute the final Score. Then compute the "naive" safety-fraction score and explain why the two disagree.
Recall Solution 4.1
Lexicographic (safety-first) rule: One hard violation occurred → Score , regardless of task success. Naive safety-fraction: Disagreement: the naive score says " safe — pretty good!", which rewards an agent that irreversibly deleted a user file. The lexicographic score refuses any credit once a hard constraint breaks — deleting files while "succeeding" is worse than failing safely. What the figure shows. It draws two stacked shelves: an upper magenta "SHELF 1: safety" and a lower violet "SHELF 2: success". The reading rule is drawn as arrows: you only drop your gaze to the success shelf after the safety shelf is confirmed clear. The orange arrow plunging from the safety shelf down to a "Score = 0" tag at the bottom is our case — one violation ejects the agent off the top shelf to a hard zero before success is ever consulted. The separate navy arrow (clean pass) is the only path that reaches the success shelf. See Safety Alignment.

Exercise 4.2 — Design a compositional eval
You must evaluate a research agent that (i) calls a search tool, (ii) reads results, (iii) writes a summary graded by humans. Sketch a compositional evaluation: which sub-skills you test in isolation, which metric per sub-skill, and how you combine them. Cite the paradigm each metric belongs to.
Recall Solution 4.2 (model answer — many valid variants)
The idea in words first. Break the agent into its three independent sub-skills, give each the kind of metric that matches its nature (a tool call is objective; a summary's quality is subjective), then run the whole pipeline end-to-end so a low final number can be traced back to whichever stage failed. Below is that mapping written as a narrative list (so it reads the same in any renderer, not just as a table):
- Sub-skill (i): search tool call. Metric = tool precision / recall on valid arguments (did it call the right tool with valid args?). Paradigm = tool-use evaluation, see Tool Use in Language Models.
- Sub-skill (ii): reading / retrieval. Metric = exact-match / F1 against known ground-truth passages. Paradigm = benchmark environment, see Benchmark Design.
- Sub-skill (iii): summary quality. Metric = human 1–5 quality score plus an inter-rater reliability check. Paradigm = human-in-the-loop, see Human Evaluation Protocols.
Why inter-rater reliability, and why Krippendorff's specifically? A single human's 1–5 score is only trustworthy if other humans would score similarly — otherwise you're measuring the rater's mood, not the summary. So we need a reliability coefficient. We pick ==Krippendorff's == over Cohen's because handles exactly two raters and only nominal (categorical) labels, whereas summary grading here uses more than two raters on an ordinal 1–5 scale, and often has missing ratings (not every judge rates every item). Krippendorff's is the one coefficient that gracefully covers all three of those (any number of raters, ordinal/interval data, missing values), which is precisely our situation.
Compose end-to-end: run full trajectories, apply the lexicographic guard (safety first), then report task success rate with a 95% CI. Report per-sub-skill scores alongside end-to-end, so a low end-to-end number can be traced to the failing stage — that's the whole point of compositionality: isolate to diagnose, combine to judge real usefulness.
Level 5 — Mastery
Exercise 5.1 — How many episodes to resolve a 5-point gap?
Two agents truly differ by 5 points in success rate (say vs ). Roughly how many episodes per agent do you need so that each agent's 95% CI half-width is at most points (), i.e. the intervals just stop overlapping around the midpoint? Use the worst-case variance .
Recall Solution 5.1
The CI half-width is . We want this . Use worst-case : Why is squaring both sides legal here? Squaring preserves an inequality only when both sides are non-negative — and they are: a square root is never negative, and . (If either side could be negative, squaring might flip the inequality, so this check matters.) Squaring: So episodes per agent (round up). Lesson: distinguishing small gaps costs thousands of trials — which is why practitioners prefer paired A/B Testing on shared tasks to cut variance dramatically.
Exercise 5.2 — Defend a benchmark choice
A stakeholder says: "Our synthetic benchmark shows success — ship it." You know SWE-bench-style real tasks give top agents only –. In 3–4 sentences, defend why the synthetic number is not sufficient, using the parent note's vocabulary.
Recall Solution 5.2 (model answer)
A synthetic benchmark can be gamed: the agent may exploit templated patterns that don't exist in the wild, so high scores lack ecological validity. Real-task benchmarks (real GitHub issues verified by the issue's own tests plus no-regression on existing tests) measure whether the agent is actually useful. The vs – gap is precisely the signal that our synthetic setup over-estimates capability. Ship decision should rest on real-task success with confidence intervals and a passing safety guard — not the friendly synthetic number.
Recall Quick self-test
Overall task success from per-step over steps ::: (steps independent, all must succeed) Standard error of a success proportion ::: Discounted reward weight on step ::: (first reward undiscounted) Why lexicographic scoring, not weighted blend ::: safety must never be bought back by task success Why real benchmarks over synthetic ::: ecological validity — synthetic benchmarks can be gamed