playbook.fidn

Playbook: a data science agent

An agent that answers questions about a club's data warehouse in plain English, with the SQL, the data and a chart behind every answer. It started as a side project called Boomhauer, which changed my mind about what RAG is.

Why

Analysts lose hours to "what does this column mean?" and "can you slice X by Y?". I wanted to see if an agent could answer both against a real warehouse, and to test my assumption that RAG is just full-text search plus an LLM.

What

Boomhauer: a Slack bot over a dbt project of SQL models and the BigQuery warehouse they build. Playbook: the rebuild for sports science, warehouse-agnostic, with charts, access control and evals.

How

Iterated by question. Each failure to answer one real question shaped the next tool. Then I checked the answers against an expert, and later against a generated warehouse with known answers.

The story in seven slides

Adapted from the Boomhauer deck I presented to the team. Swipe, or use the arrows.

01 · Problems to solve

Three kinds of question nobody wants to answer

  • Archaeology: "What does [obscure column] in segmentation mean... exactly?"
  • Chores: "Can you get me X sliced by Y?"
  • New joiners: "Can somebody explain this piece of the model?"

And a personal one: isn't RAG just full-text search plus an LLM? I wanted to find out by building it.

02 · Answering the first question

"What defines fav_game in the segmentation model?"

What I tried first:

  • Giving Claude all our SQL: 2.8 MB, about 650K tokens.
  • Giving it just the parts I thought mattered.
  • Pointing Claude Code at the SQL directory.

None of them was reliable, and the first one burns tokens fast.

Cartoon of a robot choking on filing cabinets of input, labelled max context 100K, now loading 10 million tokens
From the original deck.
03 · Let there be an index

A compressed view of the whole estate

Claude's own suggestion: build an index. Every SQL model gets an LLM-written description, its layer, what it references and what depends on it. The DAG comes along for free. A description reads like this:

"This model produces a comprehensive setup purchase transaction dataset combining
Stripe payment events, exchange rates, customer data, and refund/dispute
information... Primary use case: revenue analysis and financial reporting."

The index fits in the prompt. The SQL doesn't, and doesn't need to.

04 · Ever heard of the agentic loop?

The model decides, a tool does, repeat

the goal LLM decides what to do next Tool does what it decided tool call result

The first arm: one tool to read a SQL model in full. With the index to find the right model and the source to read it, the answer to the fav_game question was suddenly better than mine.

The revelation was that retrieval is a decision the model makes, step by step, not a single search up front.

05 · All the arms together

Five tools: two for the code, three for the data

ToolWhat it does
search_modelsFuzzy search over the index by keyword, column or concept. Scored (name +3, description +2, refs +1, path +1), top 15.
get_model_sourceThe full SQL of one model, with a header: layer, refs, dependants.
list_tablesTables in the warehouse datasets.
describe_tableColumns, types, row count and size, so the model checks a column exists before writing SQL.
run_queryA read-only SELECT against BigQuery.
06 · Alignment: neutral good

A guard, then a master prompt

  • Guard: a cheap classifier answers one word, VALID or INVALID: is this about the warehouse? It's told to be lenient, so it only turns away recipes and homework.
  • Master prompt: how to route a question. Definitions and lineage go to search_models then get_model_source. Numbers go to describe_table then run_query. Hybrids use both.
  • Always verify column names first, read the error and retry when a query fails, and cite the SQL files used.
  • Format for where the answer lands (Slack mrkdwn, no tables).
07 · Compare against an expert

Same question, side by side with the person who wrote the model

I asked Boomhauer for the definition of coaching_full_conversion and set its answer beside a colleague's reply to the same question. Both landed on the same rule: a trial on a coaching product that ended without the subscription being cancelled.

Boomhauer also named the model and its layer, listed its dependants, walked through the joins and filters step by step, gave a plain-English summary and said where the flag is used downstream.

Next steps from the deck: MCP support, auto-updating the codebase and regenerating the index, and testing other models. Most of that went into Playbook.

From Boomhauer to Playbook

Playbook takes the same approach to sports science: scan a club's warehouse, build a described index of it, and let an agent answer questions with read-only queries and charts. It was a new build, so I kept what worked and changed what wouldn't scale.

BoomhauerPlaybook
Regex blacklist on SQLsqlglot parse (single SELECT only), dry run, bytes-billed cap, forced LIMIT, timeout
Vendored dbt copy, parsed with regexdbt manifest.json
Flat JSON index baked into the imageVersioned, rebuildable index in an object store, with semantic search (local embeddings)
BigQuery onlyConnector interface: DuckDB and BigQuery
Text answers in SlackStructured results and Vega-Lite charts, with the SQL and data behind each answer
One big model for everythingModel choice per task, prompt caching, streaming, and evals

How we worked on it

  1. Principles first. Everything runs locally except inference. We never store client data, only the index that describes it. Queries are read-only and cost-capped in layers.
  2. Build a fake club to test against. A generator turns a YAML brief into a simulated season of football data in DuckDB: 3 squads of 25 players, daily wellness, GPS, screening, physio notes and injuries, with a mid-season switch of GPS vendor.
  3. Make it messy on purpose. Missed submissions, duplicate uploads, free-text body parts, pounds logged as kilograms, untagged medical records and different athlete ids in each system. Then plant six patterns and keep the ground truth outside the warehouse.
  4. Scan and index. Structure, profiles, keys and relationships inferred and confirmed by value overlap, then an entity map (players, squads, events) and LLM-written descriptions.
  5. Agent tools: search_catalog, describe_table, get_entity_map, run_query, make_chart. Charts render inline. Click one to see its chart, data and SQL.
  6. Score it. Seventeen questions with known answers, each tagged with the kind of mess it tests. An LLM judge marks the answers, and every run records accuracy, cost and time.

First eval run

Generated club warehouse, 17 known-answer questions, judged by Opus 5.5 (10 Oct 2026).

13/17
Sonnet 5.5 correct
$2.39
Sonnet run cost, about 9.5 min
11/17
Haiku 5.5 correct
$0.15
Haiku run cost, about 7 min

The misses were useful. Two turned out to be errors in my ground truth, not the agent's answers. One was a compliance rate with the wrong denominator. One was a force test the agent didn't normalise within each squad. Haiku also hedged on one question and missed an effect on another. Those became the next prompt and data changes.