A semantic layer is where a company defines its metrics in code, once, so every dashboard, spreadsheet and AI agent that asks for MRR gets the same number.

Without one, ask what MRR was in September and you can get three answers. Finance says €41,250: trials excluded, annual plans divided by twelve. The BI dashboard says €44,900, because it counts each annual invoice in full in the month it was paid. An AI agent connected to the warehouse says €43,600 on Monday and €41,900 on Tuesday, because it writes a new query each time and picks different filters.

Each tool carries its own copy of the definition. A semantic layer keeps the only copy, and the dashboard, the spreadsheet and the agent ask it for mrr by name.

Summary: A semantic layer holds each metric's definition, its dimensions, its joins and who may see what, in code, and every tool asks it for metrics by name. You need one once a metric is calculated in more than one tool, or once people ask AI agents business questions.

What is a semantic layer?

A semantic layer sits between your data warehouse and the tools that read from it, and turns a request for a metric into SQL. A dashboard or an agent asks for mrr by month. The semantic layer knows that means summing mrr_eur from gold.mrr_by_customer_month, which tables to join, which rows to leave out and which rows this user may see, and it writes and runs the query.

Where a semantic layer sits, from top to bottom. A BI tool, a spreadsheet, an AI agent such as Claude and apps through an API ask the semantic layer for a metric by name. The semantic layer holds the metrics, such as mrr and churn, the dimensions, such as month and plan, the joins, such as on customer_id, and access rules by user. It is built on Gold models in your warehouse, written in dbt or SQL: subscriptions, customers and mrr_by_customer_month. Underneath, Weld syncs sources such as Stripe, HubSpot, Salesforce, Shopify, Postgres, Google Ads, Intercom and NetSuite into the warehouse.

The idea goes back to the early 1990s, when Business Objects called its version a "universe", and Looker's LookML made it popular again in the 2010s. Those layers live inside a BI tool, and for most of their history only that tool's dashboards could use them. Power BI and Looker still work this way, though both now run MCP servers, so agents can reach their models too. The newer layers are built for every tool from the start: in your transformation code (the dbt Semantic Layer), as a standalone service (Cube) or inside the warehouse (Snowflake semantic views, Databricks metric views).

A short history of the semantic layer. 1991: Business Objects patents its universe. 2012: Looker brings LookML, modelling as code. 2019: Cube.js open-sources a universal semantic layer. 2023: the dbt Semantic Layer goes GA, built on MetricFlow. 2024: Anthropic introduces the Model Context Protocol for agents. 2025: Snowflake semantic views go GA. 2026: Databricks metric views go GA, and Looker's MCP server arrives in Preview. The first two sit inside BI tools, the next two are universal layers, and the latest live in the warehouse and serve agents.

What a semantic layer holds

It holds four kinds of definition.

WhatExampleWithout it
Metricsmrr = sum(mrr_eur), trials excludedEvery query re-derives the formula, and small differences add up
Dimensionsmonth, plan, countryOne team slices by billing country, another by signup country
Joinssubscriptions to customers on customer_idA join on the wrong key duplicates rows and inflates the total
Access rulesA sales lead sees their own regionThe agent shows numbers the user can't see in the dashboard

Most semantic layers also add caching, so a popular metric isn't recalculated from scratch on each request, and descriptions of the metrics and dimensions. Those descriptions matter more than they used to, because they are what an AI agent reads to decide which metric answers the question.

A semantic layer doesn't hold the data itself, and it doesn't replace your transformation layer. It reads from your modelled tables, so the clean-up work (deduplicating customers, converting currencies, removing test accounts) still belongs in the models underneath.

Why AI agents need one more than people do

Agents need a semantic layer more than people do because they start from zero on every question, and nobody checks their numbers before they're sent. An analyst who has been at a company for a year knows that finance's MRR excludes trials, and checks a number that looks too high. An agent sends whatever its query returns.

An agent working on raw tables tends to fail in three ways:

  • Different answers to the same question. With no fixed definition, the agent writes new SQL for each question, and small choices (which statuses count as active, which date to group by) change the result.
  • Numbers that don't match the dashboard. The dashboard and the agent each use their own logic, and users notice when the numbers differ.
  • Numbers the user shouldn't see. If the agent queries with a shared service account, it can see more than the person asking.

A semantic layer removes all three problems, because the agent stops writing revenue SQL and asks for mrr by name. The dashboard uses that definition too, and the access rules apply to the person asking. dbt Labs measured the difference in a 2026 benchmark: 11 business questions, each asked 20 times, with the model either writing SQL against the tables or asking the semantic layer.

dbt Labs' 2026 benchmark with Claude Sonnet 4.6: 11 business questions, 20 runs each. On the tables as they were, writing SQL against the tables answered 64.5% correctly and asking the semantic layer 72.7%; the semantic layer's misses were refusals on questions it didn't cover, never a wrong number. After adding three dbt models, writing SQL scored 90.0% and the semantic layer 98.2%.

The semantic layer's misses on the original tables were the three questions it didn't cover yet, and on those it said it couldn't answer instead of guessing. Writing SQL against the tables gave a plausible wrong number some of the time. On the eight questions it did cover, the semantic layer was right every time, and three extra dbt models were enough to cover the rest.

Gartner points the same way. In its press release "Gartner Says Lack of Semantics Causes Inaccurate AI Agents and Wasted Spending", issued 11 May 2026, it wrote: "Gartner predicts that by 2027, organizations that prioritize semantics in AI-ready data will increase their agentic AI accuracy by up to 80% and reduce costs by up to 60%."

Worked example: MRR, defined once

Back to the September MRR question, asked of three tools before and after they share one definition.

What was MRR in September? Asked of three tools, two ways. When each writes its own SQL, the dashboard says 44,900 euros because it counts annual plans in full, Claude says 43,600 because it counts trials, and Ed in Weld says 41,900 because it uses its own status filter. With one definition, all three say 41,250 euros: the dashboard and Claude from the semantic layer, and Ed from the Gold model the mrr metric is built on. The numbers are illustrative.

Step 1: the model does the hard part

Start with a model in the warehouse with one row per active customer per month and the hard decisions already made: trials removed, annual and quarterly plans converted to a monthly amount, discounts applied, currencies converted. If you haven't settled what those decisions should be, how to calculate MRR covers the usual pitfalls, and defining core business metrics covers getting finance and the rest of the company to agree on them.

SQL
1-- models/gold/mrr_by_customer_month.sql
2-- one row per active customer per month
3select
4    customer_id,
5    month,
6    plan,
7    country,
8    mrr_eur  -- monthly value after discounts, in EUR
9from {{ ref('stripe_subscription_months') }}
10where is_active
11    and not is_trial

Here it's a dbt model, because most teams with a semantic layer already model in dbt, and the dbt Semantic Layer in step 2 sits directly on it. Weld syncs Stripe into the warehouse on a schedule, so the model always has current subscriptions to read. If you don't run dbt, the same SQL works as a SQL model in Weld, which runs it after each Stripe sync. Weld's open-source Stripe models build MRR along the same lines, so you don't have to start from scratch.

Step 2: the semantic layer defines the metric

On top of the model, the semantic layer says what mrr is and how it can be sliced. Here it is in the dbt Semantic Layer's latest YAML spec (dbt 1.12 and later, and the dbt platform's Latest release track), where the semantic model sits on the model itself:

YAML
1models:
2  - name: mrr_by_customer_month
3    semantic_model:
4      enabled: true
5    agg_time_dimension: month
6    primary_entity: customer_month
7    columns:
8      - name: customer_id
9        entity:
10          type: foreign
11          name: customer
12      - name: month
13        granularity: month
14        dimension:
15          type: time
16      - name: plan
17        dimension:
18          type: categorical
19    metrics:
20      - name: mrr
21        description: >
22          MRR in EUR. Trials excluded,
23          annual plans divided by 12.
24        type: simple
25        agg: sum
26        expr: mrr_eur

There's very little logic in it: the metric is a sum, and the hard decisions were made in the model, where they can be tested. It's worth keeping it that way, because a semantic layer full of complicated SQL turns into a second transformation layer that's harder to debug.

When a tool asks for mrr by month, the semantic layer writes the query itself, along these lines (simplified):

SQL
1select
2    date_trunc('month', month) as metric_time__month,
3    sum(mrr_eur) as mrr
4from gold.mrr_by_customer_month
5group by 1

Any tool that asks for mrr by month gets this query, which is why the numbers match.

Step 3: the dashboard, Claude and Ed ask for it

The dashboard asks the semantic layer for mrr by month, through the semantic layer's API or the BI tool's integration with it. Nobody has to write MRR SQL in the BI tool.

Claude connects to the semantic layer's MCP server. dbt, Cube and Snowflake all offer one. With dbt's, asked "what was MRR in September?", Claude calls list_metrics, finds mrr and its description, and calls query_metrics for September. It doesn't touch the subscription tables at all, so it can't invent a different filter.

Connect Claude to the Weld MCP server as well, and it can also check the data behind the number before it trusts it (step 4).

Ed, the agent in Weld, doesn't call a semantic layer: it searches your models and runs read-only queries (once an admin lets it read data values). Pointed at mrr_by_customer_month, the model the metric is built on, it also gets €41,250 for September, because the trial, discount and currency logic lives in the model.

All three return €41,250. And when finance decides next year that paused subscriptions don't count, the change goes into one definition, and every tool picks it up.

Step 4: check that the number is fresh

