After 10 years of turning knobs in Mixpanel, here’s why I’m all in on Headless
Inside Mixpanel

After 10 years of turning knobs in Mixpanel, here’s why I’m all in on Headless

After 10 years of turning knobs in Mixpanel, here’s why I’m all in on Headless
Article details
Author picture
Aaron Krivitzky
Principal Solution Engineer @ Mixpanel
Published:
May 28, 2026
<em>Every report, cohort, funnel, retention curve, dashboard, feature flag, and experiment is now a typed Python object, ready for whatever you—or your agent—wants to do with it.</em>

The headless pattern

The problem: Best features locked behind a UI

Benefits of code mode

Mixpanel Headless
Two ways to ask the same question
How tool mode and code mode handle a multi-step analytical query
Tool Mode (MCP)
User prompt
Agent: Plan step 1
Tool call: List cohorts
Round-trip 1
Agent: Read JSON, plan step 2
Tool call: Query sessions per country
Round-trip 2
Agent: Read JSON, plan step 3
Tool call: Query purchases per country
Round-trip 3
Agent: Divide, sort, top 5 in head
Answer
Code Mode (Headless)
User prompt
Agent: Write program
Execute: 3 API calls in one program
Answer
Tool Mode (MCP)
3+ model round-trips
JSON blobs fill context window
LLM does the math
Code Mode (Headless)
1 program execution
Only the final answer returns
Python does the math
You
Do users who set budgets actually save more money in our app?
Here you go.
import mixpanel_headless as mp
from mixpanel_headless import Filter, Metric, CohortDefinition, CohortCriteria

ws = mp.Workspace()

budgeters = CohortDefinition(
    CohortCriteria.did_event("budget_created", at_least=1, within_days=90)
)

result = ws.query(
    [Metric("savings_deposit", math="sum", math_property="amount"),
    Metric("savings_deposit", math="unique")],
    formula="A / B",
    formula_label="avg savings per budgeter",
    where=Filter.in_cohort(budgeters, name="budgeters"),
    last=90,
)

print(result.df)

Expansive analytics surface

Mixpanel Headless
Four primitives. Five query engines.
Learn these building blocks once—they compose identically across every report type in the SDK.
Building blocks
Filter Conditions on events, users, and properties
Metric What to measure and how to aggregate it
CohortDefinition A named group of users defined by behavior
CohortCriteria The behavioral rules that define membership
Compose across all five query engines
Query engines
Insights Trends & breakdowns
Funnels Conversion paths
Retention Return behavior
Flows Event sequences
Profiles User attributes
One Filter type works across all five engines. An MCP catalog would need a separate schema for each one.

The DataFrame payoff

Meet Mixpanelyst: Our first custom agent harness

Mixpanel Headless
Mixpanelyst benchmark
Scored against planted ground-truth patterns across five industry datasets—no hints given to the model
Test
Vertical
Score
Binge-and-recovery viewer analysis
Media
95
Mobile vs. web conversion gap
Ecommerce
92
Budget-to-savings correlation
Fintech
91
Course completion learning signal
SaaS
90
Power user behavioral signature
Gaming
88
You
Do viewers who finish episode 1 in one sitting binge the rest of the season faster than viewers who watch it in chunks?
Here you go.
# behavioral cohort: finished episode 1 of a specific show in one sitting
bingers = CohortDefinition(
    CohortCriteria.did_event(
        "episode_completed",
        where=Filter.equals("show_id", "stranger_things_s4")
            & Filter.equals("episode_number", 1)
            & Filter.less_than("time_to_complete_min", 90),
    )
)

# funnel: hold show_id constant; users must progress through the SAME show
funnel = ws.query_funnel(
    ["episode_completed"] * 4, # nice :)
    where=Filter.in_cohort(bingers),
    holding_constant="show_id",
)

# retention: filter to the same show
retention = ws.query_retention(
    "episode_completed", "episode_completed",
    retention_unit="week",
    where=Filter.in_cohort(bingers)
        & Filter.equals("show_id", "stranger_things_s4"),
)

# run the same against the inverse cohort, join in pandas, compare
You
I want to try Mixpanelyst. How do I get started?
Three commands.
/plugin marketplace add mixpanel/mixpanel-headless
/plugin install mixpanel-headless@mixpanel-headless-marketplace
/mixpanel-headless:setup

What this means

Share article
Aaron Krivitzky
Aaron Krivitzky
Principal Solution Engineer @ Mixpanel