
Dan Patiño
AI Strategy & Innovation at Coderhouse
Data
What Is a Semantic Layer and Why AI Agents Can't Query Your Data Without One
A semantic layer is a business-meaning layer that sits between raw data and the people or systems querying it, mapping technical fields, tables and joins to the terms a person actually uses — "active customer," "monthly revenue," "churn" — so every query returns the same number no matter who or what is asking. That consistency used to be a nice-to-have for analytics teams tired of three dashboards disagreeing on "revenue." It's now becoming a requirement, because the newest thing asking these questions isn't a person building a dashboard, it's an AI agent answering someone in Slack, and an agent has no instinct for which of your eleven "customer" tables is the right one.
For most of the BI era, that ambiguity was manageable because a human analyst carried the missing context in their head. They knew "active" meant "purchased in the last 90 days" in this company, not the technical definition in the schema. An AI agent querying the same warehouse doesn't have that history, so it either asks, guesses, or writes a query that runs fine and returns the wrong number with total confidence. The problem is rarely the model. It's that nobody told it what the business means by the word it just used.
Why AI Agents Make the Semantic Layer Non-Negotiable
At Gartner Summit 2026, analyst Andres Garcia-Rodeja put a number on this: Gartner predicts 60% of agentic analytics projects relying solely on the Model Context Protocol, without a consistent semantic layer underneath it, will fail. The reasoning is that MCP standardizes how an agent connects to a data source, but it doesn't tell the agent what the data means once it's connected. Gartner's own framing is blunt about where this is heading: by 2030, universal semantic layers are expected to be treated as critical infrastructure for enterprise AI, in the same category as the data platform and the security layer, not as an optional BI add-on.
What Changes When a Model Has Business Context
A 2026 benchmark update from dbt's engineering team measured this directly, comparing raw text-to-SQL against a semantic layer across current frontier models. Claude Sonnet 4.6 answered 90.0% of queries correctly writing SQL against the raw schema; routed through a semantic layer, that jumped to 98.2%. GPT-5.3 Codex went from 84.1% with text-to-SQL to a full 100.0% through the semantic layer, on the same question set. Text-to-SQL itself has improved enormously, nearly doubling from 32.7% accuracy in 2023 to 64.5% in 2026 as models got better at reading raw schemas — but even that improvement doesn't close the gap, and it doesn't fix the failure mode that matters most in practice.
That failure mode is the real argument for a semantic layer. When a query falls outside what a semantic layer covers, it returns an explicit error. When text-to-SQL fails, it typically doesn't error out at all — it returns a plausible, fluent, wrong answer, and nothing about the response signals that anything went wrong. For a one-off exploratory question that's a minor annoyance. For a number that ends up in a board deck or an automated report, it's the difference between a system you can trust and one that occasionally lies with total confidence.
The Fix Is Modeling the Data, Not Just Adding a Layer
The same dbt benchmark found that a semantic layer isn't a shortcut around doing the modeling work. Adding just three minimal dbt models to the underlying data lifted the semantic layer's accuracy from 72.7% to 98.2%, and it lifted text-to-SQL from 64.5% to 90.0% on the very same dataset. The layer amplifies good modeling; it doesn't replace it. A separate benchmark from Atlan's AI Labs measured the same underlying effect from another angle: adding proper business context to a text-to-SQL system improved its accuracy by 38% in customer deployments, reinforcing that most AI accuracy failures are context problems, not model problems.
How This Connects to the Rest of the AI Data Stack
A semantic layer rarely stands alone. It's the layer that made possible the shift our explainer on agentic BI described, where an agent answers a business question directly instead of a person reading a dashboard — that only works if the agent has somewhere to look up what "revenue" means first. It also depends on the same discipline covered in our piece on data contracts, because a semantic layer built on a schema that changes without warning breaks the moment the underlying table does. And at a technique level, defining what a term means for a model to use reliably is really the data-team version of what our guide on context engineering describes for AI agents more broadly: giving a model the right information at the right moment, not just a bigger prompt.
Real Companies Building This Now
Workday is building what it calls an AI-ready semantic layer, using an MCP server to expose the organization's shared business language to agents rather than raw tables. DigiKey's Chief Data Analytics Officer describes the goal in similar terms: a single source of truth for context across both operational and analytical systems, so an AI agent and a human analyst are working from the same definitions instead of two separate ones that happen to look alike.
How to Start Without Rebuilding Your Entire BI Stack
Most teams don't need to model every table before an AI agent can be trusted with any of them. The practical starting point is picking the 10 to 15 metrics that already show up in board decks and weekly reports, defining those precisely in the semantic layer first, and scoping any AI agent to answer only within that boundary. A query outside that scope should return a clear "I don't have a definition for that yet" instead of a guess. That boundary is what lets a team ship agent-facing analytics in weeks instead of waiting for a company-wide modeling project to finish.
Recommended Coderhouse Courses
If you're the one building the models a semantic layer depends on, the Data Engineering Course covers the pipeline and modeling skills that make a semantic layer accurate instead of just present. If you're closer to the analytics side and want to understand how metrics get defined and queried in the first place, the Data Analytics Course is the right starting point.
Frequently Asked Questions
Is a semantic layer the same thing as a BI tool?
No. A BI tool is where people view dashboards and reports. A semantic layer is the shared definition layer underneath, and it can feed a BI tool, an AI agent, or both at once with the same consistent numbers.
Does a semantic layer replace the Model Context Protocol?
No, they solve different problems. MCP standardizes how an agent connects to a data source; a semantic layer tells the agent what the data it just connected to actually means. Gartner's research is specifically about the failure rate of using MCP alone, without one.
Do I need a semantic layer if my AI agent already writes good SQL?
The risk isn't whether the SQL runs, it's whether it silently returns a plausible wrong answer. A semantic layer's main advantage is failing loudly on an out-of-scope question instead of guessing, which matters most for any number that reaches a decision-maker unchecked.
Is this only useful for large companies with big data teams?
No. The dbt benchmark found the biggest accuracy jump came from adding just three minimal data models, not from an enterprise-wide rollout. A small team can define its 10 most-used metrics and get most of the benefit immediately.
What's the biggest mistake companies make when adopting a semantic layer?
Treating it as a tool to install rather than data to model. Both the dbt and Atlan benchmarks found the accuracy gains came from properly modeling the underlying business logic, not from the layer itself; a semantic layer on top of unmodeled data still gives an agent nothing reliable to work with.
I'm Dan Patiño, head of AI Strategy & Innovation at Coderhouse. My day-to-day work involves merging the tactical management of e-commerce (CRO, Email Marketing and SEO) with the development of disruptive solutions. I specialize in building internal AI-powered apps to automate tasks and boost innovation within the team. I firmly believe that technology is strategy's best ally. To dive deeper into my professional journey, I'll be waiting for you on my LinkedIn profile.