Agents, Tool Use & MCP·Question 59 of 90Advanced

Your agent handles multi-turn conversations where users change their minds. Static test cases can't cover that. Build me an evaluation environment.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Static input-output pairs cannot evaluate an interactive agent, because turn 3 depends on what the agent said at turn 2. You need a simulated environment plus a simulated user, which is the design tau-bench established: a domain with real tools, a stateful backend, a policy the agent must follow, and an LLM playing the user against a hidden scenario.

Full worked answer with diagram

Static input-output pairs cannot evaluate an interactive agent, because turn 3 depends on what the agent said at turn 2. You need a simulated environment plus a simulated user, which is the design tau-bench established: a domain with real tools, a stateful backend, a policy the agent must follow, and an LLM playing the user against a hidden scenario.

The four pieces:

  1. A stateful mock backend. Not stubbed tool returns: a real database the tools mutate, seeded per run and reset between runs. This matters because it lets you grade on final state, which is objective, rather than on transcript text, which needs a judge.
  2. A user simulator with a private goal. Give it a persona, an objective, and information it reveals only when asked. This is what tests the behaviour you care about: the user who says "actually, make it two tickets not one" at turn 5. The simulator must be able to be vague, change its mind, and be mildly unhelpful, because real users are.
  3. A ground-truth final state per scenario. The database as it should look after a correct run. Grading becomes a diff: deterministic and cheap.
  4. Trajectory checks alongside. Did it violate policy, like issuing a refund without verifying identity? Did it take 30 steps for a 4-step task? Final state can be right for the wrong reasons.

The metric. Run each scenario k times and report pass^k, all k trials succeeding, not pass@1. That is the entire reason this environment exists: users experience consistency, and an agent that passes one time in eight is useless in production. Expect pass^k to fall off sharply as k rises, and treat that decay curve as a more useful artifact than any single score.

Going further: follow-up territory

Where this bites you, and you should say it unprompted: the user simulator is itself an LLM with its own failure modes. It leaks information it should withhold, it is too agreeable and accepts a wrong answer, it drifts out of character. So validate the simulator: have humans annotate a sample of transcripts specifically for simulator errors, and do not attribute simulator failures to the agent. Skip that and you are measuring two models while reporting one number. Dual-control variants, where the simulated user also holds tools and must act, push this further and are worth knowing.

Worth sketching. It shows the grader reading the database rather than the transcript, which is the design decision that makes the whole environment cheap to run.

flowchart LR
    A["Scenario seed"] --> B["Stateful mock backend,<br/>reset per run"]
    A --> C["User simulator:<br/>private goal, changes its mind"]
    C -->|"turns"| D["Agent under test"]
    D -->|"tool calls mutate state"| B
    B --> E["Diff final state<br/>against ground truth"]
    D --> F["Trajectory checks:<br/>policy violations, step count"]
    E --> G["Run each scenario k times,<br/>report pass^k"]
    F --> G

What a good answer covers

  • Static input-output pairs cannot evaluate an interactive agent, because turn 3 depends on what the agent…
  • You need a simulated environment plus a simulated user, which is the design tau-bench established
  • A stateful mock backend
  • A user simulator with a private goal
  • A ground-truth final state per scenario

Key terms: The four pieces · A stateful mock backend · Trajectory checks alongside · The metric · pass^k

Interviewer follow-ups to expect

  1. Your agent overfits to the simulator's quirks and regresses in production. How do you detect that?

  2. How many scenarios do you need before the pass^k number means anything?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep