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
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ const result = await generateText({

## Supported Versions

- `ai`: `>=3.0.0 <5`
- `ai`: `>=3.0.0 <6`
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
title: Instrument AI Agents
sidebar_order: 500
description: "Learn how to manually instrument your code to use Sentry's Agents module."
supported:
- javascript.node
- javascript.aws-lambda
- javascript.azure-functions
- javascript.connect
- javascript.express
- javascript.fastify
- javascript.gcp-functions
- javascript.hapi
- javascript.hono
- javascript.koa
- javascript.nestjs
- javascript.bun
- javascript.deno
- javascript.nextjs
- javascript.nuxt
- javascript.astro
- javascript.solidstart
- javascript.sveltekit
- javascript.remix
- javascript.cloudflare
- javascript.tanstackstart-react
---

With <Link to="/product/insights/ai/agents/dashboard/">Sentry AI Agent Monitoring</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. AI Agent Monitoring data will be fully connected to your other Sentry data like logs, errors, and traces.
Expand All @@ -12,9 +34,8 @@ As a prerequisite to setting up AI Agent Monitoring with JavaScript, you'll need

The JavaScript SDK supports automatic instrumentation for some AI libraries. We recommend adding their integrations to your Sentry configuration to automatically capture spans for AI agents.

- <PlatformLink to="/configuration/integrations/vercelai/">
Vercel AI SDK
</PlatformLink>
- <PlatformLink to="/configuration/integrations/vercelai/">Vercel AI SDK</PlatformLink>
- <PlatformLink to="/configuration/integrations/openai/">OpenAI</PlatformLink>

## Manual Instrumentation

Expand All @@ -24,7 +45,9 @@ If you're using a library that Sentry does not automatically instrument, you can

### Invoke Agent Span

<Include name="tracing/ai-agents-module/invoke-agent-span" />
<Expandable title="Invoke Agent span attributes">
<Include name="tracing/ai-agents-module/invoke-agent-span" />
</Expandable>

#### Example of an Invoke Agent Span:

Expand Down Expand Up @@ -78,7 +101,9 @@ Sentry.startSpan(

### AI Client Span

<Include name="tracing/ai-agents-module/ai-client-span" />
<Expandable title="AI Client span attributes">
<Include name="tracing/ai-agents-module/ai-client-span" />
</Expandable>

#### Example AI Client Span

Expand Down Expand Up @@ -152,7 +177,9 @@ Sentry.startSpan(

### Execute Tool Span

<Include name="tracing/ai-agents-module/execute-tool-span" />
<Expandable title="Execute Tool span attributes">
<Include name="tracing/ai-agents-module/execute-tool-span" />
</Expandable>

#### Example Execute Tool Span

Expand Down Expand Up @@ -216,7 +243,9 @@ if (result.toolCalls && result.toolCalls.length > 0) {

### Handoff Span

<Include name="tracing/ai-agents-module/handoff-span" />
<Expandable title="Handoff span attributes">
<Include name="tracing/ai-agents-module/handoff-span" />
</Expandable>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Handoff Span Documentation Missing

The 'Handoff Span' section currently includes common-span-attributes and has a title of 'Common span attributes'. This means the specific documentation for handoff spans is missing, and users see generic attributes instead.

Fix in Cursor Fix in Web


#### Example of a Handoff Span

Expand Down Expand Up @@ -278,6 +307,6 @@ if (result.handoffTo) {
}
```

## Common Span Attributes

<Include name="tracing/ai-agents-module/common-span-attributes" />
<Expandable title="Common span attributes">
<Include name="tracing/ai-agents-module/common-span-attributes" />
</Expandable>
6 changes: 2 additions & 4 deletions docs/product/insights/ai/agents/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ import * as Sentry from "@sentry/node";
// Sentry init needs to be above everything else
Sentry.init({
tracesSampleRate: 1.0,
integrations: [
Sentry.vercelAIIntegration(),
],
integrations: [Sentry.vercelAIIntegration()],
});

import { generateText } from "ai";
Expand All @@ -152,7 +150,7 @@ async function aiAgent(userQuery) {

<Alert title="Don't see your SDK?">

We'll be adding AI agent integrations continuously. Please vote on [GitHub](https://github.com/getsentry/sentry-javascript/issues/16960) which one you'd like to see next. You can also instrument AI agents manually by following our [manual instrumentation guide](/platforms/javascript/tracing/instrumentation/ai-agents-module).
We'll be adding AI agent integrations continuously. Please vote on [GitHub](https://github.com/getsentry/sentry-javascript/issues/16960) which one you'd like to see next. You can also instrument AI agents manually by following our [manual instrumentation guide](/platforms/javascript/guides/node/tracing/instrumentation/ai-agents-module).

</Alert>

Expand Down
6 changes: 6 additions & 0 deletions src/components/docPage/type.scss
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@
padding: 0.75rem;
vertical-align: top;
}

// Ensure long inline code and links wrap inside table cells
code,
a {
word-break: break-word;
}
}

dt + dd {
Expand Down