← Back to Cookbook

Trace Claude Managed Agents and the Messages API in Sentry

The Claude Platform exports OpenTelemetry (OTel) traces natively. Select Sentry as a destination in the Claude Console, paste your DSN, and see every model call, tool call, and token from Claude Managed Agents and the Messages API, with no code to change.

Category Monitoring, Debugging
Time
5 minutes
Complexity
Beginner
Steps
4 steps

Before you start

Accounts & access
Knowledge
  • Basic familiarity with the Claude Messages API or Claude Managed Agents

1
Copy your Sentry DSN

Go to Settings → Projects, select the project for your agent, and open Client Keys (DSN). Copy the DSN. The Claude Console uses it to find your project's OpenTelemetry Protocol (OTLP) endpoint and authentication key.

Sentry OTLP ingestion docs

2
Add Sentry as a destination in the Claude Console

In the Claude Console, open the OpenTelemetry settings page of your organization and click Add destination. This one setting covers Claude Managed Agents sessions and Messages API requests.

  • Provider: select Sentry.
  • DSN: paste the DSN from step 1.
  • Content mode: Full content to read prompts, responses, and tool input and output in Sentry, or Metadata only for timing, status, and token counts.
  • Set as organization default: select it for your first destination. To send one workspace to a different Sentry project, add a destination to that workspace instead.
Claude Console destination setup
Add destination dialog in the Claude Console with Sentry selected as the provider, a DSN field, and the Metadata only and Full content options

3
Check that traces arrive

Send a Messages API request with an API key from a workspace that uses the destination, or run a Claude Managed Agents session. In the Claude Console, the Delivery column on the OpenTelemetry settings page changes to Healthy after the first traces are sent. Then open Agents under Explore in Sentry. Your session or request shows on the Conversations, Traces, and LLM Calls tabs. Select a conversation, open the Timeline tab, and select a tool call to see its input and output.

Sentry conversation timeline for a Claude Managed Agents session, showing Coordinator turns with anthropic.model_request, web_fetch, and bash spans, and a detail panel with the input command of the selected bash tool call

4
Explore Claude agent conversations in Sentry

Open Agents under Explore in Sentry. The charts at the top show estimated cost, agent runs, and tool calls over time. On the Conversations tab, each Claude Managed Agents session thread, and each conversation_id that you set in the SDK, is one row with its messages, errors, cost, and tools. Select a row to open the conversation. The Transcript tab shows the messages and each tool call in order, and marks failed tool calls as errors. The Timeline tab shows each turn, model request, and tool call with its duration and tokens.

AI Agents monitoring docs
Sentry conversation transcript for a Claude Managed Agents session about weather and public holidays, with user messages, agent answers, bash tool calls, and a summary of 10 LLM calls, 3 errors, 116K tokens, and $0.253 cost

That's it.

Every model call, tool call, and token. In the trace you already debug.

Claude agent traces land in the same Sentry project as your errors and backend spans, so you can debug a failed agent run, find slow tool calls, and track token spend without a new tool.

  • Copied the DSN of your Sentry project
  • Added Sentry as an OpenTelemetry destination in the Claude Console
  • Sent traces from Claude Managed Agents and the Messages API with no code changes
  • Read Claude agent conversations, tool calls, and token usage in Sentry

Pro tips

  • 💡 Use Full content for the destination. Without prompts and responses, you see that a run failed, but not why.
  • 💡 Give each Claude workspace its own destination to send each agent to its own Sentry project.
  • 💡 Add the Claude SDK to your application to see your own spans and each tool that your code runs in the same trace. See the recipes for TypeScript and Python.

Common pitfalls

  • ⚠️ Looking for prompts on model request spans. The Claude Platform puts the conversation on the agent spans and tool input and output on the tool spans. Select a tool span, or use the Transcript tab.
  • ⚠️ Sending requests with an API key from a workspace that has its own destination. A workspace destination replaces the organization default, so the traces of that workspace go only to its own destination.

Frequently asked questions

No. The Claude Platform sends standard OpenTelemetry traces, and Sentry ingests them at its OTLP endpoint. For Claude Managed Agents and the Messages API, you only add a destination in the Claude Console.

Claude Managed Agents and the Messages API on the first-party Claude Platform, from any language. Amazon Bedrock and Google Cloud Vertex AI are not supported. The Claude Platform export and Sentry's OTLP ingestion are both in public beta, so span names and attributes can change.

Only if you select Full content for the destination. With Metadata only, spans carry identifiers, timing, status, and token counts. Sentry stores what it receives under your project's retention and data scrubbing settings.

Spans are billed by volume, the same as other Sentry tracing data. Sentry's free plan includes a span quota that is enough to try this out.

Fix it, don't observe it.

Get started with the only application monitoring platform that empowers developers to fix application problems without compromising on velocity.