Skip to main content
Multi-turn conversation testing ensures your agent maintains context across multiple interactions. Use params.messages to establish conversation history and validate the agent’s response to the final message.

Example

This example demonstrates how to test multi-turn conversations by passing a full conversation history via params.messages and validating that the agent uses context appropriately.

Eval Configuration

evals.yaml

Agent Implementation

agent.py

Running Evaluations

How It Works

  1. Conversation History: The params.messages array establishes the full conversation history, including previous user messages and assistant responses.
  2. Context Usage: The agent receives the entire conversation history, so it can remember what was said in previous turns and answer accordingly.
  3. Output Validation: The output validator checks that the agent’s response contains the expected content (e.g., “yes” for the umbrella question).
  4. Sequence Validation: The seq! validator ensures the agent only calls llm and doesn’t unnecessarily call get_weather again, since the weather information is already available in the conversation history.

Evaluation Results

Successful Validation

When the agent remembers context and provides the correct response:

Failed Validation

When the agent doesn’t use context or provides an incorrect response:

Key Features

  • Conversation History: Use params.messages to establish full conversation context
  • Context Memory: Agents receive the entire conversation history and can remember previous interactions
  • Sequence Validation: Use seq! to verify agents don’t call tools unnecessarily when context is available
  • Response Continuity: Ensure agents build logically on previous interactions