Skip to main content

The Challenge

When testing multi-turn agent conversations, teams often model tests as scripted dialogues:
The problem: agent responses are non-deterministic. The agent might take a valid but different path:
The agent’s response is correct—it’s asking for confirmation—but the rigid test script breaks because it expected a different flow. This guide covers two approaches to solve this problem.

Approach 1: User Simulation Agent

Instead of testing exact conversation paths, test whether the agent achieves the intended outcome.

How It Works

  1. Define the test by its goal, not its transcript
  2. Use an LLM to simulate the user dynamically, adapting to whatever the agent responds
  3. Evaluate the outcome against your success criteria

Implementation

Example Usage


Approach 2: Turn-by-Turn Evaluation

If you have a reference conversation flow, you can test your agent’s ability to respond appropriately at each stage by progressively replaying the conversation and evaluating each response independently. Key difference from Approach 1: Instead of letting the conversation evolve naturally (where the agent’s response affects the next user message), this approach uses a fixed sequence of user messages from a reference transcript. This allows you to test each turn independently without compounding effects.

How It Works

  1. Take a reference transcript showing the desired conversation flow
  2. At each user message, generate a fresh response from your agent given the conversation history so far
  3. Evaluate the generated response against your criteria
  4. Use the reference assistant response (not your agent’s response) for the conversation history when testing the next turn
  5. Aggregate scores across all turns

Implementation

Example Usage

Turn-Specific Criteria

Different turns may have different expectations. You can specify criteria per turn and allow for multiple correct behaviors:
Adding multiple criteria allows you to specify that clarifying, acknowledging, or directly answering are all acceptable behaviors.

Combining with Agent Tracing

For comprehensive testing, combine either approach with Agent Tracing to capture detailed execution data: