The trajectory we wrote down and never scored

Everything written about evaluating AI agents makes the same point, and the point is correct. A model returns an answer, so you grade the answer. An agent returns a path. Which tools it called, in what order, how many times, how much it read before it produced anything a human can look at. That path is usually called the trajectory, and if you grade the last message alone you cannot tell a good answer from a lucky one.

I believe that. I also helped run a comparison of agent SDKs and evaluation frameworks where we wrote down the expected tool-call sequence for all nine test scenarios, copied it into four separate prototype codebases, captured the real sequence at runtime, attached it to the object the eval harness grades, and then wrote exactly zero assertions that read it.

The intention is still sitting in the files. Nobody deleted it. It just never got pulled through to the place where a number comes out.

The fossil in the fixtures

We were comparing agent SDKs and evaluation frameworks at the same time, on one shared scenario set. Each of the nine hand-written cases had mock email threads, mock meeting notes, mock CRM state, and an expected outcome. The expected block looks roughly like this:

{
  id: 'declined-active-deal',
  input: { /* mock email, meeting and CRM state */ },
  expected: {
    decision: 'surface',
    priority: 'high',
    shouldCallTools: ['getEmailThreads', 'getSalesforceAccount'],
  },
}

That third field is the trajectory ground truth, the sequence a correct run is supposed to take. It is present in every one of the nine scenarios, and the whole fixture file was duplicated into all four prototypes.

One scenario goes further. Above its shouldCallTools array I left a comment spelling out the expected five steps in order. Fetch the email threads for the attendee we know about. Notice that a second person is mentioned inside those threads. Look that second person up in the CRM. Fetch their thread too. Then generate the meeting prep. That is a real multi-step trajectory, written out by hand, with the ordering that makes it interesting.

Then I searched for shouldCallTools across all four codebases, outside the fixture files. It appears in exactly one place. A small web server built for the demo returns it in a JSON response as expectedTools, sitting next to toolsUsed, so a human can compare the two columns by eye. The server never compares them in code.

The trace made it all the way to the door

This is the part I find hardest to explain away, because the plumbing is there.

Both eval harnesses we actually implemented enrich the agent output with its own trace, the runtime record of which tools it called. Promptfoo is an open-source runner where you declare a provider and a list of assertions in a config file, and it scores whatever the provider returns. Its custom provider in our repo wraps the result and attaches _trace: { iterations, toolCalls, toolCallCount } before returning it. Braintrust is a hosted product running roughly the same loop, with scorers written as TypeScript functions, and our Braintrust task does the same thing independently, with _trace: { iterations, toolCalls, durationMs }. Two harnesses built at different times, and both had the same instinct.

The graded object carries the trajectory every single time. Then the assertions run. The Promptfoo suite has JavaScript assertions and llm-rubric assertions, which ask a model to grade the output against a rubric you write. The Braintrust suite has eight custom scorers. Across both, the string _trace appears in none of them. Everything that produces a number reads the decision, the priority, or the prose of the final output.

The written plan for this work had named three trajectory assertions, verbatim, before any code existed:

trace.toolCalls[0]?.name === 'getEmailThreads'
trace.toolCalls[0]?.name === 'getMeetingSummaries'
trace.toolCalls.length <= 5

None of the three appears in either shipped config. The last one is the one that stings, because a cap on tool calls is the cheapest possible guard against an agent flailing, and it costs one line.

There is a smaller failure nested inside the big one. The helper that turns a trace into something readable does this:

const toolsUsed = [...new Set(trace.toolCalls.map((toolCall) => toolCall.name))];

Ordering gone, repeat calls gone. A scorer reaching for the trace through that helper could only have answered "did this tool get called at all", which is the weakest version of the question, and could never have checked the five-step ordered scenario I wrote the comment for.

The one framework that had the metric

We did look at a tool that solves this properly.

Of the agent SDKs we compared, exactly one ships a native trajectory metric. Google's Agent Development Kit has tool_trajectory_avg_score, documented as exact tool-call sequence matching, as one of eight built-in metrics. The other seven cover familiar ground, including response_match_score for word-level overlap with a reference answer, measured with ROUGE-1, final_response_match_v2 for model-judged equivalence, and hallucinations_v1. Our own scoring matrix rated that SDK 5 out of 5 on evaluation and called it best in class, which on the documentation was fair.

It lost the comparison for a reason with nothing to do with evaluation. Its TypeScript build supported only Google's own models at the time we looked, and the adapter that unlocks other providers existed only in Python. We are a TypeScript shop that wanted to swap models freely, so that was the end of it.

