Skip to main content
Multi-turn online evaluators allow you to evaluate entire conversations between a human and an agent, not just individual exchanges. They measure end-to-end interaction quality across all turns in a thread.
To use a LangChain-managed, thread-level judge without configuring a model, API key, or prompt, see LangChain Tuned Evaluators.
To score threads with your own Python or JavaScript code instead of an LLM, use an advanced code evaluator. For more information, see Evaluate threads. You can use multi-turn evaluations to measure:
  1. Semantic Intent: What the user was trying to do.
  2. Semantic Outcome: What actually happened, did the task succeed.
  3. Trajectory: How the conversation unfolded, including trajectory of tool calls.
Online evaluators extend trace retention by default. You can opt out for an individual evaluator when the agent environment uses base retention. Other actions can still extend those traces. If extended retention is disabled for the workspace, evaluations continue without new retention upgrades, regardless of saved environment defaults.

How it works

Multi-turn online evaluators follow this evaluation lifecycle:
  1. Trace ingestion: Each turn in a conversation is traced as a separate run and associated with a thread using a shared thread ID.
  2. Idle time detection: After the last trace in a thread is ingested, LangSmith waits for the configured idle time to elapse. This idle period signals that the conversation is complete and ready for evaluation.
  3. Message assembly: LangSmith collects the messages from each trace in the thread and assembles them into a single conversation history. If each trace contains only the latest message, LangSmith stitches messages together across turns. If each trace contains the full history, LangSmith uses that directly. Because consecutive traces in a thread often resend prior history, LangSmith deduplicates overlapping messages so each one appears only once. The result is a single list of messages in OpenAI chat format ({"role": ..., "content": ...}), which is what the all_messages variable in your prompt resolves to.
  4. LLM-as-a-judge evaluation: The assembled conversation is passed to your configured LLM-as-a-judge prompt. The evaluator scores the full thread based on your criteria: semantic intent, outcome, or trajectory.
  5. Feedback recording: The evaluator writes feedback to LangSmith using the feedback key you configured, associated with the thread.
This lifecycle means that multi-turn evaluators run once per completed thread, not once per trace. Use run-level online evaluators if you want per-trace evaluation.

Prerequisites

  • Your agent environment must be using threads.
  • The top-level inputs and outputs of each trace in a thread must have a messages key that contains a list of messages. We support messages in LangChain, OpenAI Chat Completions, and Anthropic Messages formats.
    • If the top-level inputs and outputs of each trace only contain the latest message in the conversation, LangSmith will automatically combine messages across turns into a thread.
    • If the top-level inputs and outputs of each trace contain the full conversation history, LangSmith will use that directly.
If your traces don’t follow the format above, thread level evaluators won’t work. You’ll need to update how you trace to LangSmith to ensure each trace’s top-level inputs and outputs contain a list of messages.Please refer to the troubleshooting section for more information.

Configuration

To create a multi-turn online evaluator:
  1. Select your agent, go to Tracing, and select the environment.
  2. Click the Online Evaluators tab, then click + Evaluator, and select LLM-as-a-Judge Evaluator under Create from scratch.
  3. Name your evaluator.
  4. Select Threads under Trigger On, or under Source if the panel shows the filter builder instead of a search bar.
  5. Apply Filters or a Sampling Rate. Use filters or sampling to control evaluator cost. For example, evaluate only threads under N turns or sample 10% of all threads. The filter controls depend on which experience the panel shows:
    • Search bar (Trigger On): If trajectory evaluators are available, or the evaluator uses the trajectory variable, Threads shows a filter builder with only the Is Trace, Run Name, Run Type, and Metadata fields. Otherwise, Threads shows the search bar. Refer to Filter threads with the search bar.
    • Filter builder (Source): Filter on Trace Count to limit thread length. If the evaluator uses the trajectory variable, the builder offers only the Is Trace, Run Name, Run Type, and Metadata fields.
  6. Configure the remaining settings:
  7. Click Create. Your evaluator appears in the Online Evaluators tab. You can test it once the idle time has passed for any new threads created after that.

Check the idle time

Under Advanced, Thread Idle Time shows the environment’s idle time: the amount of time after the last trace in a thread before it is considered complete and ready for evaluation. This value should reflect the expected length of user interactions in your app. The idle time defaults to 10 minutes and cannot be set below 2 minutes.
The idle time is set on the agent environment. It applies to every thread-level evaluator on that environment and to every automation rule whose item type is Threads. To change it, click the Edit tracing settings icon next to the value or on the environment’s Tracing page.
When first testing your evaluator, use a short idle time so you can see results quickly, subject to the 2-minute minimum. Once validated, increase it to match the expected length of user interactions.

Configure your model

Select the provider and model for your evaluator. Threads tend to get long, so use a model with a large context window to avoid running into limits. For example, OpenAI’s GPT-5.4 mini and Gemini 2.5 Flash both have 1M+ token context windows.

Configure your LLM-as-a-judge prompt

Define what you want to evaluate. The evaluator applies this prompt to the thread. You can also configure which parts of the assembled conversation the all_messages variable passes to the evaluator:
  • All messages: Send the full conversation as a list of JSON message objects in OpenAI chat format ({"role": ..., "content": ...}), with each message rendered as indented JSON and separated by a blank line.
  • Human and AI pairs: Send only user and assistant messages, formatted as <user>...</user> and <assistant>...</assistant> and excluding system messages, tool calls, and other roles.
  • First human and last AI: Send only the first user message and the last assistant reply.

Set up your feedback configuration

