Skip to main content
Back to all articles
AI Engineering 7 min readUpdated August 31, 2026

Single-Turn Evals Miss the Ways Agents Actually Fail

Tool-using agents often fail after several exchanges: they ask the wrong clarification, forget constraints, repeat work, or take unsafe shortcuts. A simulated-user harness can test full trajectories while keeping the user model separate from scoring.

By Salman Butt · Senior Full-Stack & Generative AI Engineer
#ai-agents#multi-turn-evals#simulated-users#llm-evals#agent-testing#typescript#python
On this page

A single prompt-and-answer test can tell you whether a chatbot responds well to one message.

It tells you much less about an agent that needs to work through ambiguity, ask follow-up questions, use tools, recover from failures, and maintain state across ten turns.

Many of the most expensive agent failures are trajectory failures:

  • it asks the same question twice;
  • it forgets a constraint from turn two;
  • it takes an irreversible action before collecting required information;
  • it keeps searching instead of asking a necessary clarification;
  • it reaches the right final answer through an unnecessarily long or unsafe path;
  • it behaves well only when the user supplies exactly the missing detail the first time.

To evaluate those behaviors, I want a second participant in the test: a simulated user that has its own private scenario state and responds to the agent turn by turn.

The simulated user is not the judge. That separation is important.

The example here is a recruitment application assistant that helps a candidate find a matching role and prepare an application, but must clarify location/visa constraints before recommending restricted jobs.

A scenario contains facts the agent has not seen yet

TypeScript
type UserScenario = {  id: string;  openingMessage: string;  privateFacts: Record<string, string>;  goals: string[];  constraints: string[];  userStyle: "concise" | "verbose" | "uncertain" | "impatient";  maxTurns: number;};

Example private state:

TypeScript
const scenario: UserScenario = {  id: "job-visa-01",  openingMessage: "Help me find a senior frontend role in Europe.",  privateFacts: {    currentCountry: "Pakistan",    needsVisaSponsorship: "yes",    preferredStack: "React, TypeScript, Next.js",  },  goals: ["receive at least one genuinely eligible recommendation"],  constraints: [    "do not claim a role supports sponsorship without evidence",    "the assistant should discover the visa constraint before treating EU-only roles as eligible",  ],  userStyle: "concise",  maxTurns: 10,};

The agent initially sees only the opening message.

The user simulator knows the private facts and reveals them when asked naturally. That lets us test whether the agent asks the right questions instead of handing it a perfectly complete prompt.

Keep the simulator's job narrow

The simulator should behave like the user in the scenario, not help the agent succeed.

A useful contract is:

TypeScript
type SimulatorInput = {  scenario: UserScenario;  conversation: ChatMessage[];  latestAgentMessage: string;};​type SimulatorOutput = {  userMessage?: string;  stop: boolean;  stopReason?: "goal-reached" | "agent-stuck" | "user-abandoned";};

The simulator prompt can instruct it to:

  • answer questions using only scenario facts;
  • not volunteer every hidden constraint immediately;
  • not invent new requirements;
  • stop when the user goal is satisfied or the conversation becomes clearly unproductive;
  • reflect the specified communication style.

I avoid telling the simulator the scoring rubric in detail. Otherwise it can steer the agent toward passing the test.

The harness owns the loop

TypeScript
async function runConversationEval(  scenario: UserScenario,  agent: AgentUnderTest,  simulator: UserSimulator,): Promise<ConversationTrace> {  const messages: ChatMessage[] = [    { role: "user", content: scenario.openingMessage },  ];​  for (let turn = 0; turn < scenario.maxTurns; turn += 1) {    const agentResult = await agent.respond(messages);    messages.push({ role: "assistant", content: agentResult.message });​    const simulated = await simulator.respond({      scenario,      conversation: messages,      latestAgentMessage: agentResult.message,    });​    if (simulated.stop) {      return {        scenarioId: scenario.id,        messages,        toolEvents: agentResult.trace.toolEvents,        stopReason: simulated.stopReason ?? "goal-reached",      };    }​    if (!simulated.userMessage) {      throw new Error("Simulator continued without a user message");    }​    messages.push({ role: "user", content: simulated.userMessage });  }​  return {    scenarioId: scenario.id,    messages,    toolEvents: [],    stopReason: "max-turns",  };}

