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
56 changes: 33 additions & 23 deletions docs/platforms/python/integrations/openai-agents/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,9 @@ uv add "sentry-sdk"

## Configure

Add `OpenAIAgentsIntegration()` to your `integrations` list:
If you have the `agents` package in your dependencies, the OpenAI Agents integration will be enabled automatically when you initialize the Sentry SDK.

Comment on lines +33 to 34
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential bug: The documentation incorrectly states the OpenAI Agents integration is auto-enabled. This will cause users to miss manual setup, resulting in no monitoring.
  • Description: The documentation at docs/platforms/python/integrations/openai-agents/index.mdx is being updated to claim that the OpenAI Agents integration is automatically enabled. However, this is incorrect. The main integration table in the repository does not list it as auto-enabled, and the code requires explicit registration via OpenAIAgentsIntegration(), as shown later in the same document. Users following this new documentation will expect automatic monitoring of their AI agents but will receive none, leading to a silent failure of the monitoring functionality in their applications.

  • Suggested fix: Revert the change that claims automatic enablement. The documentation should continue to show that the OpenAIAgentsIntegration() must be explicitly added to the Sentry SDK's integrations list to enable it.
    severity: 0.65, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

```python
import sentry_sdk
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
traces_sample_rate=1.0,
# Add data like inputs and responses to/from LLMs and tools;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
OpenAIAgentsIntegration(),
],
)
```
<PlatformContent includePath="getting-started-config" />

## Verify

Expand All @@ -57,8 +43,6 @@ import asyncio
import random

import sentry_sdk
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration

import agents
from pydantic import BaseModel # installed by openai-agents

Expand All @@ -79,14 +63,11 @@ random_number_agent = agents.Agent(

async def main() -> None:
sentry_sdk.init(
dsn="...", # same as above
dsn="___PUBLIC_DSN___",
traces_sample_rate=1.0,
# Add data like LLM and tool inputs/outputs;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
OpenAIAgentsIntegration(),
],
)

await agents.Runner.run(
Expand All @@ -109,7 +90,36 @@ Data on the following will be collected:
- number of input and output tokens used
- LLM models usage

Sentry considers LLM and tool inputs/outputs as PII and doesn't include PII data by default. If you want to include the data, set `send_default_pii=True` in the `sentry_sdk.init()` call.
Sentry considers LLM and tool inputs/outputs as PII and doesn't include PII data by default. If you want to include the data, set `send_default_pii=True` in the `sentry_sdk.init()` call. To explicitly exclude prompts and outputs despite `send_default_pii=True`, configure the integration with `include_prompts=False` as shown in the [Options section](#options) below.

## Options

By adding `OpenAIAgentsIntegration` to your `sentry_sdk.init()` call explicitly, you can set options for `OpenAIAgentsIntegration` to change its behavior:

```python
import sentry_sdk
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration

sentry_sdk.init(
# ...
# Add data like inputs and responses;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
OpenAIAgentsIntegration(
include_prompts=False, # LLM and tool inputs/outputs will be not sent to Sentry, despite send_default_pii=True
),
],
)
```

You can pass the following keyword arguments to `OpenAIAgentsIntegration()`:

- `include_prompts`:

Whether LLM and tool inputs and outputs should be sent to Sentry. Sentry considers this data personal identifiable data (PII) by default. If you want to include the data, set `send_default_pii=True` in the `sentry_sdk.init()` call. To explicitly exclude prompts and outputs despite `send_default_pii=True`, configure the integration with `include_prompts=False`.

The default is `True`.

## Supported Versions

Expand Down
4 changes: 0 additions & 4 deletions docs/product/insights/ai/agents/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,13 @@ The Sentry Python SDK supports OpenAI Agents SDK.

```python
import sentry_sdk
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration
import agents
from pydantic import BaseModel

sentry_sdk.init(
dsn="YOUR_DSN",
traces_sample_rate=1.0,
send_default_pii=True, # Include LLM inputs/outputs
integrations=[
OpenAIAgentsIntegration(),
],
)

# Create your AI agent
Expand Down