Semantic Layer for AI Agents: From Raw Data to Trusted Answers
13 min read | Published


AI agents fail on business data for a predictable reason: they are asked to guess what the business means. Point an agent at raw tables and it has to infer what "revenue" includes, which joins are safe, and who is allowed to see the result. It guesses differently each time, so the same question returns different numbers.
A semantic layer for AI agents sits between your data and the agents that query it, providing a governed model of business meaning. It defines metrics, entities, relationships, and permissions once, so agents select trusted definitions instead of writing their own logic against raw tables. The result is consistent answers, enforced access rules, and numbers anyone can trace back to a definition.
The urgency is real. In March 2026, Gartner predicted that by 2030, universal semantic layers will be treated as critical infrastructure, alongside data platforms and cybersecurity. This guide explains what agents need from a semantic layer, how the pieces work together, and how to get an existing semantic layer ready for agents.
Key Takeaways
- A semantic layer for AI agents defines business meaning once, so agents select governed metrics instead of generating SQL against raw tables.
- Text-to-SQL gives an agent access to data; a semantic layer gives it an agreed definition of what the data means.
- Agents are a different kind of data consumer: they query continuously, at high volume, and increasingly take actions, not just read results.
- An AI-ready semantic layer needs seven properties: shared definitions, readable metadata, per-request permissions for reads and actions, open interfaces, predictable performance, traceable answers, and safe change management.
- Definitions in legacy BI tools are valuable input, not an agent-ready layer; most teams migrate that logic into a semantic layer designed for agents rather than modeling from scratch.
- A semantic layer covers meaning; approved sources, business priorities, and deeper observability belong to a broader context layer.
What is a semantic layer for AI agents?
A semantic layer for AI agents is a governed model of business meaning that an agent can discover, query, and trust. It translates technical structures, such as tables, columns, and join keys, into business concepts like customers, orders, and net revenue. The agent works with those concepts; the semantic layer handles the translation to SQL.
For an agent, the semantic layer supplies five things it cannot reliably infer on its own:
- Metrics: exact definitions of measures such as net revenue, churn, or active users, including filters and time logic.
- Entities and dimensions: the business objects an agent reasons about, such as customer, region, or product line.
- Relationships: approved join paths and grain, so a question that spans two tables does not double-count rows.
- Permissions: rules that decide which rows, columns, and actions a given user or agent may access.
- Descriptions and synonyms: human-readable context that maps everyday language ("sales", "bookings") to the right object.
The layer itself is not new. Business intelligence (BI) tools have used semantic layers for decades to keep dashboards consistent. What changes with AI agents is the consumer: the same definitions now have to serve software that asks questions on its own, at machine speed, on behalf of many different people.

