---
title: "Anthropic"
description: "Adds instrumentation for the Anthropic SDK. (default)"
url: https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations/anthropic/
---

# Anthropic | Sentry for React Router Framework

Requires SDK version `11.0.0` or higher. On earlier versions, see the [Agent Tracing](https://docs.sentry.io/platforms/javascript/agent-tracing.md) setup for your SDK.

*Import name: `Sentry.anthropicAIIntegration`*

This integration is enabled by default when tracing is enabled. If you'd like to modify your default integrations, read [this](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations.md#modifying-default-integrations).

The `anthropicAIIntegration` adds instrumentation for the [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) SDK to capture [agent tracing](https://docs.sentry.io/platforms/javascript/guides/react-router/agent-tracing.md) `gen_ai` spans, recording model, token usage, latency, and (when enabled) inputs and outputs.

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  // Tracing must be enabled for agent tracing to work
  tracesSampleRate: 1.0,
  integrations: [Sentry.anthropicAIIntegration()],
});
```

## [Supported Operations](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations/anthropic.md#supported-operations)

By default, tracing support is added to the following Anthropic SDK calls:

* `messages.create()` - Create messages with Claude models
* `messages.stream()` - Stream messages with Claude models
* `completions.create()` - Create completions (legacy)
* `beta.messages.create()` - Beta messages API

Streaming and non-streaming requests are automatically detected and handled appropriately.

## [Supported Versions](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations/anthropic.md#supported-versions)

* `@anthropic-ai/sdk`: `>=0.19.2 <1.0.0`

## [Options](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations/anthropic.md#options)

### [`recordInputs`](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations/anthropic.md#recordinputs)

*Type: `boolean` (optional)*

Records inputs to Anthropic SDK calls (such as prompts and messages).

Defaults to `true` if `dataCollection.genAI.inputs` is `true` (which is the default when using `dataCollection`), or if the deprecated `sendDefaultPii` is `true`.

### [`recordOutputs`](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations/anthropic.md#recordoutputs)

*Type: `boolean` (optional)*

Records outputs from Anthropic SDK calls (such as generated text and responses).

Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the default when using `dataCollection`), or if the deprecated `sendDefaultPii` is `true`.

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  tracesSampleRate: 1.0,
  integrations: [
    Sentry.anthropicAIIntegration({
      recordInputs: true,
      recordOutputs: true,
    }),
  ],
});
```
