Evaluating multi-turn chat conversations with promptfoo

Learn how promptfoo tests chatbots across a whole conversation, with message formats, history, conversation-relevance scoring and stateful targets, and what to plan before you build.

On this page

Why single-prompt evals miss chatbot regressions

promptfoo supports chat conversations and multi-turn threads in evals, and its conversation-relevance assertion checks whether responses stay relevant across a multi-turn dialogue. That matters because a chatbot can pass every single-prompt test and still drift over five or ten turns: it forgets a constraint the user stated early, answers a question the user already withdrew, or loses track of which booking field is still missing. A suite built only from isolated prompts never exercises those failures, so the regression reaches users before the eval suite reports it.

Teams need multi-turn evals when the bot's correct behavior depends on earlier turns. Typical cases include support bots that must carry a customer's account context through a troubleshooting thread, assistants that rely on memory of earlier instructions, and booking or intake flows where each answer determines which question comes next. In each case, the test must be a sequence of user and assistant messages with the history the target will actually see, not a single prompt with the earlier context pasted in.

Writing these tests is a design task, not just a config file. Someone has to decide which conversations represent real user paths, which turn carries the behavior being checked, how much history the target receives, and what counts as drift for each flow. Your team should confirm how the target application accepts conversation history (for example, whether it expects a message array or manages state on the server) before choosing a test format, because that choice determines whether the eval measures the product or a simplified copy of it.

Which conversation test pattern fits your chatbot

Scripted tests replay a fixed sequence of user turns and check the assistant's reply at chosen points. Your team writes the transcript in advance, including earlier assistant turns when the test needs them, so every run sends the same messages to the model. This pattern suits known flows such as collecting a booking date after a greeting, or refusing a request after a policy question. Reproducibility is high because the inputs do not change between runs. The trade-off is coverage: the test only exercises paths someone wrote down, and fixed earlier assistant turns may no longer match what the bot would say today.

  • Known flows: cover onboarding, escalation and refusal paths as named turn sequences.
  • Inputs you own: keep transcripts in version control so reviewers can see exactly what changed.
  • Low grading cost: deterministic assertions such as contains or regex can check turns without a grader model.
  • Coverage limit: untested paths stay untested, and the test cannot follow the conversation if the bot drifts from the script.
  • Stale history: refresh the fixed assistant turns whenever the flow or the prompt changes.

Check whether your riskiest flows exist as written transcripts, and whether each checked turn has an assertion that would fail if the answer went wrong.

Multi-turn configuration options and when each fits

This table compares the four configuration choices that shape a multi-turn eval: message-format prompts, multi-turn threads, the conversation-relevance assertion and stateful versus stateless targets. Read each row against the conversation your chatbot actually holds, then confirm exact syntax in the chat and conversation-relevance documentation before writing tests.

OptionWhat it controlsWhen it fitsTrade-off
Message-format chat promptsSends a structured list of role-tagged messages to the model instead of one flat prompt stringThe application already builds requests from system, user and assistant messages and you want tests to match that shapeTest authors must keep message lists accurate, and a flat prompt can hide errors in how history is assembled
Multi-turn threadsRuns a sequence of user turns within one test so later turns depend on earlier repliesBehavior depends on context, such as follow-up questions, corrections or task hand-offs across several turnsEach turn adds model calls and cost, and failures are harder to pin to one message
Conversation-relevance assertionScores whether the assistant's replies stay on topic across the whole dialogueYou need to catch drift, where replies stop addressing what the user asked over several turnsIt is model-graded, so results vary with the grader model and should be checked against a sample of human judgments
Stateless targetsEach request carries the full history, and the provider holds no session stateThe chatbot receives all context in every call, which is typical of direct model APIsLong histories increase token use, and tests must include the history each time
Stateful targetsThe application or provider keeps session state between turns, identified by a session or conversation IDYour product stores memory server-side, so tests must reproduce real session behaviorTest runs can leak state between cases, so isolation and session reset must be confirmed in your setup

What conversation-relevance scoring can and cannot tell you

The conversation-relevance assertion tells you whether replies stay on topic across a dialogue. It says nothing about whether those replies are true, safe or complete, so the cards below cover what the score measures, what it misses and what to pair it with.

Relevance drift across turns

The assertion is adapted from the DeepEval turn relevancy metric, so it looks at whether each assistant reply still addresses what the user has asked across the thread. A bot can answer every turn fluently and still drift away from the original goal by turn six. Build test threads that change topic, return to an earlier question and add a correction, then read the per-turn results rather than only the overall pass or fail.

