Trace files and evaluation framework integration
After a run ends, use its local trace to inspect the Agent's steps, tools, failures, and timing, then check actual artifacts for business correctness. This page explains DataAgent's files, fields, and reading methods to prepare data for our evaluation framework. The framework lives outside this repository; this guide does not assume its import API, datasets, or scoring rules.
Find the run's trace
The backend or SDK Home stores one file per root execution:
<home>/runtime/users/<user>/sessions/<thread>/traces/<native-root-run-id>.json<thread> is the session ID; the filename is the native graph root UUID. Multiple runs in one session produce separate files. Correlate an AG-UI request's runId with the root span attribute langsmith.metadata.dataagent_root_run_id, not the filename. For A2A, use the Task ID and a2a.trace.saved log as well. Successful, failed, and normally cancelled executions can produce files. Rejection before graph execution, disabled tracing, or forced process termination can leave no file. See lifecycle and correlation.
Understand OTLP JSON first
OpenTelemetry (OTel) provides standards and tools for observability data; OTLP is its exchange protocol. A local DataAgent file is the JSON body of one ExportTraceServiceRequest. It contains a trace, rather than log text, a checkpoint, or evaluation scores. Timed spans and their parent IDs describe the execution tree. See the OTLP specification for the complete definition.
resourceSpans[] Resource groups; service.name is dataagent
resource.attributes[] Resource attributes
scopeSpans[] Instrumentation scope groups
scope Scope name, version, and related fields
spans[] Execution steps in this scope
traceId / spanId / parentSpanId
name / startTimeUnixNano / endTimeUnixNano / status
attributes[] Typed key/value entries| Field | How to read it |
|---|---|
traceId |
32-character hexadecimal string; the local file uses the native root UUID without hyphens |
spanId, parentSpanId |
16-character hexadecimal strings; parent IDs reconstruct the tree, and the root has no parentSpanId |
startTimeUnixNano, endTimeUnixNano |
Decimal strings representing Unix nanoseconds; convert to integers, then divide the difference by 1_000_000 for milliseconds |
status.code |
0/omitted means UNSET, 1 means OK, and 2 means ERROR. Errors can include status.message; none is a business correctness score |
attributes[] |
Entries such as {"key":"langsmith.span.kind","value":{"stringValue":"tool"}}, not a plain dictionary |
| Attribute values | stringValue, intValue, doubleValue, boolValue, arrayValue, and others; intValue can be a decimal string, while bytesValue remains Base64 |
langsmith.span.kind |
Distinguishes calls such as llm and tool. The top-level kind is the OTLP SpanKind enum and does not identify model or tool calls |
gen_ai.prompt, gen_ai.completion |
JSON-encoded input and output, usually in stringValue; decode that string a second time |
Array order is not execution order, and the first span is not necessarily the root. Traverse every resource and scope, connect IDs, then sort by start time. See format and fields for the complete JSON example and host correlation attributes.
Read inputs, outputs, and failures
Inputs and outputs are not exclusive to model spans. Select the target by langsmith.span.kind and node name, then interpret the decoded content:
| Target | What to inspect |
|---|---|
| Whole run | Root span without a parent ID; user messages in the input, final messages in the output, and start/end timestamps |
| Subagent | Subagent name and parent ID; delegated task, response, and internal steps |
| Model call | llm span; actual request messages and generations. Messages may use LangChain serialization, so do not assume a universal messages[].role/content shape |
| Tool call | tool span; arguments, result, and errors. The result may use an {"output": ...} wrapper; inspect the actual structure |
| Usage | Available gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, and gen_ai.usage.total_tokens on model spans. Keep missing values unknown instead of filling them with zero |
Content can include system prompts, history, and business data. Internal non-Agent middleware steps may retain timing without content. Models invoked directly inside ordinary tools have no separate model span. Files do not retain per-token events. A timeout or cancellation can mark a model span interrupted locally: local waiting stopped, but the provider's final outcome remains unknown. See data boundaries.
An OK root span only means the graph execution itself succeeded. SQL can execute successfully and still answer incorrectly. An A2A task can also fail while settling a checkpoint after the graph ends. Check protocol results, backend logs, and session artifacts together.
Supply records to our evaluation framework
First choose whether to evaluate the whole run, a model call, or a tool step, then select the corresponding spans. The file supplies execution evidence. Import format, case correlation, and scoring items depend on the framework's actual interface.
| Framework input | Evidence DataAgent provides | What the adapter must supply |
|---|---|---|
| Case-to-run correlation | Session ID, host run ID, native run ID, Trace/Span IDs | The framework's case ID and version or attempt number when a case runs more than once |
| Run question and answer | Available messages in the root Agent's input and output | Business rules for extracting the final answer without mistaking history or tool results for it |
| Model or tool step | langsmith.span.kind, name, parent IDs, input, and output |
Step-selection rules and the framework's field mapping |
| Latency and failure | Timestamps, status, and available error messages |
Treatment of timeout, cancellation, and unknown status; protocol failures also need logs and responses |
| Model usage | Recorded gen_ai.usage.* values |
Missing-value handling, deduplication, and counting boundaries; the framework defines pricing and cost calculations |
| Business correctness | Execution evidence and pointers to session artifacts | Reference answers, database snapshots or actual artifacts, and the scenario's scorer |
Validate the adapter against one run with a known outcome: locate the root, check the question and final output, follow parent IDs to one model call and one tool call, and confirm treatment of timing, errors, and missing values. Keep the original file and archive extracted records with the framework's case ID. Store scores in the framework's own result records and retain Trace/Span IDs for investigation.
Deduplicate repeated imports by traceId and spanId. When combining live and local records, also correlate native run IDs rather than assuming the OTLP IDs are identical. For comparisons across versions, fix questions, reference answers, configuration, and relevant data snapshots. For the SQLite-to-CSV tutorial, check the CSV's three expected totals rather than tool success alone.
These are the integration facts exposed by DataAgent. This repository does not define the external framework's API, authentication, upload commands, or scoring rules; use that framework's existing contract for the adapter.
Collect traces centrally when needed
Offline evaluation can read files directly. To collect spans live or send historical OTLP files, follow Live trace export. Transport moves records; our evaluation framework still performs scoring.