Flashcard: what is an agent 'trajectory' and why does it matter for evaluation?
A trajectory is the full thought, action, observation sequence an agent ran through. Trajectory evaluation scores the path, not just the final answer, so you can catch inefficient, unsafe, or accidentally correct runs.
Picture two students who both turn in the same correct math answer. One solved it cleanly in three lines. The other wrote two pages of crossed-out attempts, accidentally divided by zero twice, and somehow landed on the right number. As a teacher, do you grade them the same? Probably not. The final answer hides everything you actually care about: did they understand the method, did they avoid dangerous mistakes, would they get the next problem right too. A trajectory is the agent's two pages of work. It is every thought, every tool call, every observation in order. Looking at the trajectory tells you whether the agent solved the task for the right reasons or got there by luck.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Trajectory is one of those vocabulary words that sounds technical and turns out to mean something quite simple: the record of everything the agent did. The reason it matters is that LLM agents have far more variance in how they reach an answer than in whether they reach one. Two agents that both pass a benchmark on final-answer accuracy can have completely different operational properties: one is cheap and reliable, the other is expensive and lucky.
This deep dive defines what a trajectory is, explains why final-answer evaluation alone misses the things that matter most in production, walks through the four canonical scoring dimensions, and surveys the 2026 stack for capturing and scoring trajectories. By the end, the case for trajectory-first agent evaluation should be obvious enough that final-only evaluation looks like a beginner's mistake.
What a trajectory actually contains
A trajectory is the ordered sequence of every step the agent ran through on a single execution. Each step contains the model's output (including any reasoning text), the tool call the model emitted (if any), the arguments to that call, the observation the runtime fed back, and timing and cost metadata. Add the user task at the start and the final answer or stopping reason at the end, and you have the full record.
The granularity matters. A minimal trajectory captures only the model calls and final answer; a useful trajectory captures the tool calls and observations too. Without the observations, you cannot tell why the model made the choices it made on each subsequent turn. The ReAct pattern made this granularity explicit by interleaving thoughts and actions in the model's output; the trajectory is essentially the ReAct trace plus runtime metadata.
Modern observability stacks emit trajectories as nested trace spans. The top-level span is the agent run; nested under it are per-turn spans; nested under those are the model-call span and the tool-call spans for that turn. OpenTelemetry has become the standard format, which means Langfuse, LangSmith, Phoenix, Helicone, and Weave can all consume the same emitted traces and let teams swap observability backends without re-instrumenting.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- Langfuse, LangSmith, Arize Phoenix, Helicone, and Weave all capture agent trajectories as nested trace spans; each turn becomes an inspectable call stack with model, tool, and observation spans.
- SWE-bench scores real GitHub issue resolutions but exposes the full trajectory so researchers can debug why a model failed on specific repos.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow do you score thousands of trajectories without reading each one by hand?
Combine programmatic rules (cheap, deterministic), LLM-as-judge (broad, noisier), and golden-trace comparison (precise where curated). Run programmatic rules at full scale, sample for LLM judging, reserve golden traces for regression tests.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Grading agents on final-answer accuracy only. Two agents can both land the right answer with wildly different paths; the wasteful or unsafe one will fail on the next slightly different task.
60 second bullets to scan on the way to the call.
Define a trajectory as the ordered sequence of thoughts, actions, and observations.
Explain why final-answer evaluation alone is insufficient.
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.