Conversation relevance docs

Relevance is not factual accuracy

A reply can be fully on topic and still state a wrong price, policy or date. The relevance grader judges whether the answer fits the conversation, so a confidently wrong but on-topic answer can pass. For factual claims, add a reference-based factuality check or a context-faithfulness check against the source material your bot is meant to use.

Safety and task completion are separate

A relevant reply may still leak personal data, skip a required disclosure or refuse a legitimate request. Relevance scores cannot show whether the user finished what they came to do, such as booking a change or resolving a dispute. Write explicit assertions for the outcome of each scenario, for example a check that the final turn contains a confirmation reference, and use separate safety tests for disallowed content.

Grader model choice

The relevance check is model-graded, so the score depends on which model acts as grader and how it is prompted. Use a grader that is separate from the chatbot under test, and confirm the grader's configuration in your promptfoo setup. Re-run a sample of scored threads by hand before trusting the scores, because a grader that favors long replies will reward padding.

Threshold setting

A pass threshold turns a relevance score into a gate, and the threshold you choose decides how many borderline threads fail. Set it from a labeled set of good and poor conversations written by your domain experts, not from a number that looks reasonable. Track the score distribution across releases so a sudden shift shows up even when no single thread crosses the line.

Complementary assertions

Conversation relevance works best beside deterministic checks such as contains, regex or is-json on the fields your flow must produce, and beside rubrics for tone or policy wording. Each assertion covers a different failure, so a suite with only one kind leaves gaps. Map each failure you care about to an assertion before you decide the suite is complete.

How to set up a multi-turn eval suite

This sequence takes a team from an empty promptfoo project to a repeatable suite of scripted conversations that is scored for relevance and deterministic rules, with transcripts reviewed by a person. The result is a suite you can rerun after each change to the chatbot.

  1. Install promptfoo and confirm the runtime

    The engineer running the suite installs the promptfoo npm package in a project directory. The npm release 0.124.1 requires Node.js 22.22.0 or newer, so check the Node version first with node --version and upgrade it if needed. Confirm the install by running promptfoo --version and by generating a starter config with promptfoo init. The step is complete when the CLI prints a version and the starter config file exists in the project.

  2. Write a small set of scripted conversations

    Write three to five conversations that match real user journeys, such as a refund request that needs a follow-up question, or a user who changes their mind mid-thread. Each conversation is a list of user and assistant turns in the chat message format described in the promptfoo chat documentation, so the earlier turns set up the context the final turn depends on. Keep the scripts in version control next to the config. The step is complete when each conversation loads in promptfoo without a format error and the test count matches the number of conversations you wrote.

  3. Choose a target that matches production

    Point the provider at the same model, system prompt, and retrieval settings your chatbot uses in production, or at the application endpoint itself if that is where the logic lives. A target that differs from production, such as a different system prompt or a larger model, will produce results you cannot attribute to the release you are testing. Ask the application owner to confirm which model version and prompt are live. The step is complete when a single test run returns an answer that matches what the production chat returns for the same opening message.

  4. Confirm history is passed on each turn

    Before adding assertions, verify that the target receives the full conversation history on every turn, not only the latest user message. Run one conversation and open the output for the final turn, then check that it references facts from earlier turns. If the answer ignores earlier context, the target is probably being called statelessly, which is a configuration or endpoint issue to fix before grading. The step is complete when a deliberately context-dependent question is answered correctly in the final turn.

  5. Add conversation-relevance and deterministic checks

    Add a conversation-relevance assertion to check whether replies stay on topic across the dialogue. This assertion is adapted from the DeepEval turn relevancy metric, and the promptfoo conversation-relevance documentation describes how it grades. Pair it with deterministic checks such as not-contains for forbidden phrases, regex for required formats, or javascript for business rules, because these checks are cheap and stable. The step is complete when a deliberately off-topic reply fails the relevance check and a clean reply passes both kinds of assertion.

  6. Run the suite and save the results

    Run the suite with promptfoo eval and write the results to a file or the web viewer so the run can be compared later. Keep the same config and conversation set between runs when you want to measure a change, and record the model version and prompt version alongside the output. Ask the team to confirm which model and prompt each run used, since a result without that record cannot be compared with another. The step is complete when a second run on an unchanged build produces the same pass and fail results as the first, within the normal variation of a model grader.

  7. Review transcripts and tune the assertions

    Open the full transcripts for failed and passing conversations, not only the pass and fail counts. Look for cases where a check failed on a reasonable answer, or passed on a weak one, and adjust the rubric, the threshold, or the deterministic rule accordingly. A person who knows the product should sign off on the transcripts before the suite is used as a release gate. The step is complete when the reviewer agrees that failures reflect real defects and that the passing transcripts meet the product's standard.

