Retrieve detailed trace information with hierarchical span tree, or a specific span within the trace.
Without span_id parameter: Returns the full trace with hierarchical span tree:
With span_id parameter: Returns details for a specific span within the trace:
Span Hierarchy (full trace):
The tree field contains root spans, each with potential children.
This recursive structure represents the execution flow:
Agent.run (root)
├─ LLM.invoke
├─ Tool.execute
│ └─ LLM.invoke (nested)
└─ LLM.invoke
Span Types:
AGENT: Agent execution with input/outputLLM: Model invocations with tokens and promptsTOOL: Tool calls with parameters and resultsBearer authentication header of the form Bearer <token>, where <token> is your auth token.
Optional: Span ID to retrieve specific span
Optional: Run ID to retrieve trace for
Database ID to query trace from
Trace or span detail retrieved successfully
Detailed trace information with hierarchical span tree
Unique trace identifier
Trace name (usually root span name)
Overall status (OK, ERROR)
Human-readable total duration
Trace start time (Pydantic auto-serializes to ISO 8601)
Trace end time (Pydantic auto-serializes to ISO 8601)
Total number of spans in this trace
Number of spans with errors
Time when trace was created (Pydantic auto-serializes to ISO 8601)
Hierarchical tree of spans (root nodes)
Input to the agent/workflow
Output from the agent/workflow
Error message if status is ERROR
Associated run ID
Associated session ID
Associated user ID
Associated agent ID
Associated team ID
Associated workflow ID