get_trace_tree
Retrieve the complete hierarchical span tree of a trace to examine nested spans, parent-child relationships, inputs, outputs, latency, and token usage.
Instructions
Retrieve the complete hierarchical span tree of a single trace.
Returns detailed trace information with the full span_tree structure showing:
All spans in the trace with parent-child relationships
Full input/output for each span
Timing and performance metrics per span
Model and token usage per LLM span
Nested children spans forming the execution tree
TRACE FIELDS:
trace_unique_id: Unique identifier
start_time, end_time: Trace time range
duration: Total duration in seconds
span_count: Total number of spans
llm_call_count: Number of LLM calls
total_prompt_tokens, total_completion_tokens, total_tokens: Aggregate token usage
total_cost: Total cost in USD
error_count: Number of errors
metadata: Custom metadata object
customer_identifier: User identifier
environment: Environment name
SPAN TREE STRUCTURE: Each span in span_tree contains:
span_unique_id: Unique span identifier
span_name: Name of the operation
span_parent_id: Parent span ID (null for root)
log_type: Span type (CHAT, COMPLETION, FUNCTION, TASK, WORKFLOW, etc.)
start_time, timestamp: Span timing
latency: Duration in seconds
input: Full span input data
output: Full span output data
model: Model used (for LLM spans)
prompt_tokens, completion_tokens: Token counts
cost: Cost in USD
status: Status (success, error)
status_code: HTTP-like status code
children: Array of nested child spans
Use list_traces first to find trace_unique_id, then use this for full span tree.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_time | No | End time filter in ISO 8601 format | |
| trace_id | Yes | Trace unique ID (trace_unique_id field from list_traces) | |
| start_time | No | Start time filter in ISO 8601 format | |
| environment | No | Environment filter (if trace exists in multiple environments) |