How LangChain builds the evals for Deep Agents

How LangChain builds the evals for Deep Agents
3sources of tests: dogfooding, external benchmarks and hand-written tests
7categories, based on what each test measures
5metrics per run: correctness, steps, tool calls, latency and solve rate
8 s / 14 sideal trajectory versus a correct but slow one (illustrative example)
How LangChain builds the evals for Deep Agents
I also explain it in this video, on my channel Articulator EN.

Every eval pushes the agentlink

Deep Agents is an open source, model-agnostic agent harness: it works with any model. It powers LangChain products like Fleet and Open SWE. To improve it, the team has been curating evals: tests that check whether the agent does its job well.

The article's starting point is that every eval is a vector that shifts the behavior of the system. If a test for efficient file reading fails, you'll probably tweak the system prompt or the description of the read_file tool until it passes. Every test you keep applies pressure on the whole system, and that pressure adds up over time.

Every evaluation is a vector that pushes the agent's behavior in one direction.
Every test you keep pushes the agent in one direction.

That's why you need to be careful about which tests you add. It's tempting to throw in hundreds, or thousands, without looking, and that creates an illusion: the agent scores better and better on a suite that may not reflect what matters in production. In the article's words: more evals ≠ better agents. What works is targeted tests that reflect the behaviors you want in production.

Instead of running whole benchmarks and keeping the aggregate, they follow three steps:

  1. Decide which behaviors they want, like retrieving content spread across several files or chaining five or more tool calls, and find tests that measure them in a verifiable way.
  2. Document each test with a docstring that explains which capability it measures, and tag it with categories like tool_use so tests can run in groups.
  3. Read the output traces to understand failure modes and adjust coverage.

Every run is traced to a shared LangSmith project, so anyone on the team can jump in to analyze a failure, fix it, or rethink whether a test is still worth keeping: responsibility is shared. And there's a cost reason too: running many models on many tests gets expensive, and targeted tests save money while improving the agent.

Where the tests come fromlink

The tests come from three places:

  1. Dogfooding: using their own agents every day.
  2. External benchmarks, like Terminal Bench 2.0 or BFCL, where they pick tasks and often adapt them to a particular agent.
  3. Artisanal tests, written by hand for the behaviors they consider important.
The three sources of tests: dogfooding, external benchmarks and hand-written tests.
Three sources of tests.

Since they use their agents every day, every mistake is an opportunity: write a test and update the agent definition and its context engineering. The article shows a real case in Slack: Harrison Chase tells their bot it's wrong about LangChain middleware, and the bot admits it had oversimplified. That kind of failure is exactly what a test is made of.

To find failures, what helps most is traces: the data on how the agent behaves. Since they're often huge, they analyze them with another agent, like Polly or Insights, inside LangSmith. You can do the same with other agents, like Claude Code or the Deep Agents CLI, plus a way to pull down traces, like the LangSmith CLI. The goal is to understand each failure mode, propose a fix, rerun the agent, and track progress and regressions over time.

Traces, analyzed by another agent to find the failures.
Understand the failure, propose a fix, rerun and watch for regressions.

One example is Open SWE, their open source background coding agent. According to the article, a large fraction of their bug-fix pull requests now go through it. Teams using it touch many different codebases, each with its own context, conventions and goals, which naturally leads to mistakes. Since every interaction is traced, each mistake can easily become a test so it doesn't happen again.

Other tests are pulled from benchmarks and adjusted, like BFCL for function calling. For coding, they integrate with Harbor to run selected Terminal Bench 2.0 tasks in sandboxed environments. And many are written from scratch: focused tests that watch one isolated behavior, like using the read_file tool properly.

An important distinction: the SDK's unit and integration tests (system prompt passthrough, interrupt config, subagent routing) are kept separate. Any model passes them, so including them in the score adds no signal. You should absolutely write them, but the article focuses only on evals that measure model capability.

Group them by what they measurelink

