Skip to main content
A TracePress pipeline maps an LLM over rows of a trace, then reduces groups of rows into summaries, climbing a hierarchy such as step → trial → task.

Tables

A source gives you tables of rows. A Harbor job has steps, trials and tests:
Tables are immutable and lazy: every operator returns a new table, and nothing runs until you call .collect() or .to_pandas().

Language Model Map

lm_map makes one LLM call per row. You describe the call with a one-line signature:
Inputs on the left bind to columns by name, and outputs on the right become new columns. An input named after the row’s level (step on a steps table) gets the whole row: its message, reasoning, tool calls and output. Outputs are strings unless you give a type (bool, list[str], Literal['a', 'b'], …). Two relatives of lm_map:
  • lm_filter("message -> is_error: bool") keeps only rows where the one bool output is true.
  • lm_extract("step -> failures: list[str]") makes one new row per item of a list output.
Plain-Python filter and map work the same way without an LLM, which makes them the cheap way to drop rows before you pay for calls:

Language Model Reduce

group_by(...).lm_reduce(...) makes one LLM call per group and returns one row per group:
Inside a reduce, an input naming a column of the rows being reduced gets every row’s value, kept aligned so the LLM sees which is_mistake goes with which what_happened. An input naming the group key, or a column with one value per group (like a trial’s reward), gets that single value. Groups too big for one prompt are split into chunks and the results merged. Use group_by(...).reduce(fn, columns=...) for a plain-Python reduce, such as counting, and group_by() with no names to reduce the whole table into one row.

Hierarchies

Every row carries a hierarchical key. A Harbor step is keyed dataset > task > trial > step. A row built from other rows inherits their key: grouping steps by trial gives rows keyed dataset > task > trial, and reducing those by task gives rows keyed dataset > task. So climbing the hierarchy is just reducing again:
group_by takes key levels ("trial") or any other column ("model"). Joins bring facts from one level down to another. join(other, on="trial") adds each step’s trial columns (its instruction, reward, …) to the step, and in a reduce those columns then bind as one value per trial:
Because keys carry through, you can always drill down from a result to the rows behind it:

Language Model Fold

group_by(...).lm_fold(...) walks a group’s rows in key order, one call per row, carrying state. Fields on both sides of the arrow are the state:
Each call reads the previous progress and the newest step, and writes the new progress. Folds are what you use to follow a run as it happens.

Batch and live run the same pipeline

Sources emit events: a row arrived, or a group closed (a trial finished). A stored source emits every row and then every close; a live one emits them as they happen. The engine can’t tell the difference, so every pipeline above runs unchanged on a live stream. .collect() returns final rows, and .events() streams every result as it’s produced. See Live pipelines.

Reruns and the cache

LLM calls are cached, so rerunning a pipeline only pays for prompts that changed. table.rerun(edit=...) uses that to answer what-if questions: it returns the table as if some rows upstream had been different, such as {("trial", "t1"): ("trial", "t2")} to make run t1 look like run t2. tp.last_run() shows the calls, tokens and cost of the latest run.

Next steps

Why did my runs fail?

The full step → trial → task pipeline.

Python SDK

Every operator and its arguments.