Reasoning traces

Every agent run and every AI function call produces a reasoning trace: a tree of timed spans covering each model call, each tool request and its response, each guardrail check and each proposal, with the exact version of every object the run read or cited. Traces are how you answer "why did the planner propose that", how you debug a slow run, how you replay a run against a new agent version, and how runs reach your own observability stack as OpenTelemetry

8 step kindsModel, tool, delegate, handback, ask, answer, check, note
VersionedEvery cited object is recorded at the version read
RecordedEvery model call and tool call, with its timing
OTLPExport to any OpenTelemetry collector

In the platform today

Built
  • Every agent run is a row in ops.agent_runs and every model call and tool call a row in ops.agent_steps, written as the run goes
  • Each step has its inputs, outputs and timing, tokens and cost on each model call, and, for an agent team, the member who took it
  • GET /api/v2/agents/{id}/runs/{run}/trace returns them, and ?after=<step> only the new ones
  • AI function runs are in ops.aifunction_runs and ops.aifunction_steps, and evaluation runs are logged to MLflow
  • A function called through POST /api/v2/functions/{name}:invoke with _trace: true among its arguments returns its result with trace: [{step, tool, input, summary, rows, ms}] added: every read it made under the caller's access, which is how a decision card shows what it was based on
  • When OTEL_EXPORTER_OTLP_ENDPOINT is set, agent.run, model.call and function.execute spans go to that collector over OTLP/HTTP, or OTLP/gRPC when OTEL_EXPORTER_OTLP_PROTOCOL is grpc
  • A request with a W3C traceparent joins that trace, as described on observability
On request
  • Spans for the functions a tool calls, guardrail spans, step-aligned comparison, aggregate views, replay, retention tiers and the generative AI attributes on this page

The span model

A trace is a tree of timed steps. Each step has a span id, its parent and its effect (reads data, proposes a change, asks the person, hands work on). The tools a model call asked for sit beneath it, and in a team a member's steps sit beneath the lead's hand-off. The Agents page draws it as a call tree and a nested timeline, and replays it step by step

On request, functions called by a tool have their own spans beneath it, so a slow step can be followed down to the object query that made it slow

Reading a trace

The trace view shows spans on a timeline, like a profiler. Each row is a span, indented under its parent, with a bar for its duration. Gaps between bars are time spent in the runtime, usually context assembly. Clicking a span shows its attributes, its request and response, and the objects it read. The example below is the weekend readiness planner checking the Nova Scotia shops on a Thursday afternoon

Span 0 s2 s4 s6 s8 s run agt-weekend v7 step 1 model plan · 1,840 in / 96 out tool find_shops · 14 objects step 2 model plan · 4,210 in / 140 out tool cover_for_shop × 14 weekend_cover · 9 cached step 3 model plan · 5,980 in / 88 out tool room_left step 4 guardrail citations · pass proposal reallocate-tubs step 5 · answer
Model calls (green) take most of the 8.4 seconds. The fourteen function calls in step 2 run four at a time, and nine of them are served from the function cache

Two patterns are common in slow runs

  • Sequential tool calls. A long tail of tool calls where one batched call would do shows as a staircase of short tool bars between model calls. The fix is usually a function that takes an object set instead of one object
  • A growing context. Model spans get longer step after step as input tokens climb. The step span's context size attribute shows when summarization kicked in, and the model span's cached tokens show how much of the prompt the provider reused

Comparing traces

Two runs of one agent open side by side, typically a run and the same run started again with changes: what each was asked, its context, answer, proposals, steps, tokens and cost (GET /api/v2/agents/{id}/runs/{run}/compare?with=<run>)

On request, the two traces are aligned by step, showing where the runs diverged: a different tool, different arguments or different results because the data had changed. Aggregate views across many runs of one agent version show the steps per run, the tools used most, how runs ended and the slowest spans

Span attributes

GET /api/v2/agents/agt-weekend/runs/run_01JA2F6Q…/trace

In the platform service the call returns the run's record with its steps in order. A step's input and output are JSON text, clipped at 4,000 and 6,000 characters