How a multi-turn test flows through promptfoo

The run starts in a test case that holds a scripted list of user turns. For each turn, promptfoo appends the user message to the conversation history, sends the full history to the chatbot under test, and stores the reply before the next turn begins. Once the script ends, the assertions grade the whole transcript, including the conversation-relevance check, and the results are written locally. The subgraph marks the line between the local promptfoo run and the application or model provider, so check which side each request crosses and what history the target actually receives.

Scripted turns build history, then assertions grade the full transcript.

Security and data handling for conversation transcripts

Conversation transcripts often contain customer data, account details and session credentials, so the eval setup needs the same data handling review as production. The cards below cover where transcripts travel, how to redact fixtures, how stateful targets get credentials and how the self-hosted server fits into that picture.

Local runs keep transcripts on your machine

promptfoo runs evals on the machine where you start it and talks directly to the LLM. For multi-turn tests, that means every transcript, system prompt and tool output is sent only to the provider you configure for the target and grader. Before running an eval on real conversations, confirm which providers receive the messages, including any model used as a grader, and whether each one's retention and training terms fit your policy.

promptfoo introduction

Redact real conversations before using them as fixtures

Chat logs copied from production usually hold names, account numbers, addresses and health or payment details. Replace identifying values with stable placeholders so multi-turn tests still hold references across turns, for example the same fake account ID in turn one and turn four. Keep the redaction script in version control so fixtures can be regenerated, and treat the original transcripts as out of scope for test repositories and CI logs.

Keep credentials for stateful targets out of configs

A stateful target, such as a chatbot that issues session tokens or calls a backend with a user login, needs credentials during the eval. Pass them through environment variables or your secrets manager, not inline in the promptfoo configuration committed to the repository. Use a dedicated test account with limited permissions, and rotate its credentials when the suite changes hands.

Self-hosted server is not a production store

The self-hosted promptfoo app stores data in a local SQLite database that cannot be shared across replicas. It has no RBAC, no horizontal scaling, and no built-in authentication or SSO, and the documentation does not recommend it for production use. If a team wants shared results containing transcripts, put the server behind your own access controls and confirm which edition, such as Enterprise with SSO, fits that need.

Self-hosting docs

Limit who can see stored results

Eval outputs include the full conversation, model replies and grader reasoning, so they can expose the same data as the original logs. Decide who can open result files, web UI sessions and exported reports, and remove transcripts from shared artifacts once a run is reviewed. Ask your team to confirm where CI stores eval artifacts and how long they stay there.

Questions teams ask before building multi-turn evals

How much effort does a multi-turn promptfoo suite take to build?

Effort depends mostly on how many conversation flows you need to cover, how complex the target is, and where the transcripts come from. A suite for a few well-defined flows against a stateless endpoint is a small job. A suite covering many branches, tool calls, account-specific context and multi-session memory takes considerably more design and review time. The main drivers are the number of flows, whether the target keeps state between turns, and whether you must write each transcript by hand or can derive it from logs you already hold. Ask any partner to break the estimate down by flow, target behavior and transcript source, so you can see which part you could take on yourself.

Can our internal team build multi-turn evals without a partner?

Often yes, if at least one engineer already runs promptfoo or similar tests and understands how your chatbot manages history. The configuration format is documented, and the core work of writing realistic conversations and reviewing grader output is familiar to QA and application teams. Teams usually struggle in three places: deciding what a good conversation looks like across turns, keeping stateful targets isolated between test runs, and tuning the grader so it does not pass weak answers. Name an owner for each of these before you start. A partner is most useful when those decisions are blocking the team or when the suite must be ready for a review by a compliance or security group.

How long does a multi-turn eval project take?

Duration is set by the scope agreed in writing, not by a fixed template. The main factors are the number of flows, how many targets or environments the suite must run against, whether you need a staging endpoint prepared, and how many rounds of review your team wants before sign-off. A first suite for one chatbot usually moves faster than one that must also feed a CI pipeline and a shared results view. Ask for a schedule with milestones tied to deliverables, and confirm which of your teams must approve each stage, since review queues often add more time than the build itself.

What do we need to provide before the work starts?

