TL;DR: Make the environment fixed and the path free. Seed a sandbox (database, files, mock services with recorded responses), give the agent a task, and grade the end state against what should have changed and what must not have. Check the trace for invariants (forbidden actions, required confirmations, ordering rules, step and cost limits) rather than matching a reference path. Use a simulated user when the task is a conversation. Run each task several times and report consistency, because the variation is part of what you are measuring.
How to approach it
Say why exact-match testing fails (many valid paths), then build the eval from four parts: environment, task set, graders, repetition. Close with how the eval stays current.
A strong answer
1. A fixed environment. A seeded test database, a sandbox repository, mock services that return recorded or scripted responses, a fixed clock. The agent can take any path through it; the starting conditions are the same every time.
2. Tasks with expected end states. Each task states the request and what the world should look like afterwards:
def grade_end_state(before, after, expected_changes, ignore=("updated_at",)):
def clean(row):
return {k: v for k, v in row.items() if k not in ignore}
problems = []
for key, want in expected_changes.items():
if clean(after.get(key, {})) != want:
got = clean(after.get(key, {}))
problems.append(f"{key}: expected {want}, got {got}")
for key in before:
changed = clean(before[key]) != clean(after.get(key, {}))
if key not in expected_changes and changed:
problems.append(f"{key}: changed but should not have")
return problems
before = {"ord_1": {"status": "paid"}, "ord_2": {"status": "paid"}}
after = {"ord_1": {"status": "cancelled", "updated_at": "10:05"},
"ord_2": {"status": "cancelled", "updated_at": "10:05"}}
problems = grade_end_state(before, after, {"ord_1": {"status": "cancelled"}})
print(problems) # => ['ord_2: changed but should not have']
The run cancelled the right order, by whatever route, and also cancelled one it should not have. The path is not graded; the result and its side effects are.
3. Invariants on the trace. Rules about how, not which path: no write before verification, a confirmation before anything irreversible, no forbidden tools, no more than N steps or a cost ceiling.
4. A simulated user for conversations. Many agent tasks need back-and-forth. A model plays the user from a scripted persona and goal, as in τ-bench (Yao et al., 2024), so the agent can ask questions and get consistent answers. The simulator is itself a model and can drift, so check a sample of simulated conversations by hand.
5. Repetition. Run every task several times. Report the single-run rate, pass^k for user-facing tasks, and per-task consistency. A task that passes 5 of 10 times is a finding, not noise.
6. Keep it current. Add a case from every production failure (with its recorded tool responses), retire cases that no longer reflect the product, and keep a held-out set nobody tunes against.
What interviewers probe next
"Some tasks have several acceptable end states." Express the expectation as a predicate rather than one state: "exactly one refund, amount between the item price and the order total".
"Can you use a model to grade end states?" Where code can compare state, use code. Use a calibrated model grader for text outputs, such as whether the reply explained the refund clearly.
"How do you test behaviour against live services?" Mostly you don't in the main eval: recorded responses keep it repeatable. A smaller smoke suite against staging services catches integration drift.
What if?
What if · interview follow-ups
Hold your answer as the constraints change
Your eval seeds a sandbox, grades end state and invariants, and runs each task five times.
Start here
What if the agent's answer is right but it reads 30 files to find it?
Which kind of check catches this?
A trajectory limit on steps or cost per task type. The outcome passed; the efficiency invariant fails and shows up as its own metric.
Carry it forwardCost and steps are invariants too.
Weak answerIgnoring it because the answer was correct.
Constraint changes
What if a model upgrade makes the simulated user more cooperative and scores rise?
What changed: the agent or the test?
The simulator is part of the eval. Pin its model and prompt like any test fixture, and compare agent versions only against the same simulator version.
Carry it forwardPin the simulator; it is part of the instrument.
Weak answerUpgrading the simulator and the agent in the same comparison.
Constraint changes
What if a task passes 6 of 10 runs?
Noise or signal?
Signal: the task is unreliable. Read the failing traces for what differs from the passing ones (often an ambiguity or a tool result the agent misreads) and add the pattern as its own case.
Carry it forwardInconsistency on a task is a finding.
Weak answerRerunning until it passes.
Now defend it
One-line answer?
Fix the environment, free the path: grade end state including untouched records, check invariants on the trace, simulate users for conversations, repeat runs, and feed production failures back in.
How it's scored
Weak: Compares runs to a golden sequence of tool calls, or checks only the final text.
Hire: Grades end state in a sandbox and checks a few invariants, with repeated runs.
Strong Hire: Builds a fixed environment with recorded services, grades expected and forbidden changes, states path rules as invariants including cost and steps, uses a pinned simulated user, reports consistency per task, and maintains the set from production failures with a held-out split.
Common mistakes
- Golden-path matching that fails valid alternatives.
- Checking only what should change, not what should not.
- Running each task once.
- Letting the simulator or tool fixtures change between compared versions.