The TypeScript build would not have given us the metric anyway, which I only noticed later. The eval config inside that very prototype opens with a line saying that since the TypeScript kit has no built-in evaluation, we use Promptfoo instead. So the 5 out of 5 was a rating of the Python product, recorded in a comparison of TypeScript products. That is my matrix and my mistake, and preview software moves fast enough that the rating may be stale in the right direction by now.

Why the last message wins by default

I want to resist the reading where this was carelessness, because that reading teaches nothing.

The eval tools we chose are good at what they are shaped for. You give Promptfoo a provider, it calls it, it gets an output, it runs assertions against that output. The natural unit is the returned value. To grade anything else you have to smuggle it inside the returned value, then remember, in a different file written at a different time, to dig it back out. Both harnesses did the smuggling. Neither did the digging, and I wrote assertions against both of them.

The difference is effort, and effort decides what actually gets written. The assertion you write in ten seconds is contains or equals against text you can see in the terminal. The assertion that reads _trace.toolCalls requires holding the provider's internals in your head while writing config. One of those gets written under time pressure and one does not.

Our own architecture document said as much before any of this. It scored the agent pattern we chose 2 out of 5 on Determinism and 2 out of 5 on Testability, and listed the reasons plainly: same input may produce different tool call sequences, behaviour depends on model reasoning. It recommended the pattern anyway, which I still think was right for the problem. What I did not do was carry that 2 out of 5 forward into the eval tool choice. The eval decision record has seven criteria, including cost, production observability, CI/CD integration, TypeScript support and data residency. Trajectory scoring is not one of them, and is not discussed anywhere in that document.

We picked an architecture we had scored as hard to test, and then picked an eval tool by criteria that never mentioned the thing making it hard to test.

What I would do differently

"Remember to write trajectory assertions" is not a fix, because I clearly could not be relied on for that. The change has to be structural, and it starts with not treating the trajectory as metadata.

Make the graded object a record where the trajectory is a first-class field, and make at least one scorer that fails when the field is absent. If the schema of what you grade has a required toolCalls on it, a config with no trajectory assertion looks wrong in review, which is the only enforcement that survives a deadline.

// The object the harness grades. The tool calls are part of the record,
// with their order and repeats intact.
{
  decision: 'surface',
  priority: 'high',
  toolCalls: [
    { name: 'getEmailThreads', args: { /* ... */ } },
    { name: 'getSalesforceAccount', args: { /* ... */ } },
  ],
}

Keep the order. Keep the repeats. The deduplicating Set was written to make a demo readable and it quietly removed the two properties that make a trajectory worth having.

Then write the boring assertions first. Cap the total tool calls. Check that the first call is the one that has to come first. Neither needs a model to judge it, and both catch the failure mode where the agent reaches the right answer down a path you would be unhappy to see in production.

One more thing I would fix comes from the same blindness. None of the four implementations set a temperature, a seed, or a repeat-run count, and the only bound on the agent loop anywhere is a hard-coded MAX_ITERATIONS = 10. Every scenario ran once, non-deterministically, against an architecture we had already documented as non-deterministic. A trajectory assertion on a single sample would have told us less than I would like to admit.

What this exercise could not settle

I should hold my own evidence to the standard I am applying to that document.

We compared three eval frameworks and only implemented two locally. We assessed Langfuse, an open-source tracing and evaluation platform, on documentation alone. Only one eval results file exists in the whole tree, so most of the comparison rests on reading rather than running. The four prototypes each used a different model, so any cross-prototype quality number confounds the SDK with the model and ranks nothing. Gating the build on eval results carried real weight in the final choice, and there is no workflow file behind it in this material.

The decision itself still holds up. We picked Promptfoo for local development and for gating the build, the agent SDK's own tracing in production, and a hosted option in reserve if quality slipped. I would make the same call again with the same information.

What did not hold up is the story the decision record tells about how that call was made. The scoring matrix implies arithmetic settled it. TypeScript support and model portability settled it, two hard constraints that eliminated most of the field before any quality judgement mattered, and the matrix was written around a conclusion those constraints had already forced.

That gap is ordinary. It still cost something, and here the cost was nine scenarios of trajectory ground truth that no assertion has ever read.

So the first thing I now check about an eval framework is whether the object my assertions receive contains the path the agent took. They all judge the final answer. If the honest answer is that I would have to bolt the path on myself, I already know how that ends.