Skip to content

Span Schema

Every trace event is stored as a TraceSpan object.

Fields

FieldTypeDescription
traceIdstringUnique trace identifier. Shared across parent and child sessions.
spanIdstringUnique span identifier.
parentSpanIdstring?Parent span ID. Links child spans to their parent.
kindenumsession, llm_call, tool_call, subagent
namestringHuman-readable span name.
agentIdstring?Agent identifier.
sessionKeystring?Session key (e.g. agent:main:main, agent:main:subagent:UUID).
startMsnumberStart timestamp in milliseconds since epoch.
endMsnumber?End timestamp. Null if span is still open.
durationMsnumber?Duration in milliseconds.
toolNamestring?Tool name (for tool_call kind).
toolParamsobject?Tool parameters (for tool_call kind).
childSessionKeystring?Child session key (for subagent kind).
childAgentIdstring?Child agent ID (for subagent kind).
providerstring?LLM provider (for llm_call kind).
modelstring?Model name (for llm_call kind).
tokensInnumber?Input tokens (for llm_call kind).
tokensOutnumber?Output tokens (for llm_call kind).
attributesobjectAdditional key-value attributes.

Session key format

  • Main agent: agent:main:main
  • Subagent: agent:main:subagent:<UUID>
  • Cron: agent:main:cron:<UUID>

Trace ID inheritance

When a main agent spawns a subagent via sessions_spawn, the child session inherits the parent's traceId. This links the entire call chain:

traceId: abc123
├── session (agent:main:main)          spanId: s1
│   ├── llm_call                       spanId: l1, parentSpanId: s1
│   ├── tool_call (sessions_spawn)     spanId: t1, parentSpanId: s1
│   └── session (agent:main:subagent:x) spanId: s2, parentSpanId: s1
│       ├── llm_call                   spanId: l2, parentSpanId: s2
│       └── tool_call (Read)           spanId: t2, parentSpanId: s2

Storage formats

FormatLocationNotes
JSONL~/.openclaw/traces/YYYY-MM-DD.jsonlDefault, one JSON object per line
DuckDB~/.openclaw/traces/traces.duckdbOptional, auto-created on first query
ParquetUser-specified pathVia traces:export command

Released under the MIT License.