In real code, tool events should accumulate across all turns rather than only the last result. I normally have the agent runner write into a run-level trace collector so the harness cannot accidentally lose them.

The maximum-turn boundary remains even when the simulator thinks the conversation should continue.

Score the trajectory after it finishes

The user simulator is an actor in the test. A separate evaluator scores what happened.

TypeScript
type TrajectoryScore = {  goalAchieved: boolean;  requiredClarificationsAsked: boolean;  unsafeActionCount: number;  repeatedQuestionCount: number;  unnecessaryTurns: number;  notes: string;};

Some dimensions can be deterministic.

If the trace shows an application submission tool was called before required fields existed, that is a hard failure. If the exact same clarification key was requested twice, count it. If a tool outside the allowed set ran, inspect the trace directly.

Semantic dimensions—whether the assistant understood a nuanced answer, for example—may need a calibrated judge or human review.

The key is that the judge sees the completed trajectory and the scenario rubric. The user simulator does not grade itself.

Represent clarifications structurally when possible

Free-form questions are harder to evaluate.

For workflows with known missing fields, the agent can emit a structured event alongside natural prose:

TypeScript
type ClarificationEvent = {  field: "visa-sponsorship" | "location" | "salary" | "start-date";  reason: string;};

The UI can still show:

Text
Do you need visa sponsorship for a role in Europe?

But the trace stores field=visa-sponsorship.

Now the evaluator can tell whether the agent requested the same field twice even if the wording changed.

This is a good example of using application structure to reduce dependence on another model judge.

Simulate imperfect users

A simulator that always answers precisely and immediately creates easy trajectories.

Real users say things like:

Text
Agent: Do you need visa sponsorship?User: Probably, yes. I'm not in the EU.

or:

Text
Agent: Which country are you targeting?User: Germany would be nice, but I'm open to Spain or remote too.

Scenario styles can test this without making every conversation adversarial.

I include cases where the user:

  • gives a partial answer;
  • changes a preference;
  • says “I don't know”;
  • corrects the agent;
  • asks a side question and then returns to the task;
  • becomes impatient after unnecessary clarifications.

The simulator should stay consistent with its private state while varying how directly it reveals it.

Python harness

Python
from dataclasses import dataclassfrom typing import Protocol​@dataclass(frozen=True)class Message:    role: str    content: str​@dataclass(frozen=True)class Scenario:    scenario_id: str    opening_message: str    private_facts: dict[str, str]    max_turns: int​class Agent(Protocol):    async def respond(self, messages: list[Message]): ...​class Simulator(Protocol):    async def respond(        self,        scenario: Scenario,        messages: list[Message],    ) -> tuple[str | None, bool]: ...​async def run_eval(    scenario: Scenario,    agent: Agent,    simulator: Simulator,) -> list[Message]:    messages = [Message("user", scenario.opening_message)]​    for _ in range(scenario.max_turns):        agent_result = await agent.respond(messages)        messages.append(Message("assistant", agent_result.message))​        user_message, stop = await simulator.respond(scenario, messages)        if stop:            return messages​        if user_message is None:            raise RuntimeError("Simulator returned no message")​        messages.append(Message("user", user_message))​    return messages

Again, production eval infrastructure should persist tool traces, token usage, latency, and model versions beside the messages.

Test memory by changing the topic briefly

A useful multi-turn case gives an important constraint early, moves away from it, then makes it relevant later.

For example:

Text
Turn 1: I need a role that sponsors a visa.Turn 3: Can you explain the company's frontend stack?Turn 6: Which of these jobs should I apply to first?

The final recommendation should still respect the visa constraint without asking again unless the earlier answer was ambiguous.

