v3

latestOpenAPI 3.0.02026-08-081996601.2 MB
Agent Analytics

List spans in a trace

Returns the flat list of spans for a given trace. Each span includes its parent_span_id so you can reconstruct the tree.

get/v2/agent_analytics/traces/{trace_id}/spans

Path parameters

trace_idstring required

The unique identifier of the trace.

Query parameters

include_contentboolean

When true, include span content such as input and output messages and tool arguments.

operation'invoke_agent' | 'chat' | 'execute_tool' | 'thinking' | 'output' | 'step_transition' | 'image_read' | 'compaction'

Restrict to spans with this operation.

parent_span_idstring

Filter spans to only direct children of this span ID.

exclude_subagentsboolean

When true, exclude nested sub-agent invocations and their descendants. Restricts results to the entry-point invoke_agent span and any spans that belong to the entry agent's session.

limitinteger

The maximum number of spans to return.

page_keystring

The opaque cursor returned in metadata.page_key of the previous response. Omit it to fetch the first page.

Headers

Request-Timeoutinteger

The platform makes a best effort to complete the request in the specified seconds, or it times out.

Request-Timeout-Millisinteger

The platform makes a best effort to complete the request in the specified milliseconds, or it times out.

Response

List of spans in the trace.

Example response

{
  "spans": [
    {
      "span_id": "b7ad6b7169203331",
      "operation": "invoke_agent"
    }
  ],
  "metadata": {
    "page_key": "eyJvZmZzZXQiOjF9"
  }
}