Bringing structured context to AI with dbt
AI is everywhere, but reliable, production-safe conversational AI is still surprisingly rare. That’s because most AI workflows today are missing a critical ingredient: structured context.
This is the first post in our four-part series, Bringing structured context to AI. We'll learn how dbt, along with the dbt Model Context Protocol (MCP) server, lets you see the important data and metadata inside your dbt project. This makes it easy to use, cost-effective, and safe for AI systems.
Let’s start with the most immediate and visible use case: conversational analytics.
The promise (and limits) of conversational analytics
The dream has always been simple: Ask a question in plain language. Get answers you can trust.
Text-to-SQL made that feel within reach. It taught models to translate natural language into a query. But anyone who has tried to rely on text-to-SQL in production knows its limits. Without context, AI guesses. It picks the wrong model, joins on the wrong key, applies outdated metric logic, overlooks governance rules, or runs expensive queries that blow up warehouse costs.
That’s because LLMs predict likely responses probabilistically based on patterns in training data. They don’t understand your business context. When they operate without structure, they can’t reliably generate SQL, interpret business logic, or respect governance rules.
And real analysis isn't just one SQL query. It’s multi-step. It involves planning, comparing, validating, and explaining. This is where the next generation of conversational analytics becomes agentic.
Structured context layer: turning AI into an analyst
Agentic analytics systems don’t just generate one query. They plan, iterate, check assumptions, apply lineage, and explain reasoning. They behave the way an analyst behaves.
Conversational analytics agents can only do this if they have access to a structured context layer. This is a foundation that makes AI outputs predictable, governed, explainable, and cost-efficient not just in compute, but in token usage as well.
A recent Gartner survey found that through 2026, 60% of AI projects will be abandoned if they aren’t supported by “AI-ready” data.
The path to adoptable, trustworthy AI starts with a data foundation that provides structure and context.
What is the structured context layer?
The structured context layer is the maintained layer of logic and metadata that gives data models meaning. It includes:
- metric and dimension logic,
- lineage,
- tests,
- ownership,
- policies,
- and business rules.
The structured context layer sits on top of your warehouse tables and models and turns raw data into shared understanding.
In the dbt ecosystem, this layer already exists.
dbt has become the standard for analytics engineering precisely because teams define meaning, quality, and relationships once, then reuse it everywhere.
This layer is the connective tissue between your data, your business logic, and the AI systems acting on it.
So as your AI stack evolves with new tools, agents, and interfaces, your structured context layer remains the same.
But defining context isn’t enough. AI must be able to consume it. A structured context layer includes definitions and governance, but also the ability to expose context consistently across tools, workflows, and analytical interfaces. And it does this in a cost-efficient and permission-aware way to reduce warehouse compute and token overhead.
What an effective structured context layer looks like (and how dbt provides it)
An effective structured context layer must deliver five essential capabilities that make AI reliable, explainable, and production-ready. dbt provides these capabilities out of the box:
- Defines and optimizes business logic: Metrics and transformations should be centrally defined and compiled into efficient SQL, to make AI outputs faster, cheaper to compute, and more reliable.
- With dbt: The dbt Semantic Layer, powered by open-source MetricFlow, provides governed definitions and compiles them into efficient SQL to guarantee accuracy, consistency, and performance. And dbt Fusion ensures that SQL executes consistently and efficiently on your warehouse. AI retrieves both the correct meaning and the correct computation of concepts like “revenue” without the model wasting tokens trying to infer missing logic.
- Guardrails to shrink the search space: AI needs guardrails so it only chooses from correct models, joins, and keys.
- With dbt: dbt narrows ambiguity by giving AI a known structured schema, governed metrics, naming conventions, and artifacts like manifest.json. The model no longer has to infer structure, it chooses correctly to reduce unnecessary reasoning tokens.
- Ensures correctness through version-control, validation, and dynamism: Your context must evolve safely as your business changes.
- With dbt: All context lives in version-controlled code and is continuously validated through contracts, tests, CI, and
dbt build. This makes your context layer dynamic but stable. It updates with the business while remaining reliable for AI.
- With dbt: All context lives in version-controlled code and is continuously validated through contracts, tests, CI, and
- Provides lineage and freshness for operational grounding: AI must understand where data comes from, what it depends on, and whether it’s trustworthy.
- With dbt: The lineage graph, metadata freshness, and documentation give AI agents full insight into dependencies and data health. This is foundational for multi-step reasoning.
- Makes context machine-readable and interoperable: A structured context layer must be accessible to any LLM, agent, or workflow in standardized, permission-aware formats.
- With dbt: The dbt MCP server and artifacts expose metrics, lineage, documentation, and model metadata through dbt’s MCP tooling (Semantic Layer tool, Discovery tool, CLI tool, Fusion tool, and Admin tool) that honors your existing access controls and makes your context layer fully interoperable across AI tools, BI interfaces, and orchestration systems.
Together, these capabilities form dbt’s structured context layer, a single, explainable source of truth for any AI system.
With this foundation, AI systems stop guessing and start reasoning. Your AI system knows what “revenue” means. It knows how it’s calculated. It knows which upstream models feed into it. And it can use that knowledge to navigate multi-step analytical workflows, reliably and cost-efficiently.
You can’t predict the full range of questions users will ask. What you can control is the quality of the structure they rely on. The better your dbt project is modeled, governed, and documented, the more reliably your AI agents can perform, no matter the query.
How customers use dbt to ship chat with their data experiences
Teams across analytics, finance, marketing, and product are already using conversational interfaces to safely access and chat with governed data. They can:
- Run quick, safe analysis: “Average order value by region?”
- Ask clarifying definitions: “What does ‘qualified lead’ mean?”
- Trace lineage: “What feeds into
monthly_churn_rate?” - Investigate anomalies: “Did any upstream sources change before this spike?”
- Find models: “Is there a model for trial-to-paid conversion?”
Teams like Norlys and LEAP Consulting are already running this in production, grounding every chatbot answer in the same definitions and models the business already trusts.
“With dbt MCP server and dbt Semantic Layer we see a great opportunity to leapfrog our ambitions to introduce a "metrics first" model across our organisation. Our ambition is to have a few standard reports with core metrics combined with an innovative solution that enables anyone at Norlys to retrieve the insights they need simply by asking a question through a chatbot interface powered by an LLM. dbt MCP server and dbt Semantic Layer enable this.” — Søren Persson, Director of Data Engineering, Norlys
“dbt provides the governed context with metrics, lineage, and tests, and the dbt MCP Server makes that context usable by AI systems. Together, they let us design and set up trustworthy conversational analytics quickly for customers, plugging answers into their AI chat or agent workflows with an audit trail by default. It is one of the fastest paths to reliable, production-grade AI we have seen.” — Jonas Munk, Partner, LEAP Consulting
That’s not a prototype. That’s conversational AI, in production.
Live, reliable, and powered by dbt’s structured context layer.
Thinking about conversational analytics? Start with dbt as your foundation.
If you're exploring conversational access to data, the key question isn’t which model to use, it’s whether your foundation is ready. Ask yourself:
- Is your data structured and governed?
- Are metrics defined, tested, and version-controlled?
- Can AI access lineage and documentation to explain results?
- Is access properly governed and cost-efficient?
With dbt, you can connect any LLM (Claude, OpenAI, or your own internal assistant) and build your own multi-step conversational analytics agents via the dbt MCP server. Or try the dbt Analyst Agent (now in beta), a purpose-built AI agent that reasons directly on your governed data.
It’s time to unlock the structured data and metadata your team already trusts. Get a demo of the dbt MCP server today or join the dbt Agents waitlist today.
Live virtual event:
Experience the dbt Fusion engine with Tristan Handy and Elias DeFaria.
VS Code Extension
The free dbt VS Code extension is the best way to develop locally in dbt.





