Problem
MiQ, a programmatic advertising company, builds media plans for agencies. Planners used many sources with no shared taxonomy, so plans differed by person, and a basic pitch could take 6-8 weeks. A general LLM gives a generic plan with no data behind it, and two answers months apart do not agree. Pointing an agent at the existing warehouse failed too: it could not tell which tables to use and sometimes went to the wrong source.
Example from the article: for a travel aggregator the agent had to profile the audience to target. It split the brief into about 15 sub-tasks that live in different systems.
Solution in brief
A ReAct agent calls Databricks Genie spaces and other tools through MCP. It classifies the question and shows its plan before querying. Genie gets business context on top of unchanged tables; a critique layer, tracing and golden-prompt tests check the output.
Questions this case answers
- How to make an LLM data agent pick the right tables and write correct SQL when the same business question can be answered from several overlapping sources
- How to add a critique layer that catches invalid queries, empty results and weak statistics before an answer reaches the user
- How to make an LLM analytics agent give accurate, consistent answers on enterprise data
- How to prepare warehouse tables and Databricks Genie spaces so an agent picks the right data and writes correct SQL
Tools and methods
- Databricks Unity Catalog and Genie spaces — text-to-SQL over campaign history and over consumer watching, browsing and buying data.
- MCP servers — expose Genie spaces and the GWI panel source as tools.
- ReAct agent (LangGraph, Databricks SDK) — observe, reason, choose a tool, loop.
- Intent mapping, two reflection stages — set the depth and check plan and output.
- LLM-as-judge and golden prompts in CI/CD — gate every push.
- LangSmith — per-node tracing across dev, integration and prod.
Google or a one-time email code. No password.