Anthropic Opens Claude Tracing so Developers Can Debug AI Agent Failures
Anthropic's Claude Platform now emits OpenTelemetry traces from the Messages API, Managed Agents, and SDKs so you can debug agents in your existing observability stack.
- Claude Platform can now emit OpenTelemetry traces from Messages API, Managed Agents, and SDKs (public beta).
- Spans follow
gen_aiconventions and carry duration, tokens, model, and tool names by default. - Full-content mode exports prompts, responses, tool inputs, and tool results for deep debugging.
- Presets for Datadog, Honeycomb, Grafana, Langfuse, Braintrust, Arize, Sentry, and custom OTLP endpoints.
- W3C traceparent propagation nests Claude spans inside your app traces and into MCP servers.
- SDK tracing picks up any registered tracer provider with no code changes to call sites.
Anthropic adds OpenTelemetry tracing for Claude
Anthropic has opened a public beta that lets the Claude API, Managed Agents, and Claude SDKs export OpenTelemetry traces to any OTLP-compatible backend. The beta documentation describes server-side spans for model requests and tool calls, giving developers a way to inspect Claude activity alongside the rest of an application’s telemetry.
OpenTelemetry is a vendor-neutral standard for collecting traces, metrics, and logs. OTLP is its transport protocol, while a span is a timed record of one operation within a trace. Together, they let teams follow a request across an application, Claude, and downstream tools without maintaining a separate observability system for the model layer.
Two routes into the trace
The beta provides separate integration paths for server-side export and application-level tracing, depending on where a team wants to collect and connect spans.
| Path | Setup | Result |
|---|---|---|
| Claude Console | Register an OTLP/HTTP destination and select workspaces | Exports API and Managed Agents spans without application changes |
| Claude SDK | Register an OpenTelemetry tracer provider | Creates client spans and propagates trace context to the API |
| MCP connector | Instrument the connected MCP server | Attaches downstream tool spans to the same trace |
Server spans without app changes
Console destinations point to an OTLP/HTTP endpoint and include the credentials required by the receiving service. Once a destination covers a workspace, Claude can export spans for model requests and tool use from that workspace.
Each span follows OpenTelemetry’s gen_ai semantic conventions, which define common names for generative AI operations and attributes. Metadata-only mode records fields such as duration, status, token counts, model names, and tool names. Full-content mode also records prompts, responses, tool inputs, and tool results.
Full-content traces can expose credentials, personal data, proprietary text, and untrusted tool output to an observability provider. Teams enabling that mode should review destination access controls, retention policies, redaction rules, and regional data requirements.
OTLP keeps routing flexible
Anthropic lists presets for several general-purpose and LLM-focused observability services:
- Datadog, New Relic, Splunk, Honeycomb, and Grafana Cloud
- Sentry and PostHog
- Arize AI, Braintrust, Langfuse, and LangChain
- Databricks
- Self-hosted OpenTelemetry Collectors
Custom destinations work through any compatible OTLP endpoint. A self-hosted Collector must accept OTLP/HTTP with protobuf encoding through an HTTPS URL on port 443. Since Collectors commonly listen on port 4318, many deployments will need a reverse proxy or load balancer in front of the Collector.
One trace across app, Claude, and MCP
Applications using a Claude SDK can register an OpenTelemetry tracer provider, the component that creates spans and sends them through configured processors and exporters. The SDK then uses that provider without requiring changes to individual Claude calls.
from anthropic import Anthropic
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
ConsoleSpanExporter,
SimpleSpanProcessor,
)
provider = TracerProvider()
provider.add_span_processor(
SimpleSpanProcessor(ConsoleSpanExporter())
)
trace.set_tracer_provider(provider)
client = Anthropic()
client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude"}
],
)Each outgoing SDK request can carry a W3C traceparent header, which identifies the parent trace and span. When the application and Anthropic export to the same backend, API spans appear beneath the application span that initiated the request.
The sampled flag in traceparent also controls server-side collection. If the client marks a request as unsampled, the API omits that request’s span and its descendants. This allows an application’s existing sampling policy to limit telemetry volume across high-throughput agent workloads.
Trace propagation can continue through Anthropic’s MCP connector. The Messages API forwards the trace context to the connected MCP server, which can create child spans for its own work. A single trace can therefore cover application code, Claude processing, and downstream tool execution.
Controls for content and volume
traces.content_modedefaults tometadata_only. Setting it tocontentcaptures prompts and responses.traces.max_content_byteslimits recorded content per span. The default is 0.75 MB and can be adjusted for backend limits and ingest costs.conversation_idpopulatesgen_ai.conversation.idso related turns can be grouped. The value is exported in both content modes, so it should not contain secrets or personal data.propagationdisables SDK header injection when existing HTTP instrumentation already propagates trace context.open_telemetry=Falsedisables tracing for one client, which prevents duplicate spans when another library already instruments the SDK.
The SDK guide documents these options and their environment-variable equivalents.
What the spans can diagnose
Agent requests often fan out into multiple model calls, tool executions, MCP hops, and streamed responses. Connected spans expose where time and tokens were spent, which operation failed, and how downstream services affected the final response.
- Attribute latency and errors to specific model or tool operations
- Associate input and output token usage with individual spans
- Follow requests across application, Claude, and MCP boundaries
- Inspect prompts and tool results when full-content mode is enabled
- Group multi-turn activity with a conversation identifier
Managed Agents sessions run on Anthropic’s infrastructure, so application logs cannot describe their internal execution. Exported spans add those server-side operations to the application’s trace, allowing teams to profile a managed session with the same dashboards and queries used for other services.
Beta limits and privacy trade-offs
Beta SDK options and span schemas may change between releases. Anthropic may rename spans, attributes, environment variables, or configuration fields, which can break saved queries and dashboards. Teams that depend on current names should pin SDK versions and test telemetry changes before upgrading.
Delivery is best-effort and at-least-once, so backends may receive duplicate spans or encounter gaps. Consumers should deduplicate using trace and span IDs and avoid treating trace delivery as an audit log.
Anthropic caps each organization at 10 destinations and 1,000 selected workspaces per destination. Organizations operating heavily partitioned tenant environments may need to account for those limits when designing routing and access boundaries.
Full-content mode may be silently reduced to metadata-only mode for organizations covered by Anthropic’s HIPAA, FERPA, or K-12 data-handling restrictions. Because conversation_id remains present in both modes, identifiers still require careful handling.
Anthropic does not charge separately for OpenTelemetry export, though observability providers may charge for ingest, storage, and queries. Teams already using OpenTelemetry can add Claude activity to existing traces and dashboards while retaining their current backend and sampling policy.