Estela
Reference

Export formats

Audience: someone who reads an Estela export with another tool, or changes the export code. This document lists how estela export-atif and estela export-otlp map a session onto each format. The code is packages/kernel/src/export-atif.ts, export-atif-steps.ts, and export-otlp.ts; how to run the commands is in Reports and exports.

Two rules hold for both formats:

  • A value the agent did not record is left out, never written as zero or guessed. The one exception is ATIF's required agent.version, which is "unknown" when the log records no agent version.
  • Events a compaction removed produce no ATIF step. In OTLP they keep their chat and execute_tool spans, but no later request's gen_ai.input.messages contains them.

Pinned versions

FormatVersionWhere it is pinnedStability
ATIFATIF-v1.8 (Harbor RFC 0001)ATIF_SCHEMA_VERSION in export-atif.tscovered by semver from 1.0 (public interface)
OTLPOTLP/JSON ExportTraceServiceRequest with the OpenTelemetry GenAI attributes of gen-ai-dev/1.42.0-devOTLP_SEMCONV_VERSION in export-otlp.tsexperimental: the GenAI conventions have no release, so attribute names can change when the pin moves

A new ATIF or semconv version is adopted on purpose, in its own change that updates the pin, this document, and the tests.

ATIF

One export is one root trajectory for the main agent. Each subagent lane with at least one exportable event becomes an entry of the root's subagent_trajectories, built the same way.

Trajectory

FieldValue
schema_versionATIF-v1.8
session_idthe session id
trajectory_idonly on an embedded subagent trajectory: the lane id
agent.namethe agent id (claude-code, codex, …)
agent.versionthe recorded agent version, else "unknown"
agent.model_namethe model, when the requests of the trajectory that name a model all name the same one
agent.tool_definitionsthe session's tool list, on the root, when it is a list of objects
stepsbelow; step_id runs from 1
notesa fixed note: where the export came from, that extra.estela.eventIds names each step's events, the compaction rule, and that cost_usd is a list price
final_metricstotal_prompt_tokens, total_completion_tokens, total_cached_tokens (sums over the steps that record them), total_steps, and total_cost_usd (below)
extra.estela (root only)capabilities, skipped (count per reason of the log records the reader skipped), pricing (below), and the hook, unknown-event, turn-duration, and prompt-snapshot entries that came before any step

Steps

A lane's events are read in order. A user event, a compaction, and a system event that becomes a step of its own (a text, or a prompt snapshot with a new system prompt) close the open agent step; a system event that becomes no step (a turn duration, an unchanged prompt snapshot) and hook and unknown events leave it open. Agent events (assistant, reasoning, tool_call, request) with the same requestId form one agent step.

EventATIF
the session's or lane's system prompta first system step with that text
usera user step; message is the text (empty when none); the flags meta, compactSummary, command, injected, continued go to extra.estela.flags
assistantthe agent step's message (several texts joined by a blank line)
reasoningthe agent step's reasoning_content
tool_calltool_calls[]: tool_call_id, function_name, arguments (the recorded object; any other value as { "input": … }); a tool title goes to the call's extra.estela.title
tool_resultobservation.results[] on the step that holds its call, with source_call_id; content is the output text, or its JSON when it is not text; isError, exitCode, and orphan go to the result's extra.estela. A result without a call in the trajectory has no source_call_id
requestthe agent step's metrics (below), and model_name when it differs from agent.model_name
compactiona system step whose message is the compaction summary (or Context compaction performed when none is recorded), with the summary also as observation.results[0].content when one is recorded. When the compaction records its trigger, preTokens, or postTokens, they go to extra.estela.compaction and the step carries extra.context_management = { "type": "compaction", "boundary": "replace" }; a compaction that records none of them has no extra.context_management
a prompt snapshot with a new system prompta system step with that text; an unchanged one only adds its id to the open step's extras
a system event with texta system step
a turn durationextra.estela.turnDurationMs of the open step
hook, unknown, other system eventsno step; listed in the open step's extra.estela.hooks or extra.estela.unknown
an event a compaction hidno step
a user or agent step before a later compaction on its laneis_copied_context: true
every stepextra.estela.eventIds (the canonical event ids; empty for the initial system-prompt step), and extra.estela.requestId when grouped. User and agent steps carry timestamp (ISO 8601, their first event); system steps, compaction steps included, have none