A semantic layer makes every tool calculate MRR the same way, but it can't tell whether the data underneath is current. If the Stripe sync failed on Tuesday, every tool returns the same out-of-date €41,250, and they all agree with each other.

So before an agent reports a number, it should check the data behind it. With the Weld MCP server connected next to dbt's, Claude can do that in three calls:

CallWhat it checks
list_failed_syncs (Weld)Whether any sync is failing, with the error and the time of the last successful run
get_elt_sync_status (Weld)The current state of the Stripe sync, stream by stream
get_node_details (dbt)The mrr_by_customer_month model, so the agent knows what the metric is built on. For a SQL model in Weld, get_transform returns its SQL.

Then it calls query_metrics. If the Stripe sync last succeeded two days ago, the agent can say so next to the number instead of presenting it as today's. This is the part of the stack Weld runs: the syncs that keep the warehouse current, the SQL models if you build them in Weld, and the MCP tools an agent uses to check them.

The MRR figures in this post are made up for illustration.

Where your semantic layer can live: dbt, Cube, the warehouse or a BI tool

Semantic layers come in four types, and they differ most in where the definitions live: in your transformation code (dbt), in a standalone service (Cube), inside the warehouse (Snowflake, Databricks) or inside a BI tool (Power BI, Looker).

Where the definitions live in each option. dbt Semantic Layer: metrics are YAML in your dbt project, next to the models, on top of the warehouse. Cube: its own service between the warehouse and the tools, holding cubes and access rules. Snowflake semantic views and Databricks metric views: inside the warehouse itself. In all three, dashboards, sheets and agents ask by metric name.
OptionDefinitions live inRuns onHow agents reach itRow-level access
dbt Semantic LayerYAML in your dbt projectMost major cloud warehousesdbt MCP server (list_metrics, query_metrics)Through the warehouse credential it queries with
CubeYAML or JavaScript in a Cube projectMost warehouses and databasesCube MCP server, on all plansAccess policies with row filters per user
Snowflake semantic viewsSQL objects in the warehouseSnowflake onlyCortex Analyst and Snowflake-managed MCP serversRow access and masking policies on the tables
Databricks metric viewsYAML inside a SQL view in Unity CatalogDatabricks onlyGenie, plus Power BI, Tableau and SigmaUnity Catalog permissions on the view
Power BI semantic modelsThe model in Power BI Desktop or FabricPower BI and FabricFabric IQ MCP serverRoles with DAX filters, object-level security for columns
Looker (LookML)LookML files in a Git projectThe databases Looker connects toLooker's managed MCP serveraccess_filter on a user attribute

Checked on each vendor's documentation on 29 October and 12 November 2026.

The best semantic layer tools compared goes through each option in depth, with pricing as of November 2026, which metrics each can express, caching, and how they handle agents and row-level access. In short: the dbt Semantic Layer keeps metrics next to your dbt models, Cube adds caching and per-user access rules as its own service, Snowflake and Databricks keep the definitions inside the warehouse, and Power BI and Looker keep them inside the BI tool.

How to choose

  • You already run dbt, and most questions come from dashboards and agents: start with the dbt Semantic Layer. Your definitions sit next to your models.
  • You need caching, fine-grained row-level access, or many different consumers: Cube, which has more of this built in than the others.
  • Everything lives in Snowflake or Databricks and you want the fewest moving parts: the warehouse's own semantic or metric views, as long as you're happy for the definitions to only work there.
  • Your BI tool already has a good model (LookML, Power BI semantic models): keep it for dashboards, and only add a separate layer when agents or other tools need the same definitions.

Choosing one is also less of a lock-in than it used to be: the Open Semantic Interchange, started in September 2025 by Snowflake, dbt Labs, Salesforce, Cube and others, is now an incubating Apache project, Apache Ossie, with a shared format for semantic definitions that dbt 1.12 already reads.

Security and governance: who can see which numbers

A semantic layer can only apply access rules if it knows who is asking. When a dashboard or an AI agent queries through one shared service account that carries no user identity, every user gets that account's access, and a sales rep can ask an agent for numbers they can't open in the dashboard. Connect agents with each person's own login, usually OAuth through the MCP server, so the rules follow the user. The semantic layer can still query the warehouse with its own credential, as Cube does, as long as it applies the user's rules.

Agent security done well, as one request. 1: a sales lead in EMEA asks Claude what MRR was in September. 2: Claude reaches the semantic layer's MCP server with the person's own login, through OAuth or SSO, so it knows the user is a sales lead in the sales group for EMEA. 3: the semantic layer uses the governed mrr metric, owned by finance, and applies that user's rules: a row filter on region EMEA and a mask on customer email. 4: the warehouse, such as Snowflake, Databricks or BigQuery, enforces the same role, row access policy and masking policy. 5: the query is logged with who asked, what they asked, what they saw and when. The answer comes back as EMEA rows only. To avoid: one shared service account, which gives everyone its access, lets the agent see every region and leaves a log that names no person. The figures are illustrative.

