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
12 changes: 7 additions & 5 deletions develop-docs/sdk/telemetry/traces/modules/ai-agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ Additional attributes on the span:

This span represents a request to an AI model or service that generates a response or requests a tool call based on the input prompt.

- Span `op` MUST be `"gen_ai.{gen_ai.operation.name}"`. (e.g. `"gen_ai.chat"`)
- Span `op` MUST be `"gen_ai.{gen_ai.operation.name}"`. (e.g. `"gen_ai.request"`)
- Span `name` SHOULD be `{gen_ai.operation.name} {gen_ai.request.model}"`. (e.g. `"chat o3-mini"`)
- Attribute `gen_ai.operation.name` MUST be the operation performed.[3] (e.g. `"chat"`.)
- Attribute `gen_ai.operation.name` MUST be the operation performed.[3] (e.g. `"summarize"`.)
- All [Common Span Attributes](#common-span-attributes) SHOULD be set (all `required` common attributes MUST be set).

Additional attributes on the span:
Expand Down Expand Up @@ -154,7 +154,7 @@ Some attributes are common to all AI Agents spans:

| Attribute | Type | Requirement Level | Description | Example |
| :---------------------- | :----- | :---------------- | :--------------------------------------------------------------------------------------- | :-------------------- |
| `gen_ai.operation.name` | string | required | The name of the operation being performed. **[2]** | `"chat"` |
| `gen_ai.operation.name` | string | required | The name of the operation being performed. **[2]** | `"summarize"` |
| `gen_ai.request.model` | string | required | The name of the AI model a request is being made to. | `"gpt-4o"` |
| `gen_ai.response.model` | string | optional | The name of the AI model the response was created with. | `"gpt-4o-2024-08-06"` |
| `gen_ai.agent.name` | string | optional | The name of the agent this span belongs to. | `"Weather Agent"` |
Expand All @@ -164,7 +164,7 @@ Some attributes are common to all AI Agents spans:

| Value | Description |
| :------------------- | :---------------------------------------------------------------------- |
| `"chat"` | Chat completion operation such as OpenAI Chat API |
| `"summarize"` | Chat completion operation such as OpenAI Chat API |
| `"responses"` | OpenAI Responses API |
| `"create_agent"` | Create GenAI agent |
| `"embeddings"` | Embeddings operation such as OpenAI Create embeddings API |
Expand Down Expand Up @@ -193,5 +193,7 @@ Some attributes are common to all AI Agents spans:
| `"xai"` | xAI |

## Size Limits

In addition to the [general size limits](https://docs.sentry.io/concepts/data-management/size-limits/) for events, spans, and attachments, there are specific size limits for AI integrations:
- Input messages in AI integrations recorded in the span attribute `gen_ai.request.messages` are limited to 20kB per span. Messages are trimmed and truncated if they exceed the limit, retaining the most recent messages.

- Input messages in AI integrations recorded in the span attribute `gen_ai.request.messages` are limited to 20kB per span. Messages are trimmed and truncated if they exceed the limit, retaining the most recent messages.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Sentry.init({

By default this integration adds tracing support for LangChain operations including:

- **Chat model invocations** (`gen_ai.chat`) - Captures spans for chat model calls
- **Chat model invocations** (`gen_ai.request`) - Captures spans for chat model calls
- **LLM invocations** (`gen_ai.pipeline`) - Captures spans for LLM pipeline executions
- **Chain executions** (`gen_ai.invoke_agent`) - Captures spans for chain invocations
- **Tool executions** (`gen_ai.execute_tool`) - Captures spans for tool calls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ notSupported:

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.

As a prerequisite to setting up AI Agent Monitoring in browser applications, you'll need to first <PlatformLink to="/tracing/">set up tracing</PlatformLink>.
As a prerequisite to setting up AI Agent Monitoring in browser applications, you'll need to first <PlatformLink to="/tracing/">set up tracing</PlatformLink>.

<Alert level="info">

Expand Down Expand Up @@ -108,7 +108,6 @@ Sentry.startSpan(
name: `invoke_agent ${myAgent.name}`,
attributes: {
"gen_ai.operation.name": "invoke_agent",
"gen_ai.system": myAgent.modelProvider,
"gen_ai.request.model": myAgent.model,
"gen_ai.agent.name": myAgent.name,
},
Expand Down Expand Up @@ -168,7 +167,6 @@ Sentry.startSpan(
name: `chat ${myAi.model}`,
attributes: {
"gen_ai.operation.name": "chat",
"gen_ai.system": myAi.modelProvider,
"gen_ai.request.model": myAi.model,
},
},
Expand Down Expand Up @@ -253,7 +251,6 @@ if (result.toolCalls && result.toolCalls.length > 0) {
op: "gen_ai.execute_tool",
name: `execute_tool ${tool.name}`,
attributes: {
"gen_ai.system": myAi.modelProvider,
"gen_ai.request.model": myAi.model,
"gen_ai.tool.type": "function",
"gen_ai.tool.name": tool.name,
Expand Down Expand Up @@ -322,7 +319,6 @@ if (result.handoffTo) {
op: "gen_ai.handoff",
name: `handoff from ${myAgent.name} to ${otherAgent.name}`,
attributes: {
"gen_ai.system": myAgent.modelProvider,
"gen_ai.request.model": myAgent.model,
},
},
Expand Down
Loading
Loading