A taxonomy helps: a middle view of how the agent performs, neither a single number nor a pile of individual runs. The advice is to group tests by what they test, not by where they come from. If you tag tasks from FRAMES and BFCL as "external benchmarks", you won't see that one set measures retrieval and the other measures tool use.

These are their categories:

  • file_operations: file tools (read, write, edit, ls, grep, glob), parallel invocation and pagination.
  • retrieval: finding information across files, search strategies and multi-hop document synthesis.
  • tool_use: selecting the right tool, chaining multi-step calls and tracking state across turns.
  • memory: recalling seeded context, extracting implicit preferences and persisting durable info.
  • conversation: asking clarifying questions for vague requests and sustaining multi-turn dialogue with correct actions.
  • summarization: handling context overflow, triggering summarization and recovering info after compaction.
  • unit_tests: SDK plumbing, kept apart from the rest.
The Deep Agents test categories, each with its own color.
Seven categories, based on what each test measures.

Today every test is an end-to-end run of the agent on a task, and they deliberately keep the structure diverse: some finish in a single step from the input prompt, while others take more than ten turns, with another model simulating the user.

Correctness first, then efficiencylink

When choosing a model for the agent, they start with correctness. If a model can't reliably complete the tasks that matter, nothing else counts. How it's measured depends on the test:

  • Most internal tests use custom assertions, like "did the agent parallelize its tool calls?".
  • Benchmarks like BFCL use an exact match against the dataset's ground truth.
  • When correctness is semantic, like whether the agent saved the right thing to memory, they use LLM-as-a-judge.

Once several models clear that bar, they move to efficiency. Two models that solve the same task can behave very differently: one might take extra turns, make unnecessary tool calls, or move more slowly because of its size. In production, that shows up as higher latency, higher cost and a worse user experience.

On every run they measure five things:

  • Correctness: whether the model completed the task correctly.
  • Step ratio: observed agent steps / ideal agent steps.
  • Tool call ratio: observed tool calls / ideal tool calls.
  • Latency ratio: observed latency / ideal latency.
  • Solve rate: expected steps / observed latency, with a score of 0 if the task wasn't solved.
The five metrics: correctness, step ratio, tool call ratio, latency ratio and solve rate.
One correctness metric and four efficiency metrics.

Solve rate measures how fast the agent moves through a task. Like the latency ratio, it captures all the time: model round trips, provider latency, wrong turns and tool execution. But for simple tasks where you can define an ideal trajectory, it's easier to work with, because you only need to measure how long that agent took.

With this, picking a model is simple:

  1. Correctness first: which models are accurate enough on the tasks you actually care about?
  2. Then efficiency: among the ones that are good enough, which gives the best tradeoff between correctness, latency and cost?

The ideal trajectory: an examplelink

For comparisons to be useful, you need a reference for what good execution looks like beyond accuracy. That reference is the ideal trajectory: the sequence of steps that produces a correct outcome with no unnecessary actions. For simple, well-scoped tasks, the best path is usually obvious. For open-ended ones, they approximate it with the best model they've seen so far, and revisit that baseline as models and harnesses improve.

The article uses a simple request: "What is the current time and weather where I live?". The ideal trajectory resolves the user, then their location, then fetches the time and the weather at once, in parallel, before answering: 4 steps, 4 tool calls and about 8 seconds.

Ideal trajectory: user, location, then time and weather in parallel; about 8 seconds.
The ideal trajectory: the last two calls run in parallel.

Now another run that is also correct, but makes one extra call (the location details) and runs nothing in parallel: 6 steps, 5 tool calls and about 14 seconds. Same answer, but latency and cost go up, and there are more chances to fail.

Correct but slow trajectory: one extra call and everything in sequence; about 14 seconds.
Correct, but with an unnecessary call and no parallelism.

With the metrics, that slow run scores:

  • Correctness: 1 (it succeeded).
  • Step ratio: 6 / 4 = 1.5, 50% more steps than ideal. Lower is better.
  • Tool call ratio: 5 / 4 = 1.25, 25% more calls. Lower is better.
  • Latency ratio: 14 / 8 = 1.75, 75% slower. Lower is better.
  • Solve rate: 4 / 14 = 0.29 expected steps per second. Here, higher is better.