This catches context compaction and memory failures that a single-turn prompt cannot reproduce.

Test tool recovery across turns

Some failures require interaction:

  1. agent calls a company lookup tool with an ambiguous company name;
  2. tool returns two matches;
  3. agent should ask which one the user means;
  4. user answers;
  5. agent should reuse the resolved entity rather than search from scratch.

Another case:

  1. tool returns a transient failure;
  2. runtime exhausts its bounded retry;
  3. agent explains the limitation;
  4. user asks it to try a different path;
  5. agent selects an alternate tool without repeating the failed loop.

These trajectories exercise state and recovery policies together.

Simulated users can be too helpful

This is one of the biggest traps.

If the simulator sees the full expected solution, it may volunteer exactly what the agent needs at the perfect moment:

Text
By the way, I require sponsorship, prefer TypeScript, and can start immediately.

The test then measures whether the simulator can rescue the agent.

I give it private facts and behavior rules, not the ideal transcript.

For critical scenarios I manually inspect several generated conversations before trusting the suite.

Simulators can also be unrealistically difficult

An adversarial simulator that refuses to answer clear questions can make every agent look bad.

The scenario should define a cooperative user unless resistance is the behavior being tested.

I like to distinguish:

  • cooperative normal scenarios;
  • messy but realistic scenarios;
  • adversarial/security scenarios.

The overall product score should not be dominated by a synthetic user behaving in ways real users rarely do unless that behavior represents a genuine risk.

Keep model roles independent

If possible, I avoid using one identical prompt/model configuration for agent, simulator, and judge.

This is not because shared models automatically invalidate the test. It is because correlated behavior can hide weaknesses. The simulator may phrase information in a style the agent model finds unusually easy to understand, while the judge shares the same preferences.

Using different model families for at least some calibration runs, plus human review, gives a better sense of how much the benchmark depends on one model ecosystem.

Score efficiency as well as success

Two agents can both complete the task while one asks eight unnecessary questions and calls fifteen tools.

Trajectory metrics can include:

TypeScript
type EfficiencyMetrics = {  turns: number;  toolCalls: number;  repeatedToolCalls: number;  inputTokens: number;  outputTokens: number;  elapsedMs: number;};

I do not minimize these blindly. A safe clarification is worth an extra turn. The metrics help detect regressions such as “the new prompt completes 2% more tasks but doubles tool calls.”

Evaluate stop behavior

An agent should know when the job is done.

A surprisingly common trajectory bug is continuing after satisfying the request: offering more searches, re-checking already resolved state, or asking another question because the loop expects one more turn.

Scenarios should include clear completion conditions and the judge should penalize unnecessary continuation.

No-progress detection can help at runtime, but evaluation should reveal whether the planning policy frequently needs that safety net.

Replay the same scenario multiple times

Agent and user-simulator behavior are both probabilistic.

One successful trajectory does not tell you the success rate.

For a small critical set, I run several trials and track distributions:

Text
goal completion: 8/10unsafe action before clarification: 0/10median turns: 5p90 tool calls: 8repeated-question rate: 1/10

This is more informative than choosing the prettiest transcript.

Preserve failed trajectories as regression cases

When a run fails in an interesting way, store a sanitized trace and convert the underlying behavior into a scenario or deterministic assertion.

If the agent repeatedly forgets a location constraint after compaction, that should become a long-context trajectory test. If it submits before approval in one branch, add a hard trace assertion.

The multi-turn suite should grow from actual ways the workflow fails.

When a simulated user is unnecessary

If your task is one-shot classification or document extraction, adding another model to simulate conversation creates complexity without value.

Multi-turn simulation is useful when interaction is part of correctness: clarification, negotiation of constraints, recovery, memory, approval, or iterative tool use.

The important shift is to evaluate the *conversation as a process*, not only its last message.

Agents are workflows that happen to use language. If the test harness exercises only one request and one response, it misses much of the workflow.

KEEP READING

Related engineering notes