Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ Requires SDK version `11.0.0` or higher. On earlier versions, see the [Agent Tra

</Alert>

<PlatformSection notSupported={["javascript.cloudflare"]}>

_Import name: `Sentry.anthropicAIIntegration`_

</PlatformSection>

This integration is enabled by default when tracing is enabled. If you'd like to modify your default integrations, read [this](./../#modifying-default-integrations).

The `anthropicAIIntegration` adds instrumentation for the [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) SDK to capture <PlatformLink to="/agent-tracing/">agent tracing</PlatformLink> `gen_ai` spans, recording model, token usage, latency, and (when enabled) inputs and outputs.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -27,6 +33,26 @@ Sentry.init({
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, there is no `Sentry.init()`. Add `sentryCloudflareVitePlugin()` alongside Cloudflare's Vite plugin so the bundled Anthropic SDK is instrumented:

```typescript {filename:vite.config.mts}
import { cloudflare } from "@cloudflare/vite-plugin";
import { sentryCloudflareVitePlugin } from "@sentry/cloudflare/vite";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [cloudflare(), sentryCloudflareVitePlugin()],
});
```

Build-time instrumentation is enabled by default, and the plugin registers the integration in both `vite dev` and `vite build`. Keep the `nodejs_compat` flag enabled in your Wrangler configuration, and see the <PlatformLink to="/install/vite-plugin/">Vite plugin</PlatformLink> page for the full setup. Without the plugin, or with `buildTimeInstrumentation: false`, wrap your client with `Sentry.instrumentAnthropicAiClient()`.

</PlatformSection>

## Supported Operations

By default, tracing support is added to the following Anthropic SDK calls:
Expand Down Expand Up @@ -60,6 +86,8 @@ 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.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -72,3 +100,23 @@ Sentry.init({
],
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, `@sentry/cloudflare` doesn't export `anthropicAIIntegration`, so set these through the `dataCollection` option in your `instrument.server.ts` file instead. This applies to all AI integrations:

```typescript {filename:src/instrument.server.ts}
import * as Sentry from "@sentry/cloudflare";

export default Sentry.defineCloudflareOptions((env) => ({
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 1.0,
dataCollection: {
genAI: { inputs: false, outputs: false },
},
}));
```

</PlatformSection>
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ Requires SDK version `11.0.0` or higher. On earlier versions, see the [Agent Tra

</Alert>

<PlatformSection notSupported={["javascript.cloudflare"]}>

_Import name: `Sentry.googleGenAIIntegration`_

</PlatformSection>

This integration is enabled by default when tracing is enabled. If you'd like to modify your default integrations, read [this](./../#modifying-default-integrations).

The `googleGenAIIntegration` adds instrumentation for the [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK to capture <PlatformLink to="/agent-tracing/">agent tracing</PlatformLink> `gen_ai` spans, recording model, token usage, latency, and (when enabled) inputs and outputs.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -27,6 +33,26 @@ Sentry.init({
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, there is no `Sentry.init()`. Add `sentryCloudflareVitePlugin()` alongside Cloudflare's Vite plugin so the bundled Google Gen AI SDK is instrumented:

```typescript {filename:vite.config.mts}
import { cloudflare } from "@cloudflare/vite-plugin";
import { sentryCloudflareVitePlugin } from "@sentry/cloudflare/vite";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [cloudflare(), sentryCloudflareVitePlugin()],
});
```

Build-time instrumentation is enabled by default, and the plugin registers the integration in both `vite dev` and `vite build`. Keep the `nodejs_compat` flag enabled in your Wrangler configuration, and see the <PlatformLink to="/install/vite-plugin/">Vite plugin</PlatformLink> page for the full setup. Without the plugin, or with `buildTimeInstrumentation: false`, wrap your client with `Sentry.instrumentGoogleGenAIClient()`.

</PlatformSection>

## Supported Operations

By default, tracing support is added to the following Google Gen AI SDK calls:
Expand Down Expand Up @@ -62,6 +88,8 @@ Records outputs from Google Gen AI SDK calls (such as generated text and respons

Defaults to `true` if `dataCollection.genAI.outputs` is `true`, which is the default.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -74,3 +102,23 @@ Sentry.init({
],
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, `@sentry/cloudflare` doesn't export `googleGenAIIntegration`, so set these through the `dataCollection` option in your `instrument.server.ts` file instead. This applies to all AI integrations:

```typescript {filename:src/instrument.server.ts}
import * as Sentry from "@sentry/cloudflare";

export default Sentry.defineCloudflareOptions((env) => ({
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 1.0,
dataCollection: {
genAI: { inputs: false, outputs: false },
},
}));
```

</PlatformSection>
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ Requires SDK version `11.0.0` or higher. On earlier versions, see the [Agent Tra

</Alert>

<PlatformSection notSupported={["javascript.cloudflare"]}>

_Import name: `Sentry.langChainIntegration`_

</PlatformSection>

This integration is enabled by default when tracing is enabled. If you'd like to modify your default integrations, read [this](./../#modifying-default-integrations).

The `langChainIntegration` adds instrumentation for [`langchain`](https://www.npmjs.com/package/langchain) to capture <PlatformLink to="/agent-tracing/">agent tracing</PlatformLink> `gen_ai` spans, recording model, token usage, latency, and (when enabled) inputs and outputs.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -27,6 +33,26 @@ Sentry.init({
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, there is no `Sentry.init()`. Add `sentryCloudflareVitePlugin()` alongside Cloudflare's Vite plugin so the bundled LangChain is instrumented:

```typescript {filename:vite.config.mts}
import { cloudflare } from "@cloudflare/vite-plugin";
import { sentryCloudflareVitePlugin } from "@sentry/cloudflare/vite";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [cloudflare(), sentryCloudflareVitePlugin()],
});
```

Build-time instrumentation is enabled by default, and the plugin registers the integration in both `vite dev` and `vite build`. Keep the `nodejs_compat` flag enabled in your Wrangler configuration, and see the <PlatformLink to="/install/vite-plugin/">Vite plugin</PlatformLink> page for the full setup. Without the plugin, or with `buildTimeInstrumentation: false`, pass a handler from `Sentry.createLangChainCallbackHandler()` in your LangChain `callbacks`.

</PlatformSection>

## Supported Operations

By default, tracing support is added to the following LangChain operations:
Expand Down Expand Up @@ -125,6 +151,8 @@ Records outputs from LangChain operations (such as generated text and responses)

Defaults to `true` if `dataCollection.genAI.outputs` is `true`, which is the default.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -137,3 +165,23 @@ Sentry.init({
],
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, `@sentry/cloudflare` doesn't export `langChainIntegration`, so set these through the `dataCollection` option in your `instrument.server.ts` file instead. This applies to all AI integrations:

```typescript {filename:src/instrument.server.ts}
import * as Sentry from "@sentry/cloudflare";

export default Sentry.defineCloudflareOptions((env) => ({
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 1.0,
dataCollection: {
genAI: { inputs: false, outputs: false },
},
}));
```

</PlatformSection>
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ Requires SDK version `11.0.0` or higher. On earlier versions, see the [Agent Tra

</Alert>

<PlatformSection notSupported={["javascript.cloudflare"]}>

_Import name: `Sentry.langGraphIntegration`_

</PlatformSection>

This integration is enabled by default when tracing is enabled. If you'd like to modify your default integrations, read [this](./../#modifying-default-integrations).

The `langGraphIntegration` adds instrumentation for [`@langchain/langgraph`](https://www.npmjs.com/package/@langchain/langgraph) to capture <PlatformLink to="/agent-tracing/">agent tracing</PlatformLink> `gen_ai` spans, recording model, token usage, latency, and (when enabled) inputs and outputs.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -27,6 +33,26 @@ Sentry.init({
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, there is no `Sentry.init()`. Add `sentryCloudflareVitePlugin()` alongside Cloudflare's Vite plugin so the bundled LangGraph is instrumented:

```typescript {filename:vite.config.mts}
import { cloudflare } from "@cloudflare/vite-plugin";
import { sentryCloudflareVitePlugin } from "@sentry/cloudflare/vite";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [cloudflare(), sentryCloudflareVitePlugin()],
});
```

Build-time instrumentation is enabled by default, and the plugin registers the integration in both `vite dev` and `vite build`. Keep the `nodejs_compat` flag enabled in your Wrangler configuration, and see the <PlatformLink to="/install/vite-plugin/">Vite plugin</PlatformLink> page for the full setup. Without the plugin, or with `buildTimeInstrumentation: false`, use [Manual Instrumentation](#manual-instrumentation).

</PlatformSection>

## Supported Operations

By default, tracing support is added to the following LangGraph operations:
Expand Down Expand Up @@ -89,6 +115,8 @@ Records outputs from LangGraph operations (such as generated responses, agent ou

Defaults to `true` if `dataCollection.genAI.outputs` is `true`, which is the default.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -102,6 +130,26 @@ Sentry.init({
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, `@sentry/cloudflare` doesn't export `langGraphIntegration`, so set these through the `dataCollection` option in your `instrument.server.ts` file instead. This applies to all AI integrations:

```typescript {filename:src/instrument.server.ts}
import * as Sentry from "@sentry/cloudflare";

export default Sentry.defineCloudflareOptions((env) => ({
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 1.0,
dataCollection: {
genAI: { inputs: false, outputs: false },
},
}));
```

</PlatformSection>

## Manual Instrumentation

_Import names: `Sentry.instrumentStateGraph`, `Sentry.instrumentCreateReactAgent`_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ Requires SDK version `11.0.0` or higher.

</Alert>

<PlatformSection notSupported={["javascript.cloudflare"]}>

_Import name: `Sentry.mistralAIIntegration`_

</PlatformSection>

This integration is enabled by default when tracing is enabled. If you'd like to modify your default integrations, read [this](./../#modifying-default-integrations).

The `mistralAIIntegration` adds instrumentation for the [`@mistralai/mistralai`](https://www.npmjs.com/package/@mistralai/mistralai) SDK to capture <PlatformLink to="/agent-tracing/">agent tracing</PlatformLink> `gen_ai` spans, recording model, token usage, latency, and (when enabled) inputs and outputs.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -27,6 +33,8 @@ Sentry.init({
});
```

</PlatformSection>

<PlatformSection supported={["javascript.deno"]}>

On Deno, preload Sentry's import hook so the Mistral SDK can be instrumented:
Expand Down Expand Up @@ -120,6 +128,8 @@ Records outputs from Mistral AI SDK calls (such as generated text and responses)

Defaults to `true` if `dataCollection.genAI.outputs` is `true`, which is the default.

<PlatformSection notSupported={["javascript.cloudflare"]}>

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand All @@ -133,6 +143,26 @@ Sentry.init({
});
```

</PlatformSection>

<PlatformSection supported={["javascript.cloudflare"]}>

On Cloudflare, `@sentry/cloudflare` doesn't export `mistralAIIntegration`, so set these through the `dataCollection` option in your `instrument.server.ts` file instead. This applies to all AI integrations:

```typescript {filename:src/instrument.server.ts}
import * as Sentry from "@sentry/cloudflare";

export default Sentry.defineCloudflareOptions((env) => ({
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 1.0,
dataCollection: {
genAI: { inputs: false, outputs: false },
},
}));
```

</PlatformSection>

<PlatformSection notSupported={["javascript.deno", "javascript.solidstart"]}>

## Manual Instrumentation
Expand Down
Loading
Loading