Score of the slow run: 1, 1.5, 1.25, 1.75 and 0.29.
The slow run, turned into comparable numbers.

The author points out that these examples are illustrative: a REPL could solve this task even faster, but the tool-calling version makes the idea easier to explain. What matters is the framework: measuring correctness and efficiency together, and turning every run into numbers you can compare across experiments.

How they run themlink

They use pytest with GitHub Actions to run evals in CI, so every change runs in a clean, reproducible environment. Each test creates a Deep Agents instance with a given model, feeds it a task and computes the correctness and efficiency metrics.

Thanks to the tags, they can run just a subset to save money and run targeted experiments. If the agent needs to process and synthesize lots of local files, they focus on the file_operations and tool_use categories. This is the command from the article:

uv run pytest tests/evals --eval-category file_operations --eval-category tool_use --model baseten:nvidia/zai-org/GLM-5
The pytest command with two categories and the model to test.
Only the categories that matter for the experiment.

The whole eval architecture is open source, in the Deep Agents repository.

What's nextlink

The team is expanding the eval suite and doing more work with open models. They announce three things that this article doesn't cover yet:

  • How open models measure up against closed frontier models in each category.
  • Evals as a mechanism for agents to improve themselves in real time.
  • How they maintain, trim and expand each agent's evals over time.

In shortlink

Every test you add pushes your agent, so choose carefully where. Decide first which behaviors matter in production and find targeted tests for them; source them from your own failures, adapted benchmarks and hand-written tests; group them by what they measure; demand correctness first and then efficiency against an ideal trajectory; and run them in continuous integration, by category when you want to save money.

In one sentence

Don't measure more: measure better.

Sourceslink

Continue reading

Last posts -->

Have you seen these projects?

Gymnasia

Gymnasia Gymnasia
Expo
React Native
TypeScript
OpenAI
Anthropic

Fitness app with two agents that run entirely on the device, with no backend, so the user's data never leaves the phone. A BYOK conversational coach with local tools and a remote system prompt with offline fallback, plus a food estimator that pulls macronutrients out of a photo of the plate, with barcode scanning against OpenFoodFacts.

LangGraph Deep Researcher

LangGraph Deep Researcher LangGraph Deep Researcher
Python
LangGraph
FastAPI
React
TypeScript
Docker

Multi-agent research system built with LangGraph. A supervisor breaks your question down into topics and launches search sub-agents in parallel; each one compresses its findings before handing them to a writer agent that produces the final sourced markdown report. Live streaming over WebSockets, a configurable model per role and bring-your-own API keys that are never persisted server-side.

Tau

Tau Tau
Python
LangChain

Multi-agent tutoring system for secondary school students, with one agent per subject and course material written and validated by a team of teachers. It was used with real students at a private school in Spain and at a secondary school in Colombia.

View all projects -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to watch any talk?

Last talks -->

Do you want to improve with these tips?

Last tips -->

Use this locally

Hugging Face spaces allow us to run models with very simple demos, but what if the demo breaks? Or if the user deletes it? That's why I've created docker containers with some interesting spaces, to be able to use them locally, whatever happens. In fact, if you click on any project view button, it may take you to a space that doesn't work.

Flow edit

Flow edit Flow edit

FLUX.1-RealismLora

FLUX.1-RealismLora FLUX.1-RealismLora
View all containers -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to train your model with these datasets?

short-jokes-dataset

HuggingFace

Dataset with jokes in English

Use: Fine-tuning text generation models for humor

231K rows 2 columns 45 MB
View on HuggingFace →

opus100

HuggingFace

Dataset with translations from English to Spanish

Use: Training English-Spanish translation models

1M rows 2 columns 210 MB
View on HuggingFace →

netflix_titles

HuggingFace

Dataset with Netflix movies and series

Use: Netflix catalog analysis and recommendation systems

8.8K rows 12 columns 3.5 MB
View on HuggingFace →
View more datasets -->