Skip to content

Trace Schema ​

Agent Replay records two types of structured data: Runs and Steps.

Run ​

A Run represents one complete agent execution.

FieldTypeDescription
run_idstringUnique identifier (run_<12hex>)
agent_namestringName of the agent
taskstringDescription of the task
started_atISO datetimeWhen the run started
ended_atISO datetimeWhen the run ended
statusenumrunning, success, or failed
cost_usdfloatTotal cost in USD (optional)
latency_msintTotal duration in milliseconds
metadataobjectArbitrary key-value pairs
schema_versionstringTrace format version

Step ​

A Step represents one state transition within a run.

FieldTypeDescription
step_idstringUnique identifier (<type>_<n>)
run_idstringParent run
typeenumllm_call, tool_call, retrieval, memory_read, memory_write
namestringOperation name
inputanyWhat went in
outputanyWhat came out
state_beforeanyState snapshot before the step
state_afteranyState snapshot after the step
errorstringError message if the step failed
usageobjectToken usage, latency, cost
parent_step_idstringFor nested steps
timestampISO datetimeWhen the step occurred
metadataobjectArbitrary key-value pairs

Step types ​

llm_call ​

A call to a language model. Records provider, model, input messages, output message, and token usage.

tool_call ​

An invocation of an external tool or function. Records tool name, input arguments, output, and any error.

retrieval ​

A query to a knowledge base or vector store. Records query, results, and relevance scores.

memory_read / memory_write ​

Read from or write to the agent's memory system. Records key, value, and namespace.

Forward compatibility ​

The schema is versioned (SCHEMA_VERSION). Unknown fields are preserved in metadata via from_dict, so traces from newer versions can still be read by older analysis tools.

JSON format ​

Export and import traces as JSON:

bash
agent-replay export latest --format json > trace.json
agent-replay import trace.json

The JSON format is the canonical interchange format. Any language can produce it — see the TypeScript SDK for a non-Python example.

Released under the Apache 2.0 License.