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
23 changes: 23 additions & 0 deletions docs/ai/monitoring/conversations/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ keywords:
- gen_ai.conversation.id
- conversation tracking
- LLM conversations
- setUser
- user attribution
---

<Alert>
Expand Down Expand Up @@ -47,6 +49,26 @@ Conversations and traces are independent concepts. A single conversation can spa

The reverse is also true: a single trace can contain spans from different conversations. For example, if a user starts a new chat session without refreshing the page, the new conversation's spans appear in the same trace as the previous one.

## User Attribution

The Conversations view includes a **User** column that shows which user initiated each conversation. To populate it, call `setUser` (JavaScript) or `set_user` (Python) once per request or session, before any AI calls:

```javascript
// JavaScript / Node.js
import * as Sentry from "@sentry/node";

Sentry.setUser({ id: "user_123", email: "jane@example.com", username: "jane" });
```

```python
# Python
import sentry_sdk

sentry_sdk.set_user({"id": "user_123", "email": "jane@example.com", "username": "jane"})
```

Any of `id`, `email`, or `username` is sufficient. If no user is set, the column displays "Unknown".

## Conversations List

The [Conversations](https://sentry.io/orgredirect/organizations/:orgslug/explore/conversations/) page shows the most recent conversations that match your filters.
Expand All @@ -55,6 +77,7 @@ The [Conversations](https://sentry.io/orgredirect/organizations/:orgslug/explore

Each row in the list displays:

- **User** — the user who initiated the conversation, populated by `setUser` / `set_user`
- **First input** — the first user message in the conversation
- **Last output** — the most recent assistant response
- **Cost** — estimated dollar cost and token usage
Expand Down
12 changes: 12 additions & 0 deletions docs/platforms/javascript/common/ai-agent-monitoring/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ Sentry.setConversationId(null);
</SplitSection>
</SplitLayout>

## Identifying Users in Conversations

The [Conversations](/ai/monitoring/conversations/) view includes a **User** column. To populate it, call `setUser` once per request or session, before any AI calls:

```javascript
import * as Sentry from "___SDK_PACKAGE___";

Sentry.setUser({ id: "user_123", email: "jane@example.com", username: "jane" });
```

Any of `id`, `email`, or `username` is sufficient — Conversations displays whichever fields are present. See the [setUser API reference](/platforms/javascript/apis/#setUser) for the full list of supported fields.

## Manual Instrumentation

If you're using a library that Sentry does not automatically instrument, you can manually instrument your code to capture spans. For your AI agents data to show up in the [AI Agents Dashboards](https://sentry.io/orgredirect/organizations/:orgslug/dashboards/?filter=onlyPrebuilt&query=agents&sort=mostPopular), spans must have well-defined names and data attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ response = openai.responses.create(
)
```

## Identifying Users in Conversations

The [Conversations](/ai/monitoring/conversations/) view includes a **User** column. To populate it, call `sentry_sdk.set_user` once per request or session, before any AI calls:

```python
import sentry_sdk

sentry_sdk.set_user({"id": "user_123", "email": "jane@example.com", "username": "jane"})
```

Any of `id`, `email`, or `username` is sufficient — Conversations displays whichever fields are present.

## Common Span Attributes

<Include name="tracing/ai-agents-module/common-span-attributes" />
Expand Down
Loading