Configure a name for the feedback key, the format for the feedback you want to collect and optionally enable reasoning on the feedback.
Using the same feedback key for a thread-level evaluator and a run-level evaluator is not recommended as it can be hard to distinguish between the two.
When Threads shows a search bar, each filter condition applies to the scope you choose in the scope selector. This happens where trajectory evaluators are not available, and for LangChain Tuned Evaluators. The search bar offers three scopes:
  • Thread: Matches attributes of the thread as a whole, such as turn_count, total_tokens, total_cost, thread_duration, and num_errored_turns. For the full list, refer to Thread fields.
  • Root run: Matches the entry run of each trace in the thread.
  • Any run: Matches any run in the thread.
For example, to evaluate only threads with fewer than 10 turns, click + Filter and add turn_count:<10 in the Thread scope. To also require a failed tool call, click the Add filter scope icon at the right of the search bar and add run_type:tool AND status:error in the Any run scope. Rows combine with AND. For the syntax, refer to Query syntax. A filter in the Thread scope turns off backfill for the evaluator, so the evaluator applies only to new threads. When you open a thread-level evaluator whose filter uses the filter builder syntax, LangSmith converts its Trace Count conditions to turn_count clauses in the Thread scope, and its other conditions to the Any run scope. This works when the conditions are joined with AND. A filter that mixes Trace Count with other conditions using OR or NOT is not converted, and the evaluator keeps the filter builder with the original filter intact.

Evaluate trajectories

trajectory is one of the variables a thread evaluator can use, alongside all_messages, human_ai_pairs, and first_human_last_ai. It resolves to the trajectory of the conversation: the flat, ordered list of messages from start to finish, including tool calls and their results. Use it to score the path an agent took, such as whether it picked the right tools, followed its plan, and got there without wasted steps.
On LangSmith Cloud, the trajectory variable is available in the GCP US, GCP EU, GCP APAC, and AWS US regions.On BYOC, the trajectory variable is available on data planes that store and query traces in SmithDB.Self-hosted installations support the trajectory variable on LangSmith v0.17 or later, after you switch queries to SmithDB. See SmithDB feature availability.
The variables differ in what the judge receives:
  • all_messages, human_ai_pairs, and first_human_last_ai resolve to the conversation assembled from the inputs and outputs of each root run in the thread. Work that happens in child runs, such as intermediate model calls, tool calls, and tool result, is not included unless a root run’s own inputs or outputs contain it. human_ai_pairs and first_human_last_ai narrow further to user and assistant messages only.
  • trajectory resolves to the trajectory built from the model and tool calls inside each trace. The tool calls and tool results the other views omit are preserved.
For the message shape each variable resolves to, see Thread message variables.
A trajectory is typically larger than any of the other views, because it encompasses both root and child runs. Choose a model with a high context window, as described in Configure your model, and expect higher token usage per evaluation.

Use the trajectory variable

Follow the configuration steps above. Two things change:
  1. Under Trigger On, select Threads. The variable is available only on an evaluator that runs on an agent environment, not on a dataset.
  2. Reference {{trajectory}} in your prompt and map that variable to the trajectory source. The variable must be named trajectory: a differently named variable pointed at that source is rejected. The seeded default prompt and mapping already do this, so a new evaluator needs no changes here.
Switching Trigger On between Runs and Threads reseeds the default prompt only while you have not edited it. Once you edit the prompt, your version is kept, and you map the variables yourself. {{trajectory}} cannot appear alongside {{all_messages}}, {{human_ai_pairs}}, or {{first_human_last_ai}}. Once you map the trajectory source, the other sources are disabled in the variable source dropdown, and once you map one of the others, the trajectory source is disabled. Either way, the dropdown explains that trajectory variables and non-trajectory variables cannot be used together. Saving an evaluator that mixes them fails the same way. When the evaluator completes, LangSmith writes feedback to the most recent root run in the thread, under the feedback key you configured, and associates that feedback with the thread. To find it later, see View feedback. For a complete prompt you can adapt, see Example with trajectory context.
The choice is fixed when you create the evaluator. To move an existing evaluator between trajectory and the other thread variables, delete it and create a new one.

Settings and constraints

An evaluator that uses trajectory supports the following settings:
  • Filters: Limit which threads the evaluator runs on, using the filter builder.
  • Sampling rate: Evaluate a percentage of the threads that match your filters.
  • Idle time: The agent environment’s thread idle time, which applies to every thread-level evaluator on that environment.
The following options are not available, and a configuration that includes one is rejected:
  • Datasets and experiments as a source.
  • Backfill over existing threads.
  • Few-shot examples, extended stats, and dataset corrections.
  • Code evaluators on the same automation rule, and non-evaluator actions such as adding threads to an annotation queue.
A trajectory is not a run, so any option that reads run-level fields is unavailable.

Limits

These are the current limits for thread-level processing (subject to change). They apply to multi-turn online evaluators and to automation rules whose item type is Threads. Reach out if you are running into any of these limits.
  • Runs must be less than one week old: When a thread becomes idle, only runs within the past 7 days are eligible for evaluation.
  • Maximum of 500 threads processed at once: A single execution processes at most 500 matching threads, ordered by most recent activity.

Troubleshooting

Checking the status of your evaluator To check when your evaluator last ran, open the agent environment’s Online Evaluators tab on the Tracing page and click Logs in your evaluator’s row to view its run history. Inspect the data sent to the evaluator To inspect the data sent to your evaluator, open the agent environment’s Online Evaluators tab on the Tracing page, click your evaluator, and click the Traces tab. The tab shows traces only if you turned on tracing for the evaluator. New evaluators start with tracing turned off. In this tab, you can see the inputs passed into the LLM-as-a-judge evaluator. If your messages are not being passed in correctly, you will see blank values in the inputs. This can happen if your messages are not formatted in one of the expected formats.