Skip to content
METRIC OAK

New: the 3-week Data Platform Assessment: fixed fee, priced roadmap. See what's included →

AI

Semantic layers for AI: why agents need one definition of your metrics

What a semantic layer is, why AI assistants and agents give wrong answers without one, what it should contain, and the options on Databricks, Snowflake, dbt and Power BI, with an approach to building it.

Hemant Walchale

Hemant Walchale
· 3 min read

Ask two AI assistants “what was revenue last quarter?” and you can get two different numbers, both confidently stated. The model is rarely the problem. The problem is that “revenue” lives in the heads of a few analysts and in hundreds of slightly different SQL queries. A semantic layer writes that meaning down once, so people and AI use the same definitions.

Tables such as orders, order lines, customers, refunds, exchange rates and calendar feed a semantic layer that defines metrics (net revenue equals orders minus refunds, in USD), dimensions, relationships, business names and synonyms, verified example questions, and access rules inherited from the tables. BI dashboards, AI agents, notebooks, applications and spreadsheets all use it.

Why AI gets metrics wrong without one

An assistant writing SQL from raw tables has to guess:

  • The formula: is revenue gross or net of refunds? In which currency?
  • The joins: which key connects orders to customers, and what happens to orders with no customer?
  • The filters: are test accounts, cancelled orders or internal transactions excluded?
  • The words: does “sales” mean revenue, units or bookings?

Each guess can be reasonable and still differ from the finance number. Across many prompts, the assistant becomes a source of conflicting figures, and trust collapses quickly.

What a semantic layer contains

  • Metrics with their exact calculation (net revenue = order amounts − refunds, converted to USD).
  • Dimensions to slice by (region, product, customer segment, fiscal calendar).
  • Relationships between tables, so joins are defined once.
  • Business names, descriptions and synonyms, so natural-language questions map to the right fields.
  • Verified questions and answers, examples that show the AI how a correct query looks.
  • Governance: the layer should inherit access rules from the underlying tables, not bypass them.

Options by platform

Platform Semantic layer
Databricks Unity Catalog metric views, used by AI/BI dashboards and Genie
Snowflake Semantic views, used by Cortex Analyst and Cortex Agents; table-level row access and masking policies propagate to them
dbt dbt Semantic Layer, powered by MetricFlow (open-sourced under Apache 2.0 in October 2025)
Power BI and Microsoft Fabric Semantic models

The Open Semantic Interchange (OSI) initiative, led by Snowflake with partners including Salesforce, Sigma and dbt Labs, is working on a vendor-neutral format so definitions can move between tools without being rewritten.

How to build one without boiling the ocean

  1. Start from questions, not tables. List the 20 questions executives and the AI assistant will be asked most.
  2. Define the 10 to 15 metrics those questions need, agree each with its business owner, and record the owner.
  3. Model on gold tables (see medallion architecture), not raw data.
  4. Add synonyms and verified queries for each metric, using real phrasing from users.
  5. Test the assistant against known answers before release, and re-test whenever a definition changes.
  6. Expand by domain, the same way migrations move in waves.

The short version

A semantic layer gives metrics, relationships and business terms one governed definition, so dashboards and AI assistants return the same numbers. Use your platform’s native option (or dbt for multi-platform estates), start from the questions people ask, and test the assistant against known answers.

Related: AI agents on governed data, how to assess AI readiness, what is data lineage and our AI-ready data service.

Sources

Further reading from other practitioners

Not sure where your own platform stands? Take the free 3-minute data platform scorecard, or see how we work on Databricks. Unfamiliar terms are explained in the data engineering glossary.

Frequently asked questions

What is a semantic layer?

A semantic layer defines business metrics and dimensions (such as net revenue, active customer or region), how tables relate, and what terms mean, in one governed place. BI tools, AI agents, notebooks and applications then use those definitions instead of each computing metrics their own way.

Why do AI assistants need a semantic layer?

Without one, an AI assistant has to guess from table and column names how a metric is calculated, which joins to use and which filters apply. Different prompts produce different SQL and different numbers. A semantic layer gives the assistant the agreed definitions, relationships and verified example queries, so answers match the numbers people already trust.

Which semantic layer should we use?

Usually the one native to your main platform: Unity Catalog metric views on Databricks, semantic views on Snowflake, or semantic models in Power BI and Microsoft Fabric. The dbt Semantic Layer suits teams that already model in dbt or use several platforms. The Open Semantic Interchange initiative aims to make definitions portable between tools.

Have 30 minutes? Get a senior architect’s view of your data platform.

No sales deck. You talk to the engineer who would lead the work.

Book an architecture review