Skip to content

Interview question · Agent Evals & Observability

How do you evaluate an agent whose path differs on every run?

Stop grading the path. Fix the environment, check the end state, express the rules about the path as invariants, and run each task enough times that variation is measured instead of feared.

mediumEssentialNewUpdated Nov 2026

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.

  1. Start here

    What if the agent's answer is right but it reads 30 files to find it?

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.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 6, and the site remembers where you stopped in each one.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in raises your free answers from 5 to 6 per topic, adds an applied lesson in every topic and easy practice tests, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

Nobody has commented. Post a correction or another way to answer.