← Back to list

From Data Chaos to Marketing Clarity: Building an Agentic MMM Workflow with Google ADK

Marketing Mix Modeling has always sat at an uncomfortable intersection: it demands statistical rigor, clean data, and deep domain…

Janhavi Kumbhar · 2026-04-19 06:12 · 2 claps · 3.8 min read
#marketing-mix-modeling #mmm-agent #agentic-workflow
Open on Medium ↗
Wiki topics: AGT · AI Agents ECO · Economy · General

From Data Chaos to Marketing Clarity: Building an Agentic MMM Workflow with Google ADK

Marketing Mix Modeling has always sat at an uncomfortable intersection: it demands statistical rigor, clean data, and deep domain knowledge, but the people who need its outputs most are often furthest from all three. A media analyst staring at a dozen raw CSV exports from different ad platforms, with mismatched date formats and inconsistent column names, faces the same problem every time: the modeling can’t start until the data is clean, and cleaning the data requires knowing what the model needs.

This is the problem we set out to solve.

The architecture: two agents, one pipeline

The system is built on **Google’s Agent Development Kit (ADK) with Gemini 2.5 Pro as the underlying model. It consists of two specialized agents, a preprocessing agent and an MMM agent**, connected in a deliberate sequence that mirrors how an experienced analyst would actually work through the problem.

The pipeline begins the moment a user uploads their CSV files. Before any agent reasoning kicks in, a set of default diagnostic functions runs automatically. These produce a structured data profile for each file: row and column counts, null value percentages, negative value distributions, summary statistics, and two visualizations, spend vs impressions and spend vs clicks. This isn’t AI-generated output; it’s deterministic Python running against the uploaded data, giving the user a ground truth view of what they’re working with before any transformation happens.

How data flows through the system, and what the LLM actually sees

This is worth being precise about, because it matters both technically and for anyone thinking about data privacy.

The full CSV data never gets passed to the language model. Instead, the preprocessing agent receives the structure of the data: column names, data types, a small representative sample (typically the equivalent of df.head()), and the statistical summary already generated. This gives the model enough context to reason about the data to understand what each column represents, identify likely issues, and write appropriate transformation code without transmitting the actual row-level records.

When the user provides preprocessing instructions (or when the agent generates its own suggestions), the LLM produces Python code. That code is executed by a backend tool called the code executor, which runs in a sandboxed environment directly against the full dataset. The executor returns the output transformed data summaries, error messages, or confirmation back to the agent. The raw data stays in the execution layer throughout. What travels over the wire to the model is context and results, not records.

The preprocessing agent: intelligent suggestions when you need them

One of the more practically useful design decisions was making suggestions a fallback rather than an assumption. If a user arrives with clear instructions : “remove rows where spend is null,” “rename channel columns to lowercase,” “aggregate to weekly” : the agent executes them. But if they arrive without a plan, which happens more often than you’d expect, the agent analyzes the data profile and proposes a preprocessing roadmap.

These suggestions are grounded in the actual data diagnostics. If the null percentage on an impressions column is above a threshold, the agent flags it and suggests a strategy , imputation, exclusion, or flagging for review. If negative values appear in a spend column, it surfaces that as likely erroneous rather than silently dropping them. The user can accept, modify, or override any suggestion before code execution begins.

This design pattern, structured observation followed by reasoned suggestion followed by user confirmation before action , is one of the core principles of building reliable agents for data workflows. The model’s judgment should inform, not replace, human decision-making when the stakes involve upstream modeling.

The MMM agent: connecting clean data to Google Meridian

Once preprocessing is complete, the MMM agent takes over. Its backend is **Google Meridian**, a Bayesian MMM framework that requires precise configuration to run well. The most consequential part of this configuration is the specification of channel-specific priors.

Priors in a Bayesian model encode your beliefs about how a channel behaves before you’ve seen the data. For a paid search channel, you might have strong prior beliefs about its short adstock decay and high baseline ROI. For a display channel, you’d encode different assumptions about reach curves and longer lag effects. Getting these right, or at least defensible , is the difference between a model that confirms your biases and one that actually changes how you allocate budget.

The MMM agent walks users through this specification conversationally. Rather than presenting a configuration form with 40 fields most users wouldn’t know how to fill, it asks targeted questions about each channel, explains what each prior controls, and translates the answers into the Meridian configuration format. Once the priors are set and the model runs, the agent surfaces the outputs: channel contribution estimates, ROI by channel, saturation curves, and budget optimization recommendations.

Why this matters for media agencies

MMM is not new. What’s new is making it accessible without making it shallow. The challenge with democratizing a technically demanding methodology is that simplicity usually comes at the cost of rigor , a dashboard that gives you an “ROI score” without letting you inspect the priors or interrogate the model structure is worse than no model at all, because it creates false confidence.

The agentic approach tries to thread this needle. The agent handles the mechanical complexity , data profiling, code generation, configuration scaffolding while keeping the analyst in the loop on the decisions that actually matter. You still specify the priors. You still review the preprocessing steps before they run. The model does the work; the analyst retains the judgment.

That’s the version of AI-augmented analytics worth building.


메타데이터
post_id
0bc8bb40daeb
slug
from-data-chaos-to-marketing-clarity-building-an-agentic-mmm-workflow-with-google-adk-0bc8bb40daeb
url
https://medium.com/@janhavi.kumbhar71202/from-data-chaos-to-marketing-clarity-building-an-agentic-mmm-workflow-with-google-adk-0bc8bb40daeb
canonical_url
https://medium.com/@janhavi.kumbhar71202/from-data-chaos-to-marketing-clarity-building-an-agentic-mmm-workflow-with-google-adk-0bc8bb40daeb
author_url
https://medium.com/@janhavi.kumbhar71202
status
ok
fetched_at
2026-06-09 15:37:30