Evals

Variables

Declare what an eval reads once, as variables every step can use: a field of the trace, or chosen spans or runs. Pass what one step found on to the next with step context.

A step reads the trace through variables. You declare a variable once on the eval, and every step can use it: {{vars.output}} in a judge prompt or a decision model's state, t.vars["output"] in Python. What one step finds, it can pass on to later steps as context. Together they let you gather evidence once and judge exactly that.

The eval's variables

Every step panel that reads the trace has a Variables section listing the eval's variables. Drag a chip into the prompt, state or code, or click it to insert it at the cursor. The pencil on a chip changes it, and the change reaches every step that uses it. Add variable declares a new one.

A new eval starts with the variables almost every eval needs: input and output for a run or span eval, transcript for a conversation eval.

The variable dialog for a Spans variable: Type, Which spans, Read and Which of them on the left; on the right, how many recent runs it matched in and what it read on the latest one.

In the dialog, Type says what the variable reads. The types follow the eval's level:

EvalTypes
RunRun, Spans, Conversation
SpanSpan, Run, Conversation
ConversationConversation, Runs, Spans, Agent

A field

Run, Span, Conversation and Agent read one field: pick a Property such as the run's output, its duration, or one metadata key. The preview says in how many of the last 50 units it has a value, and shows it on the newest one.

In a prompt the field is text; in Python, t.vars["NAME"] is the value itself, so a number stays a number.

Spans or runs

Spans (and, on a conversation eval, Runs) choose some of a run's spans or a conversation's runs, so a judge reads "the last SQL call" instead of forty spans:

Options
Which spans / Which runsFilters over the item's properties: a span's name, kind, tool, model, status, duration, tokens or metadata; a run's agent, status, input, output, duration or tokens. Empty means all of them.
Only the onesWhen the eval has a Score spans step: only the spans (or runs) it failed.
ReadInput and output, Input, Output, Duration, Tokens or Timeline.
Which of themAll of them, The first, The last or The Nth (a negative N counts from the end), in the order they started.

While you choose, the preview runs the variable on the last 50 runs (or conversations) of the eval's agent, without calling any model: Matched in 47 of the last 50 runs, and exactly what a step gets on the newest one. When nothing matches, the variable is empty; the step still runs.

A judge reads spans numbered and tagged, so it can cite "span 2":

<spans name="tool_calls" matched="5" shown="3">
<span n="1" of="3" kind="tool" name="check_velocity" status="ok" at="+1.42s" duration="812ms" parent="planner">
<arguments>{"card_last4":"1446","window_minutes":10}</arguments>
<output>{"exceeds_baseline":false,"transactions_in_window":6}</output>
</span>
...
</spans>

A long field keeps its start and its end. Past 20 spans, 2,000 characters a field or 24,000 in all, whole spans are dropped from the middle and an <omitted .../> line says which. Timeline reads the matched spans as the trace tree shows them, indented under their parents, with status, duration, tokens, cost and totals. A Python step gets the same text in t.vars["NAME"].

An eval can declare up to 24 variables. A variable a step uses can't be deleted; the dialog says where it is used.

Passing data between steps

A step has three things a later step can read:

What it isRead as
OutcomeWhat the step answered, the value its routes decide on{{steps.check.score}} · t.steps.check.score
ContextWhat a Python step passes on; routes never read it{{steps.gather.evidence}} · t.steps.gather.evidence
ReasoningA judge's explanation of its answer{{steps.judge.reasoning}} · t.steps.judge.reasoning

Under From earlier steps in the Variables section, click one to insert it. check, gather and judge here are step ids: each step gets one from its name when it is added, and renaming the step later doesn't change it.

Declaring context

In a Python step, under Context, give each value a name and a type: text, number, true / false, list or json. Then return it as the second value:

def evaluate(t):
    tools = t.spans.where(kind="tool")
    failed = [s for s in tools if s.status == "error"]
    evidence = "\n".join(f"[{s.tool_name}] {text(s.output)[:800]}" for s in tools)
    return (
        "has_failures" if failed else "clean",        # the outcome, routed on
        {                                              # the context, passed on
            "evidence": evidence,                      # text
            "failed": [s.tool_name for s in failed],   # list
            "failed_count": len(failed),               # number
        },
    )

Every declared key must be returned, with its type, and nothing undeclared. A name can't be both an outcome and a context key. Context can be up to 256 KB. In a prompt, a list reads as numbered lines rather than JSON.

What a step can read

A step can read another step only if that step runs on every path before it. If Gather is the first step, everything after it can read steps.gather.*. If Judge runs only when a screen was unsure, a step reachable without going through it can't read steps.judge.*, because on some traces it would be empty. The editor checks this and says which step and why, before you can save.

A worked example: grounded in the right rows

Gather

A Python step, Rows returned (id rows), reads the SQL tool's spans and passes the rows on as text:

def evaluate(t):
    sql = t.spans.where(kind="tool", tool_name="run_sql")
    rows = "\n".join(text(s.output)[:2000] for s in sql if s.status == "ok")
    return bool(rows), {"rows": rows}

True / false: True → Check the figures, False → No data used (pass). Context rows (text).

Check

A decision model, Figures match the rows, reads {{steps.rows.rows}} and {{vars.output}} and asks Does every figure in the answer appear in the rows? yes → Grounded, no → Invented figures, can't tell → Judge the figures.

Judge

An LLM judge, Judge the figures, reads the same two and scores 0 to 1. Below 0.5 goes to Invented figures, 0.8 and up to Grounded (judged), and the band between to a person.

Neither model ever sees the whole trace: only the rows the answer was supposed to come from.

On this page