What is Tracing?
Tracing creates a hierarchical record (trace) of all operations in a request:- Trace - Complete execution of a request (identified by
traceId) - Span - Individual operation within a trace (agent call, tool execution, etc.)
- Parent-Child Relationships - Spans nest to show execution flow
Basic Usage
Automatic Tracing
All agent and workflow operations are automatically traced:Retrieving Traces
Access trace data after execution:Span Types
Agent Run Span
Root span for agent execution:Model Generation Span
Captures LLM API calls:Tool Call Span
Captures tool/function execution:Workflow Spans
Captures workflow execution:Trace Metadata
Adding Metadata
Attach custom metadata to traces:Using Tags
Categorize traces with tags:Request Context Keys
Automatically extract fields from RequestContext:Privacy Controls
Hiding Input/Output
Protect sensitive data:Redacting Stream Data
Control what’s sent to clients in streams:Trace Linking
Parent Trace ID
Link traces across service boundaries:Parent Span ID
Create child spans in existing trace:Annotations
Adding Scores
Add quality scores to traces:Adding Feedback
Capture user feedback:Span Navigation
Tree Traversal
Navigate span hierarchy:Finding Spans
Locate specific spans:Performance Metrics
Calculate performance metrics from spans:Next Steps
Logging
Configure structured logging
Evals
Evaluate agent quality with scorers