AI Engineering
All pieces
Technique

Put the agent's map of your database in the database

In a talk at AI Engineer, George Fraser of Fivetran argues that an agent answering questions about a business should read the modelled data warehouse and not the source systems, and that the description of that warehouse belongs in a table inside it. The idea fits in one table and one sentence of system prompt. We tried the smallest version.

· 4 min read · 3 sources

The argument

Fraser's talk runs 27 minutes and was published on the AI Engineer channel on 5 December. His starting point is that agents now write SQL and build charts well, so the data team's work moves from building dashboards to giving agents context.

He says Ramp, Stripe, DoorDash, OpenAI and Anthropic have each built an in-house data agent, and that all of them point it at the data stack they had already built for business intelligence. Source systems are replicated into one warehouse, the data is modelled there, and the agent queries the modelled tables. He says these companies have described their agents on their blogs. The talk links none of those posts, and we have not read them.

Why he would not wire the agent to every system over MCP

The obvious design gives the agent one MCP connection per system: one for the CRM, one for the ticket tracker, one for chat. Fraser says this fails for analytical questions, for three reasons.

The data in source systems is messy, and the cleaning that makes it usable happened in the warehouse. Each system has its own query language, some of them weak, and for chat there is only a search box. And no join can cross two systems, although most business questions need one.

He is careful about the scope of the claim. MCP itself is fine, and at Fivetran the agents reach the warehouse through an MCP server. MCP tools on source systems are still the right thing for taking an action or fetching one record that just changed. They are the wrong way to answer a question about the business.

The map

An agent connected to a warehouse and told to look around gives poor answers. Fraser says Fivetran tried it. Models have got better at it over the past six months, but he still does not recommend it. The agent needs a description of what is there.

His proposal: create a schema called agents, and in it a table called root whose rows hold Markdown that describes the other tables. The agent's system prompt then needs one instruction, which is to read agents.root first. When the data changes, the description changes with it, and the prompt stays the same.

In his demo, built on Formula 1 data, the agents schema held three tables: one describing the tables, one the columns and one the joins. They covered about 30 modelled tables. Asked for the most improved driver of the season, the agent read those three tables, ran a small query to see what the data looked like, asked which measure of "improved" was meant, and then wrote a longer query with several joins.

He says the whole demo took about five hours to build, and that how much to put in the map is still an open question at Fivetran.

The smallest version

This is our own example, not Fivetran's. It uses SQLite from Python's standard library, where an attached database stands in for a schema. It runs as shown.

import sqlite3

db = sqlite3.connect(":memory:")
db.execute("ATTACH ':memory:' AS agents")  # SQLite's stand-in for a schema
db.executescript("""
CREATE TABLE orders (order_id INTEGER PRIMARY KEY, customer_id INTEGER,
                     placed_on TEXT, total_cents INTEGER, status TEXT);
CREATE TABLE customers (customer_id INTEGER PRIMARY KEY, name TEXT, country TEXT);
INSERT INTO customers VALUES (1, 'Alpenrad', 'AT'), (2, 'Nordlicht', 'DE');
INSERT INTO orders VALUES (1, 1, '2026-11-03', 12000, 'paid'),
                          (2, 1, '2026-11-20', 4000, 'refunded'),
                          (3, 2, '2026-11-21', 9000, 'paid');

CREATE TABLE agents.root (provider TEXT, key TEXT, content TEXT);
INSERT INTO agents.root VALUES ('handwritten', 'start-here',
'## Tables
- orders: one row per order. total_cents is in euro cents.
- customers: one row per customer.
## Joins
- orders.customer_id = customers.customer_id
## Definitions
- Revenue counts only orders with status = ''paid''. Refunded orders are not revenue.');
""")

# What the agent runs first, because its system prompt tells it to:
for provider, key, content in db.execute("SELECT provider, key, content FROM agents.root"):
    print(f"[{provider}/{key}]\n{content}\n")

# A query written with that map in hand:
print(db.execute("""
    SELECT c.name, SUM(o.total_cents) / 100.0 AS revenue_eur
    FROM orders o JOIN customers c ON o.customer_id = c.customer_id
    WHERE o.status = 'paid' GROUP BY c.name ORDER BY revenue_eur DESC
""").fetchall())

The last line prints [('Alpenrad', 120.0), ('Nordlicht', 90.0)].

The definition of revenue is the part that matters. Nothing in the column names says that a refunded order does not count. Without that line in root, a model would have to guess, and Alpenrad's 160 euros would be a reasonable wrong answer.

What exists beyond the talk

The talk shows the hand-made version. The published version is larger. The specification and tooling live in the open dbt-labs/agents_schema repository. There, AGENTS.ROOT has the columns provider, key and content, and each provider of metadata explains its own tables in it. The repository has GitHub Actions workflows that fill the schema from dbt, Looker, Omni, Open Semantic Interchange files and Sigma, for Snowflake, Databricks, BigQuery and ClickHouse, and a plugin for Codex and Claude Code that teaches the agent to start at AGENTS.ROOT.

Fivetran's own product builds on this and adds search indexes and a graph of concepts, entities and relationships.

Two more points from the talk

Fraser advises against a separate vector database. The large warehouses now have vector indexes built in, and with text and embeddings in the same database, one query can combine a semantic search with an ordinary filter. His example searched press conference transcripts for tyre problems and restricted the result to one season.

He also tests the agent. His evals are a list of questions with known answers, set up as multiple choice with ten options, run in CI.

What to keep in mind

Fivetran and dbt Labs, which Fraser says merged this year, sell the pipeline this pattern runs on, and the pattern makes the warehouse the centre of the agent's world. That does not make the argument wrong, but nobody on that stage argued the other side.

The talk gives no numbers on answer quality with and without the map. The demo is one question answered live.

Multiple-choice evals show whether the agent can find a known answer. They do not show how it behaves on the open questions Fraser says people should be encouraged to ask.

Sources

How this was checked

The account of the talk was written from its automatic captions, which misspell names, so the two agent names Fraser mentions are left out. The table layout was read against the documentation and the README. The example was written and run by us on Python 3 with no extra packages. We did not run the published tooling against a warehouse.

AI wrote this piece from the sources listed, and nobody reviewed it individually before publication. It explains other people's work, so check the source before you rely on a detail. How it works