Skip to main content
Tracing provides observability for agent execution, tracking spans across LLM calls, tool executions, and workflows.

Quick Start

1

Create a Trace

2

Nested Spans


User Interaction Flow


TraceContext

Main tracing context that manages spans.

Methods


SpanKind

Type of operation being traced.

SpanStatus

Status of a span.

Span

Represents a unit of work.

Methods


SpanEvent

Events within a span.

Methods


TraceExporter Trait

Export traces to various backends.

Built-in Exporters


Example: Full Tracing


Best Practices

Categorize spans correctly for better visualization and filtering.
Include model names, token counts, user IDs - data useful for debugging.
Events mark important points within a span without creating new spans.
Use try/finally patterns or RAII to ensure spans are always closed.

Telemetry

Metrics and telemetry

Callbacks

Event callbacks