{
  "run_id": "run_01JA2F6Q…", "agent": "agt-weekend", "user_id": "shops.nguyen",
  "status": "completed", "mode": "model", "steps": 6, "tool_calls": 9,
  "proposals": ["prop_01JA2F7B…"], "cited": ["shop:SHP-BSL", "shop:SHP-PGC"],
  "input_tokens": 18420, "output_tokens": 1312, "cost_cad": 0.21,
  "error": null, "members": null,
  "trace": [
    { "step": 1, "kind": "model", "tool": null, "input": "{…}", "output": "{…}",
      "status": "ok", "ms": 1840.2, "member": null,
      "span": "sp_01JA2F6R…", "parent": null, "effect": "model" },
    { "step": 2, "kind": "tool", "tool": "search_objects", "input": "{…}", "output": "{…}",
      "status": "ok", "ms": 212.4, "member": null,
      "span": "sp_01JA2F6S…", "parent": "sp_01JA2F6R…", "effect": "read" },
    "…"
  ]
}

Each step carries its span id, the parent span of the step that led to it, such as the model turn that asked for a tool or the hand-off a member works under, and its effect: read, propose, model, delegate, report, ask or answer. A model step also has its input_tokens, output_tokens and cost_cad. On request, each step also lists the objects it read at their versions

Cited objects

A trace records two sets of objects. Objects read are everything any tool returned to the agent. Objects cited are the subset the agent pointed to in its final answer or in a proposal's rationale. Both are stored as resource names with the version that was read, not just the primary key. When you open a cited shop from a trace, the object page opens at that version, with a banner showing what has changed since. This is what lets a reviewer judge a proposal by the facts the agent had, not by the facts as they are now

Citations also run the other way. Each object's activity panel lists recent runs that cited it, so the city shop's page shows that the planner considered it on Thursday, what it concluded and what it proposed. The same index answers audit questions such as "which runs read batch B-0841 between the failed check and the hold"

Read is not the same as relied on

An agent can read fifty objects and cite three. Evaluations that check grounding compare cited objects against the facts in the answer. The read set is for debugging and audit: it shows what the agent could have used, which matters when it missed something

Payloads, redaction and retention

Traces store full payloads: rendered prompts, model outputs, tool requests and tool responses. Those payloads contain your operational data, so they carry the same controls as the objects in them. Each span is tagged with the union of access labels on every object it read. To open a span's payload, a viewer must hold every one of those access labels and be able to read the run's agent. A viewer without them sees the span's timing, kind and status, with the payload replaced by a notice naming the missing access labels

  • Field access applies at trace time and again at view time. A property masked for the person the agent acted for was never in the payload. A property visible to them but masked for the viewer is masked in the view
  • Gateway redaction, described in model adapters, is recorded by kind and count, never the redacted values. In the platform service the counts are in ops.model_redactions and on each ops.model_usage row; on request they are also on the model span
  • On request, full payloads are kept for a set period, after which spans keep their timing, status, token counts, cost and the resource names and versions of cited objects
  • Run summaries, proposals and their decisions are part of the audit log and follow its retention

Replay

On request, a past run can be replayed exactly or against its original data with a new agent version, and any trace can become an evaluation case

Exporting as OpenTelemetry

The platform service sends spans over OTLP/HTTP with protobuf or over OTLP/gRPC, set with the standard OTEL_EXPORTER_OTLP_* variables

SpanAttributes
agent.runms.agent, ms.agent.mode, ms.agent.run_id, ms.agent.status
model.callms.tier, ms.purpose, ms.model, ms.tokens_in, ms.tokens_out, ms.cache_hit

Trace and span ids are W3C Trace Context ids, and a run started from your own app with a traceparent header joins your existing trace

On request, exporters are set in the tenant's observability settings, with their own sampling and payload choices, and attributes follow the OpenTelemetry semantic conventions for generative AI. Every run is still traced in full inside the platform, and payloads are not exported unless you choose to, because most collectors do not enforce access labels. Traces can also be written to MLflow, so evaluation runs and production runs are compared in the same tool

Limitations

  • A viewer who lacks any access label on the objects a span read sees its timing and status but not its payload, even if they can read the agent
  • After the payload retention period, spans keep timing, tokens, cost and cited resource names only; full prompts and responses cannot be recovered
  • Snapshot replay reads the Ontology as of the original run but calls models live, so a replay can differ from the original even with no change to the agent
  • Export sampling and payload settings apply only to your collector, and most collectors do not enforce access labels, so payloads are not exported unless you choose to
  • The read set records what the agent was given, not what it used; only cited objects show what it relied on

Related