Interactive and Long-Horizon Task Evaluation › Trajectory analysis beyond scoring

Michael BrenndoerferDecember 1, 20264 min read
Language AI HandbookAll chapters
Part 57 of 67Dynamic, Interactive, and Agentic Evaluation
Chapter 437Interactive and Long-Horizon Task Evaluation › Trajectory analysis beyond scoring
Reading section 7 of 12 · Trajectory analysis beyond scoring · 4 minSection 7 of 12 · 4 min

Section 7 of 12 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Scoring is the point of evaluation, but analysis is where the deeper signal lives. With a few hundred trajectories, the harness can do things a scalar cannot.

Action-sequence clustering. Encode each trajectory as a sequence of action types (e.g., read, create, set, set, submit) and cluster. The clusters show you the programs the agent produces: the canonical path, the explore-first path, the loop-forever path. A heavy cluster of read, read, read, noop, ... trajectories means you have a stuck agent, which is a different failure from a confidently-wrong agent and calls for a different fix.

Error-code histograms. Count error codes across trajectories and inspect a few examples from each common group. The same error count can arise from different causes or precede either a repair or an abandoned task.

Step-to-first-error distribution. Keep the index of the first observed error and report how many trajectories end without one. A late error draws attention to the later steps, but timing alone cannot tell you why the error occurred.

Steps to resolution. Count attempted actions from a qualifying error to its matched resolution. Report unresolved events separately so a quick-only average does not hide abandoned tasks. A group-level time-to-resolution summary needs an explicit rule for trajectories that end first.

Trajectory length vs success. Group trajectories by attempt length to see where cost and successful completion coincide. The comparison is descriptive because difficulty and policy behavior can affect both variables.

These five analyses share a common logic: they all take a property that the scalar score discards and turn it into a distribution that can be inspected. The scalar tells you whether an agent tends to fail; the distribution tells you where and how it fails, and only the latter tells you what to change. This is the same distinction we drew in the evaluation-challenges chapter between a metric that measures and a diagnostic that explains, and it is why the analysis layer is not optional garnish on top of the score but a co-equal part of the harness.

The next code block computes the error-code histogram over the four policies as a small illustration of the analysis layer.

PythonIn [19]
CollapseExpand
from collections import Counter


def error_histogram(states: dict[str, EnvState]) -> pd.DataFrame:
    rows = []
    for name, s in states.items():
        c = Counter(
            e["observation"].get("error")
            for e in s.ledger
            if e["status"] in ("error", "blocked")
        )
        for code, n in c.items():
            rows.append({"policy": name, "error": code, "count": n})
    return pd.DataFrame(rows)


states = {name: run_policy(pol) for name, pol in policies.items()}
errs = error_histogram(states)
ConsoleOut [20]
CollapseExpand
      policy                error  count
       naive       NEEDS_CATEGORY      1
  recovering       NEEDS_CATEGORY      1
double_filer       NEEDS_CATEGORY      1
double_filer SECOND_REPORT_DENIED      1

The histogram confirms the stories from the scoring table: naive carries an unresolved NEEDS_CATEGORY; recovering carries the same code but it is resolved (the count is identical, but the recovery dimension separates them); double_filer adds a SECOND_REPORT_DENIED; efficient carries no errors. The analysis layer matters because a single error code can mean success-with-recovery or failure, and only the trajectory context distinguishes them.

The cumulative actions and errors per policy are the single most useful plot to put in front of a model owner. Every policy's ledger is already accumulated; the code below only renders it.

VisualizationOut [21]
CollapseExpand
Four horizontal policy lanes. Circles mark successful actions; crosses mark errors. The first three lanes encounter the category error at step four, and double filer attempts a forbidden second submission at step ten.
Attempted actions and logged errors for four policies. Circle markers are successful actions; crosses mark errors or blocked actions. Naive and recovering both encounter NEEDS_CATEGORY at step four. Double filer also triggers SECOND_REPORT_DENIED at step ten (as the tenth ledger entry, i.e. the tenth action attempt), after the recovering policy's six steps plus four more.

The figure makes the earlier point visually: the naive and recovering policies make the same error at the same step and diverge only afterward, which is exactly the contrast a final-state grade cannot reveal. The double_filer's extra error is the safety violation. In a real study these timelines are drawn not for four policies but for hundreds of sampled trajectories overlaid as heatmaps of error density by step.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy