Skip to content
Merged
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
115 changes: 12 additions & 103 deletions docs/platforms/javascript/common/agent-tracing/anthropic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,17 @@
title: Anthropic
description: "Adds instrumentation for the Anthropic SDK."
sidebar_order: 22
supported:
- javascript.node
- javascript.eve
- javascript.aws-lambda
- javascript.azure-functions
- javascript.connect
- javascript.express
- javascript.fastify
- javascript.gcp-functions
- javascript.hapi
- javascript.hono
- javascript.koa
- javascript.nestjs
- javascript.nextjs
- javascript.nuxt
- javascript.solidstart
- javascript.sveltekit
- javascript.react-router
- javascript.remix
- javascript.astro
- javascript.bun
- javascript.tanstackstart-react
- javascript.cloudflare
supportedCategories:
- server
---

<PlatformSection supported={["javascript.nextjs", "javascript.nuxt", "javascript.solidstart", "javascript.sveltekit", "javascript.react-router", "javascript.remix", "javascript.astro", "javascript.tanstackstart-react"]}>
<Alert level="warning">
For meta-framework applications running on both client and server, we recommend **setting up the integration manually** using the [`instrumentAnthropicAiClient` wrapper](#manual-instrumentation) to ensure consistent instrumentation across all runtimes.
</Alert>
</PlatformSection>
_Import name: `Sentry.anthropicAIIntegration`_

<PlatformSection supported={["javascript.node", "javascript.eve", "javascript.aws-lambda", "javascript.azure-functions", "javascript.connect", "javascript.express", "javascript.fastify", "javascript.gcp-functions", "javascript.hapi", "javascript.hono", "javascript.koa", "javascript.nestjs", "javascript.nextjs", "javascript.nuxt", "javascript.solidstart", "javascript.sveltekit", "javascript.react-router", "javascript.remix", "javascript.astro", "javascript.tanstackstart-react", "javascript.electron", "javascript.cordova", "javascript.capacitor", "javascript.deno", "javascript.wasm"]}>
The `anthropicAIIntegration` adds instrumentation for the [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) API to capture spans by wrapping Anthropic SDK calls and recording LLM interactions.

## Automatic Instrumentation
This integration is enabled by default and automatically captures spans for Anthropic SDK calls (requires Sentry SDK version `10.28.0` or higher).

_Import name: `Sentry.anthropicAIIntegration`_

<PlatformSection notSupported={["javascript.node", "javascript.eve", "javascript.connect", "javascript.hapi", "javascript.koa"]}>
<Alert>
If you are using a different runtime (like Bun, Cloudflare Workers or a Browser) or experiencing missing spans, you need to use **[Manual Instrumentation](#manual-instrumentation)** to explicitly wrap your AI client instance instead.
</Alert>
</PlatformSection>

The `anthropicAIIntegration` adds instrumentation for the [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) API to capture spans by wrapping Anthropic SDK calls and recording LLM interactions.

In Node.js runtimes, this integration is enabled by default and automatically captures spans for Anthropic SDK calls (requires Sentry SDK version `10.28.0` or higher).

To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section.

</PlatformSection>

<PlatformSection notSupported={["javascript.node", "javascript.eve", "javascript.connect", "javascript.hapi", "javascript.koa"]}>

## Manual Instrumentation

_Import name: `Sentry.instrumentAnthropicAiClient`_

The `instrumentAnthropicAiClient` helper adds instrumentation for the [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) API to capture spans by wrapping Anthropic SDK calls and recording LLM interactions with configurable input/output recording. You need to manually wrap your Anthropic client instance with this helper.

See the example below:

```javascript
import Anthropic from "@anthropic-ai/sdk";

const anthropic = new Anthropic({
apiKey: "your-api-key", // Warning: API key will be exposed in browser!
});

const client = Sentry.instrumentAnthropicAiClient(anthropic, {
recordInputs: true,
recordOutputs: true,
});

// Use the wrapped client instead of the original anthropic instance
const response = await client.messages.create({
model: "claude-3-5-sonnet-20241022",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello!" }],
});
```

To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section.

</PlatformSection>
To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section.

## Configuration

Expand All @@ -111,36 +38,18 @@ Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the def

**Usage**

<PlatformSection supported={["javascript.node", "javascript.eve", "javascript.aws-lambda", "javascript.azure-functions", "javascript.connect", "javascript.express", "javascript.fastify", "javascript.gcp-functions", "javascript.hapi", "javascript.hono", "javascript.koa", "javascript.nestjs", "javascript.nextjs", "javascript.nuxt", "javascript.solidstart", "javascript.sveltekit", "javascript.react-router", "javascript.remix", "javascript.astro", "javascript.tanstackstart-react", "javascript.electron", "javascript.cordova", "javascript.capacitor", "javascript.deno", "javascript.wasm"]}>

Using the `anthropicAIIntegration` integration for **automatic instrumentation**:

```javascript
Sentry.init({
```javascript
Sentry.init({
dsn: "____PUBLIC_DSN____",
// Tracing must be enabled for agent tracing to work
tracesSampleRate: 1.0,
integrations: [
Sentry.anthropicAIIntegration({
// your options here
}),
Sentry.anthropicAIIntegration({
// your options here
}),
],
});
```

</PlatformSection>

<PlatformSection notSupported={["javascript.node", "javascript.eve", "javascript.connect", "javascript.hapi", "javascript.koa"]}>

Using the `instrumentAnthropicAiClient` wrapper for **manual instrumentation**:

```javascript
const client = Sentry.instrumentAnthropicAiClient(anthropic, {
// your options here
});
```

</PlatformSection>
```

## Supported Operations

Expand Down
101 changes: 7 additions & 94 deletions docs/platforms/javascript/common/agent-tracing/google-genai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,17 @@
title: Google Gen AI
description: "Adds instrumentation for Google Gen AI SDK."
sidebar_order: 23
supported:
- javascript.node
- javascript.eve
- javascript.aws-lambda
- javascript.azure-functions
- javascript.connect
- javascript.express
- javascript.fastify
- javascript.gcp-functions
- javascript.hapi
- javascript.hono
- javascript.koa
- javascript.nestjs
- javascript.nextjs
- javascript.nuxt
- javascript.solidstart
- javascript.sveltekit
- javascript.react-router
- javascript.remix
- javascript.astro
- javascript.bun
- javascript.tanstackstart-react
- javascript.cloudflare
supportedCategories:
- server
---

<PlatformSection supported={["javascript.nextjs", "javascript.nuxt", "javascript.solidstart", "javascript.sveltekit", "javascript.react-router", "javascript.remix", "javascript.astro", "javascript.tanstackstart-react"]}>
<Alert level="warning">
For meta-framework applications running on both client and server, we recommend **setting up the integration manually** using the [`instrumentGoogleGenAIClient` wrapper](#manual-instrumentation) to ensure consistent instrumentation across all runtimes.
</Alert>
</PlatformSection>
_Import name: `Sentry.googleGenAIIntegration`_

<PlatformSection supported={["javascript.node", "javascript.eve", "javascript.aws-lambda", "javascript.azure-functions", "javascript.connect", "javascript.express", "javascript.fastify", "javascript.gcp-functions", "javascript.hapi", "javascript.hono", "javascript.koa", "javascript.nestjs", "javascript.nextjs", "javascript.nuxt", "javascript.solidstart", "javascript.sveltekit", "javascript.react-router", "javascript.remix", "javascript.astro", "javascript.tanstackstart-react", "javascript.electron", "javascript.cordova", "javascript.capacitor", "javascript.deno", "javascript.wasm"]}>
The `googleGenAIIntegration` adds instrumentation for the [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK to capture spans by wrapping Google Gen AI SDK calls and recording LLM interactions.

## Automatic Instrumentation
This integration is enabled by default and automatically captures spans for Google Gen AI SDK calls (requires Sentry SDK version `10.28.0` or higher).

_Import name: `Sentry.googleGenAIIntegration`_

<PlatformSection notSupported={["javascript.node", "javascript.eve", "javascript.connect", "javascript.hapi", "javascript.koa"]}>
<Alert>
If you are using a different runtime (like Bun, Cloudflare Workers or a Browser) or experiencing missing spans, you need to use **[Manual Instrumentation](#manual-instrumentation)** to explicitly wrap your AI client instance instead.
</Alert>
</PlatformSection>

The `googleGenAIIntegration` adds instrumentation for the [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK to capture spans by wrapping Google Gen AI SDK calls and recording LLM interactions.

In Node.js runtimes, this integration is enabled by default and automatically captures spans for Google Gen AI SDK calls (requires Sentry SDK version `10.28.0` or higher).

To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section.

</PlatformSection>

<PlatformSection notSupported={["javascript.node", "javascript.eve", "javascript.connect", "javascript.hapi", "javascript.koa"]}>

## Manual Instrumentation

_Import name: `Sentry.instrumentGoogleGenAIClient`_

The `instrumentGoogleGenAIClient` helper adds instrumentation for the [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK to capture spans by wrapping Google Gen AI SDK calls and recording LLM interactions with configurable input/output recording. You need to manually wrap your Google Gen AI client instance with this helper.

See example below:

```javascript
import { GoogleGenAI } from "@google/genai";

const genAI = new GoogleGenAI({
apiKey: "your-api-key", // Warning: API key will be exposed in browser!
});

const client = Sentry.instrumentGoogleGenAIClient(genAI, {
recordInputs: true,
recordOutputs: true,
});

// Use the wrapped client instead of the original genAI instance
const result = await client.models.generateContent("Hello!");
```

To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section.

</PlatformSection>
To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section.

## Configuration

Expand All @@ -107,14 +38,10 @@ Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the def

**Usage**

<PlatformSection supported={["javascript.node", "javascript.eve", "javascript.aws-lambda", "javascript.azure-functions", "javascript.connect", "javascript.express", "javascript.fastify", "javascript.gcp-functions", "javascript.hapi", "javascript.hono", "javascript.koa", "javascript.nestjs", "javascript.nextjs", "javascript.nuxt", "javascript.solidstart", "javascript.sveltekit", "javascript.react-router", "javascript.remix", "javascript.astro", "javascript.tanstackstart-react", "javascript.electron", "javascript.cordova", "javascript.capacitor", "javascript.deno", "javascript.wasm"]}>

Using the `googleGenAIIntegration` integration for **automatic instrumentation**:

```javascript
Sentry.init({
dsn: "____PUBLIC_DSN____",
// Tracing must be enabled for agent tracing to work
// Tracing must be enabled for agent tracing to work
tracesSampleRate: 1.0,
integrations: [
Sentry.googleGenAIIntegration({
Expand All @@ -124,20 +51,6 @@ Sentry.init({
});
```

</PlatformSection>

<PlatformSection notSupported={["javascript.node", "javascript.eve", "javascript.connect", "javascript.hapi", "javascript.koa"]}>

Using the `instrumentGoogleGenAIClient` wrapper for **manual instrumentation**:

```javascript
const client = Sentry.instrumentGoogleGenAIClient(genAI, {
// your options here
});
```

</PlatformSection>

## Supported Operations

By default, tracing support is added to the following Google Gen AI SDK calls:
Expand Down
35 changes: 2 additions & 33 deletions docs/platforms/javascript/common/agent-tracing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,8 @@ sidebar_order: 7
description: "Monitor agents with token usage, latency, tool execution, and error tracking."
sidebar_section: features
new: true
supported:
- javascript.node
- javascript.eve
- javascript.aws-lambda
- javascript.azure-functions
- javascript.bun
- javascript.cloudflare
- javascript.connect
- javascript.deno
- javascript.effect
- javascript.elysia
- javascript.express
- javascript.fastify
- javascript.firebase
- javascript.gcp-functions
- javascript.hapi
- javascript.hono
- javascript.koa
- javascript.nestjs
- javascript.nitro
- javascript.astro
- javascript.nextjs
- javascript.nuxt
- javascript.react-router
- javascript.remix
- javascript.solidstart
- javascript.sveltekit
- javascript.tanstackstart-react
supportedCategories:
- server
---

With <Link to="/product/agents/dashboards/">Sentry Agent Tracing</Link>, you can monitor and debug your AI systems with full-stack context. You'll be able to track key insights like token usage, latency, tool usage, and error rates — and group multi-turn chats in <Link to="/product/agents/conversations/">Conversations</Link>. Agent Tracing data is fully connected to your other Sentry data like logs, errors, and traces.
Expand Down Expand Up @@ -115,31 +89,26 @@ Pick your AI stack. Some libraries auto-instrument; others need a short setup
to: "/agent-tracing/openai/",
title: "OpenAI",
icon: "openai",
notSupported: ["javascript.deno"],
},
{
to: "/agent-tracing/anthropic/",
title: "Anthropic",
icon: "anthropic",
notSupported: ["javascript.deno"],
},
{
to: "/agent-tracing/google-genai/",
title: "Google Gen AI SDK",
icon: "google-genai",
notSupported: ["javascript.deno"],
},
{
to: "/agent-tracing/langchain/",
title: "LangChain",
icon: "langchain",
notSupported: ["javascript.deno"],
},
{
to: "/agent-tracing/langgraph/",
title: "LangGraph",
icon: "langgraph",
notSupported: ["javascript.deno"],
},
{
to: "/agent-tracing/mastra/",
Expand Down
Loading
Loading