- OpenTelemetry export — distributed traces, metrics, and structured logs pushed to any OTLP-compatible backend (Jaeger, Grafana, Datadog, etc.). Configured once at agent creation.
- Run-level telemetry —
AgentTelemetryon everyAgentRunResult. LLM round counts, tool breakdowns, and storage operation summaries returned inline with each result. No configuration required.
Enable OpenTelemetry
PassWithObservabilityConfig to wire traces, metrics, and logs in one block:
WithObservabilityConfig on NewAgent and NewAgentWorker. LLM calls and tool executions run on the worker process — without matching config those spans and metrics are dropped.
Opt out of individual signals:
Run-level telemetry (AgentTelemetry)
Every completed run populates AgentTelemetry on AgentRunResult. This is run-level behavioral data returned with the result — separate from OTLP export. Use it for app-side logging, dashboards, and eval harness assertions.
Structure
AgentTelemetry has three sections:
Fields are zero when the corresponding feature is not configured (no retriever → retriever counts are 0; no memory → memory counts are 0).
Run telemetry
max_iterations means the run hit WithMaxIterations before producing a final answer.
Tool telemetry
Covers native tools, MCP tools, retriever tools, and sub-agent delegation tools.
Storage telemetry
See Retrieval and Memory for when each counter increments.
Run
Stream
Telemetry is onResult.Telemetry inside the AgentEventTypeRunFinished event:
Token usage vs telemetry
See Token Usage.
Eval harness
Telemetry fields are designed for eval assertions — total LLM calls, tool breakdown, finish reason, and storage counts. See Eval Harness.Example
Telemetry
SHOW_TELEMETRY on run results
Related
Metrics
OTLP counters and histograms
Tracing
Distributed spans per LLM and tool call