Encoding Your Domain Expert: The Context Layer Behind Spotify's Data Assistant

Pavlina Mitsou, Jonathan WarburtonJun 2026

Problem

Spotify has more than 70,000 datasets, and demand for data answers outgrew what domain experts could handle one Slack message at a time. Putting all schemas into an LLM does not work. A million-token context cannot hold the whole warehouse, and a schema does not say what an "active user" means or that small values in an INT64 column are legacy test data. Given many similar tables, a model confidently picks the wrong one.

Example from the article: an INT64 column does not say that its values below 100 are legacy test data.

Solution in brief

Split the warehouse into domain "clusters", each owned by a named expert team. A cluster holds tables with profiling, expert-approved question-and-SQL pairs, and business docs. The agent works only from this curated context. A per-cluster health score tells owners where to spend curation time, and logged conversations feed back to them.

Questions this case answers
  • How to make a natural-language data assistant give trustworthy answers when the warehouse is too large to fit into the model's context and schemas do not carry business meaning
  • How to keep expert-curated context for an LLM agent accurate as the underlying data changes
  • How to make an LLM data assistant pick the right tables and write trustworthy SQL over a warehouse with tens of thousands of datasets?
  • How to scale the knowledge of a few data experts so that non-SQL users can self-serve data questions?

Tools and methods

  • Domain clusters (datasets, pairs, docs) — the unit of curated context, owned by a named expert team.
  • Few-shot question-SQL pairs — expert-approved examples that teach the model how to query the data.
  • ReAct loop — the agent reasons and calls tools in steps, adjusting to each result.
  • Cluster health score — continuous signals that show which cluster context has degraded.
  • Slack bot, MCP server, web UI — the surfaces where users reach the agent.
Continue reading — it's free

Google or a one-time email code. No password.