|
| 1 | +--- |
| 2 | +title: Conversations |
| 3 | +sidebar_order: 15 |
| 4 | +new: true |
| 5 | +description: >- |
| 6 | + Monitor past conversations with your AI assistants. Replay every message and |
| 7 | + tool call to understand what happened and where things went wrong. |
| 8 | +keywords: |
| 9 | + - AI conversations |
| 10 | + - conversation monitoring |
| 11 | + - chat monitoring |
| 12 | + - gen_ai.conversation.id |
| 13 | + - conversation tracking |
| 14 | + - LLM conversations |
| 15 | +--- |
| 16 | + |
| 17 | +Sentry's Conversations view lets you observe the interactions users have had with your chat-based AI assistants. It provides a user-like view into past conversations, showing the full exchange of messages and tool calls so you can understand exactly what happened during each session. |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +Conversations are built on top of [AI Agent Monitoring](/ai/monitoring/agents/). Before you can use them, you need: |
| 22 | + |
| 23 | +1. **Tracing enabled** with the Sentry SDK configured for your AI agent project. Follow the [Agent Monitoring getting started guide](/ai/monitoring/agents/getting-started/) if you haven't already. |
| 24 | + |
| 25 | +2. **A conversation ID on your spans.** Sentry groups spans into conversations using the `gen_ai.conversation.id` attribute. You can set this manually, or some SDK integrations infer it automatically. |
| 26 | + |
| 27 | +## Setting the Conversation ID |
| 28 | + |
| 29 | +A conversation is a collection of spans that share the same `gen_ai.conversation.id`. This is typically the ID of the chat session in your application (for example, the session ID you store in your database). |
| 30 | + |
| 31 | +### Auto-Instrumented |
| 32 | + |
| 33 | +The following integrations automatically infer the conversation ID from the underlying AI SDK: |
| 34 | + |
| 35 | +- **OpenAI Agents SDK** (Python) |
| 36 | +- **OpenAI SDK** (Node) |
| 37 | + |
| 38 | +If you're using one of these, no additional setup is needed. |
| 39 | + |
| 40 | +### Manual |
| 41 | + |
| 42 | +For all other integrations, set the conversation ID at the start of each conversation: |
| 43 | + |
| 44 | +```python |
| 45 | +import sentry_sdk |
| 46 | + |
| 47 | +# Call this at the start of each conversation |
| 48 | +sentry_sdk.ai.set_conversation_id("my-conversation-123") |
| 49 | +``` |
| 50 | + |
| 51 | +```javascript |
| 52 | +import * as Sentry from "@sentry/node"; |
| 53 | + |
| 54 | +// Call this at the start of each conversation |
| 55 | +Sentry.setConversationId("my-conversation-123"); |
| 56 | +``` |
| 57 | + |
| 58 | +Use whatever identifier your application already uses for the chat session. All spans created after calling this method will be tagged with the given conversation ID. |
| 59 | + |
| 60 | +### Conversations and Traces |
| 61 | + |
| 62 | +Conversations and traces are independent concepts. A single conversation can span multiple traces. For example, if a user refreshes the page mid-conversation, the browser starts a new trace, but the conversation continues with the same ID. |
| 63 | + |
| 64 | +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. |
| 65 | + |
| 66 | +## Conversations List |
| 67 | + |
| 68 | +The [Conversations](https://sentry.io/orgredirect/organizations/:orgslug/insights/ai/conversations/) page shows the most recent conversations that match your filters. |
| 69 | + |
| 70 | +<!-- TODO: Add screenshot of conversations list --> |
| 71 | +<!--  --> |
| 72 | + |
| 73 | +Each row in the list displays: |
| 74 | + |
| 75 | +- **First input** — the first user message in the conversation |
| 76 | +- **Last output** — the most recent assistant response |
| 77 | +- **Cost** — estimated dollar cost and token usage |
| 78 | +- **LLM calls** — number of LLM generation requests |
| 79 | +- **Tool calls** — number of tool executions |
| 80 | + |
| 81 | +Use the filters at the top of the page to narrow results by project, date range, or agent. |
| 82 | + |
| 83 | +## Conversation Detail |
| 84 | + |
| 85 | +Click any conversation to open the detail view in a drawer. |
| 86 | + |
| 87 | +<!-- TODO: Add screenshot of conversation detail drawer --> |
| 88 | +<!--  --> |
| 89 | + |
| 90 | +The detail view shows a chat-like interface with the full message history: user inputs, assistant responses, and tool calls. Click on any message to see the underlying spans, including individual LLM generations and tool executions, with timing and error information. |
| 91 | + |
| 92 | +This makes it straightforward to trace a conversation from start to finish and pinpoint where things went wrong. |
0 commit comments