Why AI agents need a semantic layer (and why text-to-SQL isn't enough)
AI agents need a semantic layer because the meaning of business data is not stored in the schema. Ask "What was Q4 revenue?" and three answers can all be valid: sales counts booked deals, finance counts recognized revenue, and treasury counts cash collected. A table named orders does not tell a language model which one you meant.
Text-to-SQL (translating a natural-language question directly into a SQL query) solves access, not meaning. Modern LLMs write syntactically correct SQL with ease. The failures happen one level up, in four recurring patterns.
What is metric drift?
Metric drift is when the same question produces different numbers because the agent re-derives the metric on every prompt. One run excludes refunds, the next includes tax, the third uses ship date instead of order date. Each query is valid SQL. None of them matches the number finance reports, and users stop trusting the agent after the first mismatch.
Why do wrong joins and grain matter?
Wrong joins silently inflate results. Real warehouses contain fan-out joins, slowly changing dimensions, and several tables that all look like "the customer table." If an agent joins orders to order lines before summing order totals, revenue doubles and nothing flags the error. A semantic layer fixes the join path and grain in advance, so the agent cannot choose a wrong one.
Why doesn't a SELECT statement enforce permissions?
A SQL query has no built-in notion of who is asking. A correct query and a query that exposes another customer's data look identical to the model. If access rules live only in a dashboard or in a prompt, an agent can bypass them with one unexpected question. Permissions have to apply when the query is generated, not after the result comes back.
Why are unexplainable answers a problem?
An answer that nobody can trace cannot be used in a decision. When an agent returns a number backed only by 40 lines of generated SQL, an analyst has to reverse-engineer the logic before signing off. When the answer names the metric definition, filters, and time range it used, review takes seconds.
This is why GoodData.AI takes a metadata-first position: the LLM works with governed metadata and never guesses SQL against raw tables. The reasoning behind that design is explained in why AI in analytics needs metadata.
Go deeper: Most existing semantic layers were built for dashboards, not agents. The whitepaper Why Agents Will Hallucinate on Your Current Semantic Layer explains how scattered BI logic causes agent errors and how to refactor it.
Agents are a different kind of data consumer
AI agents change who consumes the semantic layer, not just how often. A BI semantic layer was designed for people reading dashboards at human speed. Today the same definitions serve a spectrum of consumers, from analysts exploring a dashboard to autonomous agents that run a business process end to end. Each step along that spectrum raises the bar.
| Consumer | Who asks | How often | What it needs from the semantic layer | Cost of a wrong definition |
|---|---|---|---|---|
| Dashboards and self-service | A person exploring data | Occasionally, at human speed | Consistent metrics across reports | A misleading chart someone may notice |
| Data applications | Many end users inside a product | Continuously, many users at once | Consistent metrics plus per-customer isolation | Wrong numbers shown to customers |
| Assistants and copilots | A person delegating analysis | Many follow-up questions per session | Readable descriptions, synonyms, and traceable answers | A confident wrong answer used in a decision |
| Autonomous agents | Software acting on its own | Constantly, many queries per task | All of the above, plus permissions for actions and approvals | A wrong action, such as an updated record or a triggered workflow |
The practical conclusion is to run one semantic layer for all four, not a separate layer per consumer. Two layers drift apart the moment someone edits a metric in only one of them. One governed layer means a dashboard, a customer-facing app, and an agent return the same Q4 revenue, calculated the same way, under the same access rules.
The shift also explains why agentic analytics raises new requirements for the data foundation. Agents do not just read more; they ask unanticipated follow-up questions, chain several queries into one task, and increasingly act on the results. Serving all four consumers well takes one governed serving foundation for people, applications, and agents, not a stack of separate integrations.
What an AI-ready semantic layer needs
An AI-ready semantic layer needs seven properties that a dashboard-era semantic layer often lacks. The first two make meaning explicit; the other five make that meaning safe to serve to agents at scale and safe to change over time.
Business meaning defined once
Every metric, entity, and relationship should have exactly one governed definition that all consumers reuse. If "net revenue" exists in a dashboard formula, a SQL view, and a spreadsheet, an agent has three candidates and no way to choose. Defining it once, ideally as version-controlled code, turns a guess into a lookup.
Metadata agents can actually read
Agents rely on names and descriptions far more than human analysts do. A metric called ASP_v2_final with no description leaves the agent guessing. “Average selling price (ASP): net revenue divided by units sold, excluding returns” tells it what the metric means and how it is calculated. AI-ready metadata includes clear titles, descriptions that lead with business meaning, synonyms, expanded abbreviations, and an owner.
Automated checks help here. In GoodData.AI, the Semantic Quality Agent flags duplicate or too-similar titles and descriptions and unknown abbreviations across metrics, attributes, facts, and date datasets, so you can fix them before agents encounter them. AI Memory and AI Knowledge then ground the assistant in each workspace's business terms, so the synonyms and conventions your teams use point to the right objects.
Permissions for what agents can see and do
Agent permissions must cover both data access and actions, and they must be evaluated on every request, not once per connection. Being connected to an approved application or holding a broad role is not enough. The safer pattern is that an agent works under the identity of the person it acts for: every request carries that user's permissions, so the agent can see, compute, and change only what the user could. Row-level and column-level rules apply when the semantic layer compiles a query, so an agent acting for one user cannot return another user's data.
Actions need the same discipline. Creating a metric, a visualization, or an alert should depend on explicit rights, and changes an agent proposes should be reviewable before they are saved.
In GoodData.AI, one permission model covers BI and AI. Object-level permissions control who can view, share, and edit individual columns, metrics, and visualizations, and the UI, APIs, SDKs, AI Assistant, Smart Search, and the MCP Server run each request with the authenticated user's permissions. Requests from external agents over A2A also respect which AI agents the user may access. Creating metrics and visualizations is a separate permission, and when the AI Assistant builds a dashboard that adds new metrics or visualizations, it shows what will be created before anything is saved.
Platforms that enforce permissions in every AI interaction treat this as governance by design, not as an instruction in a prompt. In customer-facing products, each tenant needs strict isolation; a multi-tenant architecture keeps one customer's agent from ever reaching another customer's data.
Open interfaces for agents
Agents need a standard way to discover and request governed metrics. The Model Context Protocol (MCP) has become the common interface: an agent lists available metrics and dimensions, then asks for them by name instead of writing SQL. Agent-to-agent (A2A) protocols, SQL, and SDKs cover other clients. The requirement is that every interface serves the same definitions and the same rules. For a practical example, see how GoodData.AI built an MCP server for governed analytics. Answers can also come back as visuals: with MCP Apps, GoodData.AI visualizations render directly inside MCP clients such as Claude, with governed metrics and the user's permissions.
Predictable performance and cost under agent load
Agent traffic is continuous and bursty, unlike the steady load of people opening dashboards. A single agent task can generate tens or hundreds of short-lived queries, and hundreds of agents can run at once. Handling that load takes more than raw query speed. Workload isolation prevents one agent from slowing down everyone else. Scheduling, prioritization, and caching help manage both interactive and automated requests.
Reusing cached results for repeated questions keeps response times and costs predictable. In GoodData.AI, caching with validity periods and pre-aggregation keep agent traffic off production warehouse compute, and each data source can expire cached results after a set period or on a schedule that follows your data refreshes. The GoodData.AI architecture overview describes the approach to caching and high-concurrency workloads.
Answers you can trace back to a definition
Every answer an agent returns should include the metric definition, filters, dimensions, and time range used to produce it. If someone questions a number, they can quickly check how it was calculated. When the underlying data is incomplete, stale, or ambiguous, or when a question falls outside the defined semantic, policy, or data boundary, the system should say so instead of producing a plausible number. Tracing is strongest when it lives where the agent runs: an observability layer inside the platform that runs the agent already knows the workspace, the user's role, and the semantic model behind each call.
Changes that are versioned, tested, and reversible
Business definitions, policies, and data sources change constantly, and agents multiply the impact of every change. A small edit to a metric definition or an access rule can alter thousands of automated answers and actions overnight. An AI-ready semantic layer treats model changes like software releases. Changes are versioned and tested against known answers before deployment, with rollback available if needed. Storing the model as code makes this practical; step 4 in the readiness guide below covers testing.
AI-ready semantic layer checklist
| Property | Why agents need it | How to verify it |
|---|---|---|
| Business meaning defined once | Prevents metric drift across prompts | Each core metric has one definition, stored as code |
| Readable metadata | Agents choose objects by name and description | No undefined abbreviations; every metric has a description and owner |
| Per-request permissions for reads and actions | Stops data leaks and unreviewed changes | Every request runs under the requesting user's permissions; creating content needs explicit rights, and agent changes can be reviewed before they are saved |
| Open interfaces | Agents discover metrics instead of guessing SQL | Agents can list and request metrics through MCP or an API |
| Predictable performance | Agent traffic is bursty and high volume | Latency and cost stay stable as the number of agents grows |
| Traceable answers | Users must verify numbers before acting | Each answer returns the metric, filters, and time range used, and flags uncertain data |
| Safe change management | One edited definition can change thousands of agent answers | Model changes are versioned, tested before release, and can be rolled back |
What a semantic layer doesn't cover on its own
A semantic layer defines what the data means, but it does not decide which documents count as approved sources, which business priorities should shape an answer, or how an agent's full reasoning is reviewed afterward. Those needs sit in a broader context layer, covered in the section on semantic layer vs. context layer below.
How it works: from a question to a governed answer
A semantic-layer-grounded agent never writes SQL against raw tables; it selects governed objects and lets the semantic layer generate the query. Take a regional sales manager who asks an agent: "What was net revenue by region last quarter?" Here is what happens step by step.
- Discover. The agent asks the semantic layer, typically over MCP, which metrics and dimensions are available to this user. It receives a catalog with names and descriptions, such as net_revenue and region, not table definitions.
- Select. The agent builds a structured request: metric net_revenue, grouped by region, filtered to the previous fiscal quarter.
- Compile under the user's permissions. The semantic layer turns the request into SQL, applies the approved join path, and adds the user's access rules. A manager who sees only the EMEA region gets EMEA rows, even if the question asked for all regions.
- Execute. The query runs against the data source, or returns from cache if the same result was computed recently.
- Return with evidence. The agent receives the numbers together with the metric definition, filters, and time range it used.
- Explain. The agent summarizes the result in plain language and cites the definition, so the manager can check exactly which "revenue" the answer uses.

Real agent tasks rarely stop at one question. An agent asked why revenue is declining might compare regions, then product lines, then individual accounts, with each result deciding the next query. The same steps repeat for every request in that chain, so "revenue" keeps one meaning and the same access rules apply from the first query to the last.
The definition the agent relies on is written once by the data team. In GoodData.AI's analytics-as-code format, a metric is a YAML file with a MAQL expression:
type: metric
id: net_revenue
title: Net revenue
description: >
Completed order revenue after refunds and discounts, excluding tax.
Also called "net sales". Owned by Finance.
maql: >
SELECT SUM({fact/order_amount}) - SUM({fact/refund_amount}) - SUM({fact/discount_amount})
WHERE {label/order_status} = "completed"
format: "#,##0.00"
The metric carries no fixed date: the agent picks the time dimension and range per question, so the same definition answers "last quarter" and "year to date." The title and description matter as much as the formula: they are what the agent reads when it decides which metric answers "net sales last quarter." For the implementation details of one such interface, see the GoodData.AI MCP Server documentation.
Where semantics can live: three approaches
Semantic definitions for agents can live in three places, and the right choice depends on how far your agents reach. The key question is simple: will your agents stay inside one data platform, or serve several tools, teams, and customers?
- Inside the data platform. Warehouse-native semantics keep definitions next to the data. This is convenient when all data and all AI live in one platform. Agents, apps, and tenants outside that platform need their own integration and their own rules.
- In a standalone semantic layer. A separate modeling layer above the warehouse stays neutral across BI tools and apps. You assemble the rest yourself: agent orchestration, permissions for actions, and observability.
- In an analytics platform with an integrated semantic layer. The same definitions run dashboards, embedded apps, assistants, and agents. GoodData.AI takes this approach, serving one governed layer through MCP, A2A, SQL, and SDKs, with governance, multitenancy, and observability in one place. The trade-off is adopting a broader platform.
No approach is universally best. Whichever you choose, keep definitions portable. Apache Ossie (Incubating), formerly the Open Semantic Interchange (OSI), is building a vendor-neutral specification for exchanging semantic models between BI, AI, and data platforms, so metric definitions do not have to be rewritten for each tool. Portability also means keeping data in place: definitions should travel between engines without copying the data underneath them.
Some teams extend the semantic layer with an ontology or knowledge graph to capture richer relationships between concepts. That pattern, explained in from RAG to GraphRAG, complements a semantic layer rather than replacing it.
How to get your semantic layer ready for agents
Getting a semantic layer ready for agents is an incremental project, not a rebuild. Most organizations have built up years of business logic in their BI tools. The task is to migrate that logic, clean it up, and serve it through one governed layer. Five steps cover the path from a first use case to production.
- Migrate the logic you already have. Your metric definitions already exist inside Power BI, Tableau, Qlik, or Looker files, often in several conflicting versions. Those definitions were built for dashboards, so connecting agents to them as they are does not make them agent-ready. Treat them as input: identify duplicates, resolve conflicts, and migrate the logic into a semantic layer designed for agents instead of modeling from a blank page. AI-assisted migration now makes it practical to migrate logic out of legacy BI tools without rebuilding every definition by hand. Aklamio, for example, moved its analytics from Tableau and Superset to GoodData and then extended the same governed setup to partner-facing analytics.
- Pick one use case that costs you time. Choose a single process with a clear owner and measurable pain, such as weekly revenue reporting or churn investigation. A narrow first use case shows which definitions agents actually need.
- Model metrics, entities, and permissions once. Define the metrics, dimensions, relationships, and access rules the use case needs, with descriptions agents can read. Store them as code so every change is reviewed and versioned.
- Test against known answers before production. Build a set of business questions with answers the data team has verified, including ambiguous wording and denied-access cases. Run the agent against them before release and after every model change; the three building blocks here are traces, evaluations, and metrics.
- Expand what runs. Each new agent or use case reuses the same governed definitions, interfaces, and rules. The second use case is faster than the first because the foundation already exists.
Semantic layer vs. context layer
A semantic layer tells an agent what the data means; a context layer tells it everything else it needs to act responsibly. The semantic layer covers meaning and the access rules applied to queries. A context layer adds approved sources, including unstructured knowledge such as policies and documents, business priorities that shape an answer, memory across interactions, and observability of how each output was produced.
The two are not competitors. The semantic layer is the foundation, and the context layer builds on it. In GoodData.AI, for example, Agent Instructions let administrators define business rules an agent follows, such as always showing both Total Sales and Total Net Sales when someone asks about sales. Shared definitions remain the right place to start, but as the article on why shared definitions solve only part of the problem explains, production AI also needs governance, grounding, guidance, and review around those definitions.
How GoodData.AI approaches the semantic layer for AI agents
GoodData.AI's position is that dashboards, data applications, assistants, and autonomous agents should run on one governed semantic foundation, not on separate layers per consumer. In GoodData.AI, that foundation is the Agentic Serving Plane, the platform's architecture for serving data, semantics, context, and policy to every consumer. It combines several capabilities:
- Semantic model and Analytics Catalog: metrics, attributes, and relationships defined once, with a catalog and a Semantic Quality Agent that flags unclear or duplicate titles and descriptions.
- Context Management: approved knowledge, AI Memory, agent instructions, and access rules carried across every AI experience.
- One permission model for BI and AI: object-, column-, and row-level permissions applied to every request, whether it comes from a person, the AI Assistant, or an external agent.
- MCP Server and open interfaces: governed access for external agents and developer tools over MCP, A2A, SQL, and SDKs, with MCP Apps that render visualizations inside MCP clients.
- Multitenancy: strict isolation for agents embedded in customer-facing products.
- Migration agents: AI-assisted migration of dashboards, metrics, and business logic from Power BI, Tableau, and other legacy BI tools into the GoodData.AI platform.
- AI Observability: usage analytics that show adoption, failures, and timeouts across AI experiences, and explainable answers: open any answer and see each step, what it used, and where it failed.
To see how these pieces fit together on your own data, request a GoodData.AI demo.
Frequently asked questions
A semantic layer in AI is a governed model of business meaning that AI systems query instead of raw tables. It defines metrics, entities, relationships, and permissions once, so LLMs and agents use approved definitions rather than inferring them. This makes AI answers consistent, secure, and traceable.
You need a semantic layer for generative AI as soon as its answers are used by someone other than the person who wrote the query. Without one, the model re-derives business logic on every prompt, so the same question can return different numbers. A semantic layer fixes the definitions and applies access rules before any SQL runs.
Text-to-SQL is not enough for AI agents because it provides access to data without an agreed meaning. The model still has to guess metric definitions, join paths, and permissions. A semantic layer lets the agent request governed metrics by name, so the hard logic is solved once by the data team.
An AI-powered semantic layer serves business definitions to AI agents in a form they can discover and use. It exposes metrics and descriptions through interfaces such as MCP, compiles agent requests into SQL under the user's permissions, and returns results with the definitions used. Some platforms also use AI to check metadata quality and to migrate logic from legacy BI tools.
AI agents typically access a semantic layer through the Model Context Protocol (MCP), an open standard for connecting AI models to tools and data. The agent lists available metrics and dimensions, then requests them by name. APIs, SQL endpoints, SDKs, and agent-to-agent (A2A) protocols serve other clients.
An existing BI semantic layer is a useful source of business logic, but agents rarely work reliably on top of it as it is. Legacy layers were designed for dashboards, so they typically lack descriptions and synonyms, contain duplicate metric definitions, cover reads but not actions, and offer no machine-friendly interface. The practical path is to migrate that logic, including definitions still buried in individual dashboards, into a semantic layer designed for agents.
A semantic model for AI is the structured set of definitions inside a semantic layer: datasets, attributes, metrics, and the relationships between them. The semantic layer is the service that stores, governs, and serves that model to consumers. Learn more in this guide to the semantic data model.
A semantic layer defines what business data means, while a context layer adds everything else an AI system needs to act responsibly: approved sources, unstructured knowledge, business priorities, memory, and observability. The semantic layer is the foundation of a context layer, not a replacement for it.


