support-agent, and the outcome you care about is an Issue Resolved event.
By the end of this guide, you can:
- Send agent traces to your Mixpanel project so conversations are readable
- Find the conversations that errored, ran slow, or cost too much, and work out what went wrong
- Connect agent activity to a product outcome in a funnel or retention report
- Check a fix with an experiment or a before-and-after comparison
Who does what
Before you start
You need:- A Mixpanel project with access to Agent Intelligence. To request access, see Agent Intelligence.
- An agent that sends traces with OpenTelemetry. See the requirements in Agent Intelligence.
- An outcome event already tracked in your project, such as
Issue Resolved. You use it in Stage 4.
$mp_ai_span event, so agent data works in the same reports as the rest of your product data.
Stage 1: Send readable traces to Mixpanel
Role: Engineer To review conversations later, send the right details with your spans.Connect your exporter
user.id on every span. Set user.id to the same value you use as distinct_id, so agent activity joins the rest of the user’s events.Add the attributes this guide relies on
Add an attribute for each change you plan to make
prompt.version. In Stage 5, you use it to compare results before and after a change. For naming rules and an example, see Send your own attributes.Decide whether to send message content
gen_ai.input.messages and gen_ai.output.messages. You still get cost, tokens, latency, errors, models, and tool use. For redaction options, see Data privacy.Stage 2: Find conversations that went wrong
Role: Product manager or analyst To see where the agent struggles, start with the numbers, then read the conversations behind them.Open Usage
gen_ai.agent.name equals support-agent. Every attribute you sent is available as a filter or breakdown.Look for errors, slow turns, and costly turns
- Agent Turns with Errors (%): the share of turns with at least one failed span
- Errors by Tool: failed tool calls, split by
gen_ai.tool.name - Agent Run Duration Over Time: median and 90th percentile turn duration
- LLM Spend Over Time and LLM Spend per Model: where the cost goes
Open the conversations behind the numbers
- To find errors, filter AI Status Code (
$mp_ai_status_code) equalsSTATUS_CODE_ERROR. To find one tool’s errors, also filtergen_ai.tool.name. - To find slow or costly conversations, sort by Duration, Cost, Tokens, or Turns.
$mp_ai_span: click a data point and select View Conversations.Save the users who had a bad time
$mp_ai_span where AI Status Code equals STATUS_CODE_ERROR at least a few times in the last 30 days. Pick the count that fits your traffic. You use this cohort in Stage 4.Stage 3: Decide what went wrong
Role: Product manager and engineer Open a conversation. Mixpanel shows every turn, and every span inside each turn, in the order they ran. If a span failed, it’s marked as an error, so you can read the error and the tool call behind it. If your project uses Session Replay anduser.id matches the user’s distinct_id, the conversation also has a Replay tab that plays the user’s session from when the conversation started.
A failure can be an errored turn, a turn much slower or costlier than the rest, or a reply that missed the request. You can judge the last one only if you sent message content.
Use this table to sort what you see.
Stage 4: Check whether failures cost you outcomes
Role: Product manager or analyst A failing conversation matters most when it changes what users do next. These reports show that link. To see whether agent turns lead to your outcome, create a Funnels report:Add an agent turn as step one
$mp_ai_span, and filter gen_ai.operation.name equals invoke_agent so each turn counts once. Add a filter for gen_ai.agent.name equals support-agent.Add your outcome as step two
Issue Resolved.Break the funnel down
gen_ai.agent.name filter and break down by your custom attribute, such as prompt.version. To compare agents, remove the gen_ai.agent.name filter from step one and break down by gen_ai.agent.name. To compare models, break down by gen_ai.request.model only if your root spans carry it. Many tracers set the model only on model-call spans.$mp_ai_span. Then run a Retention report that starts from an event every user does, such as sign-up, and break it down by that cohort. Both groups then share the same starting event, return event, and time window.
To see whether bad experiences cost you users, use the cohort from Stage 2. Filter or break down your funnel or retention report by that cohort, and compare it to everyone else.
Stage 5: Fix the problem and check the result
Role: Engineer and product manager To know a fix worked, change one thing at a time and record which change is live.Make one change
prompt.version, so spans from the change are easy to separate.Pick how to check the change
- Run an experiment. Use feature flags and Experiments to test models, prompts, tools, and interface changes. Because agent data is event data, cost and error rate can be experiment metrics like any other.
- Compare before and after. On the Usage page, break down Agent Turns with Errors (%), Agent Run Duration Over Time, or LLM Spend Over Time by your custom attribute, such as
prompt.version. Use the same breakdown on your funnel report. A before-and-after comparison is quicker to set up than an experiment, but it can’t rule out other things that changed over the same period.
Watch the experience
Recheck your failure patterns
Check that it worked
Troubleshoot
If your data doesn’t look right, check Troubleshooting implementation in the Agent Intelligence FAQ. It covers four common problems:- Nothing is arriving
- Every turn shows as a separate conversation
- Prompts and responses are missing
- Spans arrive but properties are empty