Row-level security decides which rows a user sees, and column-level security hides or masks fields such as customer emails. Each option keeps these rules in a different place.

OptionWhose identity the rules useRowsColumns
dbt Semantic LayerA service credential, or the user's own credentials through a personal access tokenThe warehouse's policies for that credentialThe warehouse's policies for that credential
CubeThe signed-in user's security context, while Cube queries the warehouse with its own credential; its MCP server supports OAuthrow_level filters in an access policymember_level to hide fields, member_masking to mask them
Snowflake semantic viewsThe user's role; the managed MCP server uses their default roleRow access policies on the tables, enforced through the viewMasking policies on the columns
Databricks metric viewsThe user, with SELECT granted on the metric viewNone on the view itself: row filters can't be set on a view, so the grant decides who sees it allNone on the view itself: column masks can't be set on a view either
Power BI semantic modelsThe user's Microsoft login; the Fabric IQ MCP server doesn't accept service principalsRoles with DAX filtersObject-level security on tables and columns
Looker (LookML)The user, through OAuth on the managed MCP serveraccess_filter on a user attributerequired_access_grants on fields

One detail catches teams out: Power BI's row-level and object-level security apply only to Viewers, not to workspace Admins, Members or Contributors, so test as a Viewer.

Governance also means a metric can't change quietly. In dbt, Cube and LookML the definitions are files in Git, so a change to mrr goes through a pull request its owner reviews, and the description is the approved definition an agent reads. Then log who asked what: Snowflake's ACCESS_HISTORY, Databricks' system.access.audit, Looker's System Activity and Cube's Query History all record the user behind each query.

Checked on each vendor's documentation on 13 November 2026.

How to set up a semantic layer

  1. Pick one domain. Finance is usually the best start, because people already check its numbers.
  2. List the ten metrics people ask about most, and agree each definition with the person who owns it.
  3. Put the hard logic in Gold models (trials, currencies, discounts) and test it there.
  4. Define the metrics in the semantic layer, with a description for each one, because that's what an agent reads.
  5. Connect dashboards and agents with each person's own login, so access rules follow the user.
  6. Test with real questions and compare the answers with what finance reports.

When you don't need a semantic layer yet

Plenty of teams are better off waiting. A semantic layer is a commitment: every metric needs an owner, and every change needs a review. The first metric usually takes the longest, because it forces the definition argument everyone has been putting off.

Wait if…You need one when…
You have one BI tool and no agents. That tool is your semantic layer already.The same metric is calculated in more than two places.
Finance and sales still disagree on what counts as revenue. Settle that first.People have started asking AI agents business questions.
The models underneath are shaky: late syncs, duplicate customers.Someone has asked "why doesn't this match the dashboard?"
You have a handful of metrics and one analyst. A documented Gold model is enough.Teams need the same numbers with different access.

Where the semantic layer sits in the agent context stack

The semantic layer is one layer of the agent context stack, the layers an AI agent needs before it can answer "what is our revenue?" reliably:

The agent context stack, as Weld draws it. On top, agents and assistants such as Claude and ChatGPT ask questions in plain language, guided by instructions per team such as Claude Skills. Below the line is your data. Governed access gives one way in with each person's own permissions, for example Snowflake roles or Unity Catalog. Metric definitions, the semantic layer this post is about, make revenue mean one thing, in tools such as Cube or the dbt Semantic Layer. Business context holds the caveats analysts carry in their heads, from Slack threads and docs. Underneath is the foundation Weld runs: modelled data, raw data turned into tested business-ready tables, and reliable data, every source synced on schedule, such as Shopify, Stripe and HubSpot. Governance wraps the stack: agents act as the user.

The semantic layer tells the agent how to calculate MRR, but it can't explain why September looks strange because a large customer moved to annual billing. That belongs in the business context layer. And if the Stripe sync failed on Tuesday, the problem sits in the foundation underneath, where no metric definition can fix it.

Weld runs the foundation: it syncs Stripe, HubSpot, your product database and 300+ other sources into your warehouse, runs the SQL or dbt models your semantic layer is built on, and gives agents an MCP server to check that the data behind a number is fresh. The semantic layer sits on top, in whichever tool you choose, and our forward deployed engineers can set it up with you, starting with one domain, usually finance.

OMHU, a Weld customer, runs this setup: Weld syncs Shopify, payment providers and marketing tools into BigQuery, dbt models the data, and Cube defines the metrics once for daily reporting, finance reconciliation and the team's AI agents in Slack. Their customer story walks through it.

If you're deciding where to begin, start with finance's ten most requested metrics on top of your Gold models, and add the other layers as agents need them. The agent context stack covers those layers.

FAQ