A subagent's spawn step gets an observation.results[] entry with subagent_trajectory_ref: [{ trajectory_id: <lane id>, session_id }] (and the spawn call's source_call_id when the spawn event is a tool call). A subagent lane with no exportable events is left out, with its reference.

A trace with no user, agent, or system-prompt content cannot produce a step, and the export fails with that reason.

Metrics and cost

Request fieldATIF
usage.inputTokens (cache reads and writes included)metrics.prompt_tokens
usage.outputTokensmetrics.completion_tokens
usage.cacheReadTokensmetrics.cached_tokens
usage.cacheWriteTokens, cacheWrite1hTokens, reasoningTokens, totalTokens, granularity, modelCalls, responseIdmetrics.extra.estela
modelCalls when granularity is turn or sessionllm_call_count
list price of the requestmetrics.cost_usd, only when the request is priced

final_metrics.total_cost_usd is set only when every request of that trajectory's lane is priced; on the root it covers the whole session, subagents included, as ATIF defines it. Requests a compaction hid count toward this rule although they produce no step. The root's extra.estela.pricing is { "version": <price snapshot version>, "unpricedRequests": <count> }. Pricing rules are in Cost.

OTLP

The file is one OTLP/JSON ExportTraceServiceRequest with one resourceSpans (resource attribute service.name = "estela") and one scopeSpans (scope estela). It follows the OTLP JSON encoding: span kinds as integers, trace and span ids as hex, times as nanoseconds in decimal strings. Ids are hashes of the agent, session, lane, and event ids, so the same session exports to the same ids.

SourceSpan and attributes
each lane with eventsinvoke_agent <name> (kind INTERNAL): gen_ai.operation.name = "invoke_agent", gen_ai.agent.name (the agent id for the main lane, the lane title for a subagent), gen_ai.agent.version when recorded, gen_ai.conversation.id (session id). A subagent span's parent is its spawn event's span when that exists, else its parent lane's span. It runs from the lane's first to its last event
each requestchat <model> (kind CLIENT), child of its lane span: gen_ai.operation.name = "chat", gen_ai.request.model, gen_ai.response.id, gen_ai.response.finish_reasons, each when recorded. Start is the recorded start time, else the event time; end is start plus the recorded duration
the request's usagegen_ai.usage.input_tokens, gen_ai.usage.output_tokens, gen_ai.usage.cache_read.input_tokens, gen_ai.usage.cache_write.input_tokens, gen_ai.usage.reasoning.output_tokens, each when recorded. A total token count has no attribute in the pinned registry and is left out
what the model saw at the request (reconstruct)gen_ai.input.messages (the visible user, assistant, system-text, reasoning, tool-call, and tool-result events as GenAI messages), gen_ai.system_instructions, and gen_ai.tool.definitions, as JSON strings, each only when recorded
the request's own output eventsgen_ai.output.messages (JSON string)
a compaction earlier on the lanegen_ai.conversation.compacted = true
each tool_callexecute_tool <name> (kind CLIENT), child of its request's chat span when one exists, else the lane span: gen_ai.tool.name, gen_ai.tool.call.id, gen_ai.tool.call.arguments and gen_ai.tool.call.result (JSON strings). A result with isError sets the span status to ERROR. It ends at the result's time
system, hook, unknown, compaction events, skipped recordsno span

The OTLP export carries no cost: the pinned semantic conventions define no cost attribute.

Checks

  • packages/kernel/src/export-atif.test.ts, export-atif-cost.test.ts, and export-otlp.test.ts test the mappings on synthetic traces.
  • apps/cli/src/export/write-export.test.ts exports the demo trace and every registered agent's conformance fixtures through a structural ATIF check, in CI.
  • node scripts/validate-exports.mjs exports the same fixtures and runs Harbor's validator (python -m harbor.utils.trajectory_validator, Python 3.12 through uv). It needs the network and runs by hand, not in CI.