Concepts
Before you start
You need:- A Mixpanel project and its project token
- An agent instrumented with OpenTelemetry using the
gen_ai.*semantic conventions (v1.41 or later) - A
user.idattribute on your spans, set to the same value you use asdistinct_idin Mixpanel
Implementation
Mixpanel reads the OpenTelemetry GenAI semantic conventions (gen_ai.*). Every span becomes one Mixpanel event.
Step 1 — Point your exporter at Mixpanel
| Endpoint (Use the endpoint for your project’s data residency region) | US: https://ingestion-us.mixpanel.com/v1/ai/otel/tracesEU: https://ingestion-eu.mixpanel.com/v1/ai/otel/tracesIndia: https://ingestion-in.mixpanel.com/v1/ai/otel/traces |
|---|---|
| Protocol | OTLP over HTTP, protobuf or JSON |
| Auth header | Authorization: Basic <base64(“<PROJECT_TOKEN>:”)> |
Step 2 — Set required properties and attributes on every span
Your tracer sets most of these. You setuser.id
These attributes and properties need to be on every span. Spans missing user.id are dropped.
From the span’s attributes
These come from entries in the span’sattributes object.
The simplest way to capture
user.id is OTel baggage, so the value propagates to child spans automatically.
user.id in a span processor instead.
From OTLP span fields
These come from standard OTLP span fields (the span root, not the attributes object). Your tracer sets them automatically; Mixpanel maps them to these event properties.Step 3 — Add the attributes that make the data useful
Optional, but recommended. Adding more data unlocks the questions you’ll want to ask. OTel GenAI tracers produce most of them. Send them per span. Any attribute Mixpanel does not set itself arrives as a property with the same name your tracer used.Step 4 — Send your own attributes
Standard attributes cover cost, latency, errors, models, and tools. They don’t cover what makes your product unique. Any attribute Mixpanel doesn’t recognize is kept as a custom property. Send any dimensions you’d want to break down by. For example:- Event Property limits: Mixpanel truncates string properties to at most 255 bytes
- Event size limits: each OTEL span must be below 1MB uncompressed JSON otherwise the span cannot be ingested into Mixpanel (i.e. it will be dropped)
Step 5 — Verify
Send one test span and confirm it arrives.Data privacy
Mixpanel’s security and access controls apply to your agent traces. Additionally, Mixpanel scans AI span attributes for common PII patterns at ingest, before the data is stored. Matches are replaced with a[REDACTED:<type>] placeholder. The original value is never written, and redaction can’t be reversed.
Mixpanel attempts to detect and redact the following properties:
- Email addresses
- US Social Security numbers
- Credit card numbers
- Phone numbers
- API keys (OpenAI, Slack, GitHub, AWS)
- Bearer tokens
- IPv4 addresses.
$mp_ai_pii_redacted = true. Mixpanel sets this value. Events with nothing redacted don’t carry the property at all.
Note that message content, agent responses, and tool calls are optional attributes. Regulated industries typically omit these fields. If you omit them, you still get cost, tokens, latency, errors, models, tool usage, conversation shape, and every custom property you send. Most OpenTelemetry GenAI instrumentations don’t capture prompt and response text by default, so if you leave it off, no message content reaches Mixpanel.
Redacting sensitive data yourself
If you want readable transcripts, but prefer to scrub them first, redact in your own OpenTelemetry Collector using the redaction processor. You can mask values matching your patterns and drops any attribute not on your allow list. Be sure not to remove user.id , which is required on every span.
Intelligence on your Agents
Once spans are arriving, you have different ways to look at them.Key metrics
Open Agent Intelligence → Usage for usage and health metrics. Span level data is rolled up to Conversation and Turns levels for analysis. See more on computed values below. Use the filters and date range at the top to narrow to one agent, model, or cohort. Every attribute you sent in Steps 3 and 4 is available here.Dig into conversations
Conversations lists every conversation in your project, sorted by conversations with the newest activity. Each row shows key details of the conversation such a number of turns and total cost. Click a conversation to open it. You’ll see every turn, and every span inside each turn, in the order they ran. This is where you go to troubleshoot. A turn with an unusual duration or cost stands out in the list, opening it shows which span caused it. If a turn errored, the failing span is marked, so you can read the error and the tool call that produced it.Link Agent data to your product outcomes
Spans are events, so agent data works in every Mixpanel report. You can answer questions like: Does the agent drive conversion? Build a funnel with an agent turn as step one and your conversion event as step two. Break down bygen_ai.agent.name to compare agents, or by gen_ai.request.model to see whether a model change moved the conversion rate.
Do agent users stick around? Run a retention report on users who complete an agent turn. Compare it to retention for users who never touch the agent.
Which users are having a bad time? Create a cohort of users with a high share of errored conversations. Use the cohort to compare they retain against everyone else. Or dig into the underlying conversations to understand their experience.
What value does the agent provide the business? Compare revenue or active users against agent cost over the same period. Segment by model to see whether a more expensive model paid for itself.
Leverage Experimentation and Session Replay
- Experiments: Use feature flags and experiments to test models, prompts, tools, and UX. Because agent metrics are events, cost and error rate can be experiment metrics like any other.
- Session Replay: Watch what a slow turn felt like, or find users who opened the agent and left without sending a prompt.
Conversation Level Data
Spans are important because they include key data you need about how your agent is performing. However, we tend to do analysis at a conversation or turn level. Mixpanel automatically computes key conversation-level data from spans up bytrace_id and conversation_id inside Agent Intelligence so you can analyze a turn or conversation as one thing.
FAQ
How much does Agent Intelligence cost?
How much does Agent Intelligence cost?
There is no extra charge to use Agent Intelligence. Note, events sent for the purposes of Agent Intelligence count towards your event volume.
Troubleshooting implementation
Troubleshooting implementation
Nothing is arriving.
- Check the auth header first: base64 of
<PROJECT_TOKEN>:with the trailing colon, schemeBasic. user.idis missing on spans. It has to be set per span; baggage is the usual fix and withoutuser.idevents are dropped.
gen_ai.conversation.id isn’t being set, or isn’t propagating to child spans.Prompts and responses are missing. Either your tracer isn’t emitting gen_ai.input.messages and gen_ai.output.messages, or a Collector processor is stripping them.Spans arrive but properties are empty or spans arrive but my dashboard is empty. Your tracer is probably emitting a namespace we don’t read. Check the raw attribute names it produces against supported conventions.How is LLM cost data determined
How is LLM cost data determined
$mp_ai_cost_usd is the estimated USD cost of a model call, available on $mp_ai_span events. It’s calculated using the following span attributes:Rates come from a Mixpanel-maintained rate card, priced per 1M tokens by model.Cache tokens are priced separately, not at the full input rate.
gen_ai.usage.input_tokens includes both cache-read and cache-write tokens. Both counts are subtracted from the input total; the remainder is charged the full input rate, cache-read tokens are charged the cache-read rate, and cache-write tokens the cache-write rate.Historical prices are preserved. Each span is priced using the rate in effect on its own timestamp. This ensures reports spanning a price change stay accurate. Rate card updates apply to all history on your next query. There’s no need to re-send data.Models without a published rate: Cost will show as $0. Model names must match exactly. Break a report down by gen_ai.request.model to spot unpriced calls.Note: These are list-price estimates and won’t match a provider invoice exactly. Negotiated rates, discounts, and non-token charges aren’t reflected.How can I control the volume of spans sent to Mixpanel?
How can I control the volume of spans sent to Mixpanel?
- Send spans for work you’d investigate: model calls, tool calls, retrieval steps. Skip trivial internal functions.
- Sample high-volume, low-variance agents. Sample whole traces. Avoid sampling at the span level
- Use the Collector’s
filterprocessor to drop span types you don’t analyze
Can I backfill past conversations
Can I backfill past conversations
Backfilling span events is not currently supported.