Execution traces and OTLP file format
One trace describes one Agent root execution, organizing Agent, subagent, model, tool, and exportable middleware activity by parent-child relationships. See state and storage for the data needed to resume a conversation.
Local files
Once a running graph's root execution ends, it writes an OTLP JSON request body:
<home>/runtime/users/<user>/sessions/<thread>/traces/<native-root-run-id>.jsonSuccess, failure, and normal cancellation can all export. A request rejected before graph execution, deliberately disabled tracing, or a forcibly terminated process can leave no file. The exporter gathers ended spans for the current root, writes a temporary file in the same directory, then publishes complete JSON with a hard link. An existing destination remains unchanged. Files use mode 0600; saving failures log TRACE_SAVE_ERROR without changing the Agent result. Concurrent turns export separately. There is currently no automatic cleanup policy.
build_graph binds LocalLangChainTracer to the default graph. LangChain callbacks feed a dedicated TracerProvider through LangSmith SDK OTEL mode. The process can also enable live OTLP export; local files still write when roots finish. SDK callers can disable tracing for one invocation with tracing_context(enabled=False).
JSON structure and fields
OTel is short for OpenTelemetry, the project that collects and represents observability data. OTLP — the OpenTelemetry Protocol — defines how that data is structured and shipped. Think of a trace as the call tree for one execution; each span is one operation with a start and an end time. Files use OTLP ExportTraceServiceRequest JSON and can be read directly, without deploying a collector. See the OTLP specification.
Outer structure
resourceSpans[] Service resources producing data
├── resource.attributes[] For example, service.name=dataagent
└── scopeSpans[] Instrumentation scopes collecting spans
├── scope Instrumentation name, version, etc. (read actual files)
└── spans[] Agent, model, tool, and other execution segmentsThis is one JSON object, not JSON Lines logs or a session checkpoint. Iterate through all resources and scopes before processing spans. Do not assume only the first scope has data or that arrays are in invocation order.
Spans and attribute fields
| Field | Meaning |
|---|---|
traceId, spanId, parentSpanId |
Hexadecimal IDs. Locate spans with the first two and reconstruct relationships with parent IDs. A root has no parent ID |
startTimeUnixNano, endTimeUnixNano |
Unix nanosecond timestamps encoded as decimal strings. Convert to integers before calculating duration |
name |
Node or tool name. Names can repeat, so correlate by ID |
kind |
OTLP span kind; these internal execution nodes are usually 1, INTERNAL. This does not distinguish models from tools |
status.code, status.message |
0/omitted means unset, 1 means OK, and 2 means ERROR. Error details may be in message. Graph span status can differ from final HTTP or A2A Task outcomes |
attributes[] |
Entries containing key and typed value, not an ordinary key-value object. Decode values by type |
langsmith.span.kind |
Values such as llm or tool, useful for filtering invocation types |
gen_ai.prompt, gen_ai.completion |
Exportable Agent, model, or tool inputs and outputs, stored as JSON strings inside stringValue and requiring another json.loads. Shapes vary by node, as explained below |
OTLP values use typed representations: stringValue is a string, intValue is a decimal integer string, doubleValue is numeric, boolValue is Boolean, arrayValue.values[] contains typed elements, kvlistValue.values[] contains similarly shaped key-value entries, and bytesValue is Base64. traceId / spanId are OTLP-specific hexadecimal IDs, not bytesValue encodings.
File excerpt
The following omits scope metadata and other attributes, showing only a root execution and one tool. Times and IDs are illustrative; actual files also contain model, middleware, and other spans.
{
"resourceSpans": [
{
"resource": {
"attributes": [
{"key": "service.name", "value": {"stringValue": "dataagent"}}
]
},
"scopeSpans": [
{
"spans": [
{
"traceId": "7adf798a26b54ed888969f20e632c518",
"spanId": "0000000000000001",
"name": "dataagent",
"kind": 1,
"startTimeUnixNano": "1795737600000000000",
"endTimeUnixNano": "1795737602000000000",
"status": {"code": 1},
"attributes": [
{"key": "langsmith.span.kind", "value": {"stringValue": "chain"}},
{"key": "langsmith.metadata.thread_id", "value": {"stringValue": "demo-thread"}},
{"key": "langsmith.metadata.dataagent_root_run_id", "value": {"stringValue": "demo-run"}}
]
},
{
"traceId": "7adf798a26b54ed888969f20e632c518",
"spanId": "0000000000000002",
"parentSpanId": "0000000000000001",
"name": "semantic-service__get_table_schema",
"kind": 1,
"startTimeUnixNano": "1795737600100000000",
"endTimeUnixNano": "1795737600300000000",
"status": {"code": 1},
"attributes": [
{"key": "langsmith.span.kind", "value": {"stringValue": "tool"}},
{"key": "gen_ai.prompt", "value": {"stringValue": "{\"table_name\": \"demo.orders\"}"}},
{"key": "gen_ai.completion", "value": {"stringValue": "{\"output\": {\"columns\": []}}"}}
]
}
]
}
]
}
]
}This tool takes (1795737600300000000 - 1795737600100000000) / 1e6 = 200 milliseconds. Parent and child durations overlap, so summing all span durations does not measure the whole turn. Use the root for total duration and calculate tool/model durations separately as needed.
Reading inputs and outputs
First convert attributes[] into a key-value mapping, then JSON-decode gen_ai.prompt / gen_ai.completion strings again. In the tool example, decoded input is {"table_name": "demo.orders"} and output is {"output": {"columns": []}}. This illustrates a tool-response shape; actual business fields depend on its tool and service.
Model inputs can contain nested lists of messages. Messages themselves may use constructor serialization containing lc, type, id, and kwargs. Model outputs can include generations and llm_output, with nested generation entries containing text, message, and other fields. Agent nodes usually contain message state, but their shape differs from model nodes. Do not interpret every node as messages[].role/content or assume outputs are always plain strings.
Internal non-Agent chain nodes have inputs and outputs cleared to {}. Handle absent attributes, empty objects, and missing output after interruptions as recorded. An in-house evaluation framework can parse Agents, models, and tools separately by langsmith.span.kind, then derive its own samples. These attribute names define the current serialization contract and do not require an external platform. See trace files and evaluation framework integration for required data, mappings, and integration boundaries.
Trace filenames use the native root run UUID. The file's traceId is the same root UUID as 32 hexadecimal characters. REST client runId and A2A Task IDs correlate through attributes.
Correlating a request
| Attribute | Identifier |
|---|---|
langsmith.metadata.dataagent_run_id |
Current node's native run ID |
langsmith.metadata.dataagent_parent_run_id |
Current node's native parent run ID |
langsmith.metadata.dataagent_root_run_id |
Host turn ID: the requested runId for AG-UI, server-generated for A2A |
langsmith.metadata.thread_id |
Session ID |
langsmith.metadata.dataagent_request_id |
A2A creation request ID, matching this request's X-Request-ID |
langsmith.metadata.dataagent_a2a_task_id |
A2A Task ID |
langsmith.metadata.dataagent_a2a_message_id |
A2A Message ID |
For AG-UI, find the root span by host turn ID in the session's files. For A2A, use native_run_id and trace_file from a2a.trace.saved in correlation logs. If graph execution succeeds but checkpoint saving fails, the graph trace can show success while the Task reports failure at checkpoint_settle. Verify protocol responses or logs as well.
Data boundaries and retention
- Traces can contain system prompts, historical messages, and complete tool results. Known secrets and common authentication formats are redacted before local and live export. Inspect and remove business data as needed before providing files to evaluation tools.
- Models called directly inside ordinary tools are not exported separately. Tool spans and Agent/subagent model calls remain visible. Files do not retain per-token events.
- Timeouts or cancellation can interrupt waiting for a model. During root cleanup, the tracer attempts to finalize started model spans eligible for export, marking them
interrupted locally. End time means the local wait stopped; missing output and usage remain unknown.
The DataAgent CLI currently provides service, A2A, and historical-SQL commands. To consume files in your own evaluation workflow, use trace files and evaluation to read, filter, and map the required fields. For live ingestion by your own collector, configure OTLP/HTTP through live trace export.
Local root cleanup normalizes Trace IDs, repairs visible parent-child relationships, and settles error status. Live export sends spans as they finish. The two outputs need not have identical IDs, relationships, or final status. Prefer native-run-ID attributes when correlating across sources.
Implementation and verification: native tracer, local exporter, and trace tests.