MapReduceComputation runs an analysis function across every trace in a run, aggregates results up the entity hierarchy, and optionally persists computed metadata to ClickHouse and Kestrel.
Defining a pipeline
TRACE with a map function. Higher levels use reduce functions.
If your map function calls an LLM, set uses_llm=True and list extra dependencies in pip_install:
Local execution
Run in-process with a thread pool:| Parameter | What it limits |
|---|---|
limit_traces | First N traces |
limit_datapoints | Traces from the first N datapoints |
limit_steps | Traces from the first N steps |
Modal execution
The default mode runs on Modal for parallel cloud execution:run_id.
Persistence
Withpersist_results=True (the default), Manta:
- Registers a judge and columns with Kestrel
- Writes computed metadata to ClickHouse’s
entity_metadatatable - Tracks progress for resumability
persist_results=False for in-memory results only.
Pipeline result
pipeline.run() returns a dict[EntityLevel, list[MetadataOutput]]:
Environment variables
| Variable | Required | Description |
|---|---|---|
CLICKHOUSE_URL | Yes | ClickHouse HTTP endpoint |
CLICKHOUSE_USER | Yes | ClickHouse user |
CLICKHOUSE_PASSWORD | Yes | ClickHouse password |
KESTREL_API_URL | For persistence | Kestrel API URL |
KESTREL_API_KEY | For persistence | Kestrel API key |
MODAL_TOKEN_ID | For Modal | Modal authentication |
MODAL_TOKEN_SECRET | For Modal | Modal authentication |