# Trace Claude Managed Agents and the Messages API in Sentry

> Send OpenTelemetry traces from Claude Managed Agents and the Messages API to Sentry with no code. See every model call, tool call, and token in one trace.

**URL:** https://sentry.io/cookbook/trace-claude-platform-with-opentelemetry/

---

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.

**Time:** 5 minutes | **Difficulty:** Beginner

## What You'll Learn

- 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

**Topics:** Tracing, AI Observability, Agent Tracing

## Before you start

**Accounts & access**

- [Sentry account](https://sentry.io/signup/) with a project for your agent

- Admin role in a [Claude Console](https://platform.claude.com/) organization

**Knowledge**

- Basic familiarity with the Claude Messages API or Claude Managed Agents

## Steps

### 1. Copy your Sentry DSN

Go to [Settings → Projects](https://sentry.io/orgredirect/organizations/:orgslug/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](https://docs.sentry.io/concepts/otlp/)

### 2. Add Sentry as a destination in the Claude Console

In the Claude Console, open the [OpenTelemetry settings page](https://platform.claude.com/settings/telemetry-destinations) 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](https://platform.claude.com/docs/en/manage-claude/opentelemetry#add-a-destination)

### 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](https://sentry.io/orgredirect/organizations/:orgslug/explore/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.

### 4. Explore Claude agent conversations in Sentry

Open [Agents](https://sentry.io/orgredirect/organizations/:orgslug/explore/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](https://docs.sentry.io/product/agents/)

## Summary

**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.

## 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](/cookbook/trace-claude-typescript-sdk-with-opentelemetry/) and [Python](/cookbook/trace-claude-python-sdk-with-opentelemetry/).

## 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.

## FAQ

**Do I need the Sentry SDK for this?**

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.

**Which Claude products are supported?**

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.

**Are prompts and responses sent to Sentry?**

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.

**How much does it cost?**

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.

## Next Steps

- [Add Claude TypeScript SDK spans](/cookbook/trace-claude-typescript-sdk-with-opentelemetry/): Trace your own TypeScript code and the tools that it runs, in the same trace as the Claude Platform spans.

- [Add Claude Python SDK spans](/cookbook/trace-claude-python-sdk-with-opentelemetry/): Trace your own Python code and the tools that it runs, in the same trace as the Claude Platform spans.

- [Read the Claude span reference](https://platform.claude.com/docs/en/api/opentelemetry/spans): See every span and attribute that the Claude SDK and the Claude Platform emit.

- [Monitor your AI agents](https://docs.sentry.io/product/agents/): Track agent runs, tool calls, and token usage across all your AI features.

---

*Source: [sentry.io/cookbook/trace-claude-platform-with-opentelemetry/](https://sentry.io/cookbook/trace-claude-platform-with-opentelemetry/)*