Three inputs matter most. First, test transcripts: real or anonymized conversations that show how users actually talk to the bot, including failed sessions and escalations. Second, a staging endpoint that behaves like production and accepts multi-turn requests, ideally with test accounts and data that cannot reach customers. Third, access to a grader model, which is the model that scores responses for conversation relevance or rubric checks. Confirm with your security team how transcripts are anonymized and where the grader runs, because the grader receives full conversation text. Also confirm who owns the staging environment and how long test accounts remain valid.

Is promptfoo free to use for multi-turn evals?

The promptfoo Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support. Multi-turn chat configuration and the conversation-relevance assertion are part of the evaluation features, so they are covered by the free edition. promptfoo is also licensed under the MIT license. Enterprise adds team sharing, SSO, role-based access, continuous monitoring and priority support with SLAs, and its pricing is custom. Enterprise On-Premise runs that functionality in your infrastructure. Your model provider charges for grader and target calls, so budget for that separately.

Which costs recur after the suite is delivered?

The promptfoo software itself carries no license fee in the Community edition, so recurring costs come from elsewhere. Expect ongoing charges for model calls, since each run sends the full conversation to the target and often to a grader. Those charges grow with the number of flows, turns per flow and runs per day. Staging infrastructure and test account upkeep also recur. Maintenance matters too: when your chatbot's prompts, tools or policies change, transcripts and expected behaviors need updating. Ask any partner whether maintenance is included in the fixed scope or offered as a retainer, and ask what happens to the suite when you upgrade promptfoo.

What breaks most often in multi-turn evals?

The most common failures are stateful leakage and grader drift. If test runs share a session or database, earlier conversations change the results of later ones, so a passing run may mean nothing. Grader drift happens when the judge model changes behavior or is swapped without rerunning baselines. Transcripts also go stale when the product changes. Check that each test starts from a clean session, pin the grader model version where your provider allows it, and rerun a known-good baseline after every change to the suite or the target. Review failing turns individually before blaming the chatbot.

Official promptfoo documentation for conversation tests

Two official promptfoo pages cover the material in this guide in more depth, and they are the best next reads before you write your first multi-turn suite. The first is the chat conversations documentation, which explains how promptfoo represents a multi-turn thread in a test case, how the message roles are structured, and how earlier turns are carried into later ones. Read it when you need the exact shape of a conversation test, including how to pass prior messages so the target sees the same history your production chatbot would see. You can find it at promptfoo docs: Chat conversations.

The second is the conversation-relevance documentation, which describes the model-graded assertion that checks whether each response stays on topic across a dialogue. It covers how the grader scores relevance over the full thread, how it is adapted from the DeepEval turn relevancy metric, and how its results are read. Read it before you set thresholds, because the grader's output depends on the conversation you give it and on the judge model you configure. Confirm the current options, default grader and any judge settings in the page itself, since assertion configuration can change between releases. You can find it at promptfoo docs: Conversation relevance.

How DeployOpen scopes and delivers conversation evals

DeployOpen plans, builds and hands over promptfoo conversation eval suites inside the infrastructure you control. Each engagement starts from a written scope that describes the conversations under test, the target chatbot, and the evidence your team needs to review.

How we scope

  • We agree in writing which conversation flows, turn counts and failure modes the eval suite will cover.
  • We confirm how the chatbot target receives message history, and whether it is stateless or keeps session state on its side.
  • We list the assertions to use, such as conversation-relevance checks, and which judge model grades them.
  • Engagements are fixed-scope, with deliverables and timelines agreed before work starts.

How we build

  • We write chat-format test cases that carry full message history, so each turn is judged in context.
  • We connect promptfoo to your chatbot endpoint and confirm that session identifiers persist between turns.
  • We combine deterministic checks with model-graded conversation-relevance assertions to keep runs stable and affordable.
  • We run the suite against known-good and deliberately broken conversations to confirm that the grader catches regressions.

How we hand over

  • You receive the promptfoo configuration, test datasets and the scripts that run the suite locally or in your pipeline.
  • We document how each assertion is graded, which threshold blocks a release, and how to add new conversation scenarios.
  • We walk your engineers through reviewing results and investigating failed conversations.
  • Handover covers the self-hosting option you chose, with its single-instance limits stated in the documentation.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Retainers can cover updates to the promptfoo release you run, for example when a new Node.js requirement applies.
  • We can extend the suite as your chatbot adds tools, languages or new conversation types.
  • Ask your quote to name who maintains the judge model settings and who reviews drift in grading over time.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.