Register an aggregate
How it works
Aggregates use a{ collect, reduce } pattern:
collectruns per session and returns a flatRecord<string, boolean | number | string>reducereceives all collected sessions and returns an array of table rows
collect context
The collect function receives an extended AggregateContext:
| Field | Type | Description |
|---|---|---|
entries | object[] | Raw JSONL entries for the session |
stats | EvalLogStats | Computed session stats |
projectName | string | Project name |
sessionId | string | Session ID |
source | string | "session" or "agent-{id}" |
evalResults | Record<string, { pass, score, error?, message? }> | Cached eval results |
enrichResults | Record<string, Record<string, value>> | Cached enrichment results |
filterValues | Record<string, boolean | number | string> | Computed filter values |
Options
| Option | Type | Description |
|---|---|---|
label | string | Human-readable section label (defaults to the name) |
condition | ConditionFunction | Optional per-session gate |
Aggregates on named views
Use.aggregate() on the view builder to scope an aggregate to a specific view:
reduce input
The reduce function receives an array of CollectedSession objects:
Conditional aggregates
Use thecondition option to skip a session during collection:

