Guide

7 MIN READ

What is the best semantic layer for AI agents?

The best semantic layer for AI agents serves your business rules to the agent and applies access rules to every query it sends. Compare the options on what the model can express, how an agent finds a field, where access rules live, and what is open.

James Swirhun

James Swirhun

Published Nov 28, 2026

James Swirhun is Head of Product at Credible, an AI analytics engine that gives AI agents, data apps, dashboards and reports one data model to answer from, so everyone gets the same numbers.

Do AI agents need a semantic layer?

Yes. Writing SQL is the easy part of an analyst's job. The hard parts are:

  • Knowing what each term means. Is revenue gross or net? Is a customer an account or a person? Which joins repeat rows? A data model writes these rules down, and the semantic layer serves them to every agent and tool.
  • Knowing which questions the data can answer. Which fields each measure can be grouped and filtered by, and which values each field holds. The model writes this down too, and every query is checked against it.
  • Checking the answer. Which dates the data covers, whether the parts add up to the total, what was assumed. The model can't do this part. Instructions to the agent can: the open-source malloy-analysis skill, a file of instructions the agent reads, makes it run these checks on every question.

Without the rules, the agent picks its own answer, and any choice returns a number. One marketplace has 99,441 customers counted by one ID column and 96,096 by the other (How an agent builds a data model). Without the checks, an agent can report revenue down 56% when the data ends mid-month. Per day, it was down 1.6% (the full example). Saved queries don't fill the gap: they answer the questions they were written for, and a new question can't build on them.

How do you choose a semantic layer for AI agents?

Every option ships an MCP server, so having one doesn't separate them. Start with how much control you want. Then follow one question through each option, from the agent's first call to the answer.

How much control you want

  • Their agent or yours. Some products center on their own analytics agent: you ask a question in their app, it consults the model, and it answers. That is quick to start, and it does analytics only. Others center on tools and APIs, so the agent you already run, such as Claude Code or one your team built, queries the model alongside its other work. That suits teams that build: you choose the agent, change its instructions, and use the same model in your own apps.
  • What is open. The server the agent calls, or only the definition files. With dbt, for example, the definitions are open and the serving APIs are part of the paid platform. An open server is one you can run yourself and build on.

What happens to one question

  1. The agent finds the fields it needs. Some options have the agent walk an API, one call per step. Others start with a search. A walk costs a call at every step, and a list grows with the model. On a small model, a search can add weight and delay for little gain (a production comparison of two semantic layers). Try the search on your own model.
  2. The model tells it what each field means. Can the model say what a measure includes, which joins repeat rows, what each field means, and which values a field holds? Whatever it doesn't say, the agent guesses. In Malloy, for example, a #(doc) note describes each field, join_one and join_many stop a join from repeating a total, and #(index) makes stored values searchable.
  3. The agent writes the query, and something checks it. Most options keep the model in YAML files beside SQL: Cube, dbt's MetricFlow, Lightdash and Snowflake semantic views do. The agent asks for a defined metric by name, with groupings and filters, and the layer writes the SQL. A question the YAML doesn't cover, such as the share of revenue from new customers, needs someone to add a metric first, or the agent writes SQL outside the model. Malloy is a compiled language instead. The agent writes a short Malloy query over the model and can build a new calculation from its measures. The compiler checks every field and type against the model before anything runs, then writes the SQL, with joins and totals at the right level. A query that names a field that doesn't exist fails with an error naming it (Malloy vs. SQL).
  4. The query runs with the asker's access. Access rules can live in the warehouse, in each BI tool, or in the model. Rules in the model apply to every agent, app and API call that goes through it. The agent signs in with one shared token or as the person asking. Per-user sign-in logs each query under the person who asked, and lets you revoke one person's access without affecting anyone else.
  5. You check the answer. Run your team's real questions, each with a verified answer, and re-run them on every change (how to measure accuracy). Look for a record of each query the agent sent.

What are the options?

Each name links to a full comparison with sources. The order isn't a ranking.

  • Cube is a semantic layer with a deep pre-aggregation system, served through its data APIs and MCP. Its agent's first call is a similarity search over views, measures and dimensions. Cube Core is open source.
  • dbt defines metrics in MetricFlow, in your dbt project. Its MCP server lists metrics or models, then drills into one. The hosted MCP server accepts per-user OAuth, in public beta, as well as shared tokens (dbt docs).
  • Snowflake semantic views are native to Snowflake. Cortex Agents answer over them, with Snowflake's access control.
  • Looker keeps its model in LookML, which only Looker compiles. Its MCP server walks models, then Explores, then the fields in each.
  • Lightdash is open-source BI on top of dbt, with metrics as YAML in the dbt project. Its agents pick from models and metrics, and a router hands each question to an agent scoped to one team's subject area.
  • Omni is a BI platform over its own semantic layer. Its agent composes queries against that model, inside Omni.
  • Credible is an engine that serves Malloy models. Its agent tools search the model for the sources, fields and values a question needs. It signs each person in over OAuth and applies the model's access rules with the identity it verified.

Which semantic layers are open source?

Malloy Publisher, Cube Core, dbt's MetricFlow and Lightdash's core are open source. For agents, check which part is open: the server the agent calls, or only the definition files.

  • Malloy Publisher is MIT-licensed. It serves Malloy models over REST and MCP, with the agent skills in the same repository. Malloy itself is a Linux Foundation project.
  • Cube Core is open source and self-hostable. Cube Cloud is commercial.
  • dbt Core and MetricFlow are Apache 2.0. The platform, including the serving APIs, is commercial.
  • Lightdash's core BI features are MIT-licensed and self-hostable. Advanced security and Lightdash Cloud are commercial.

Looker and Omni keep their models in their own formats. Snowflake semantic views are native to Snowflake, though Snowflake publishes the YAML spec and started Open Semantic Interchange, now incubating at Apache as Ossie.

How should a team start with a semantic layer for AI agents?

Pick two or three options on the criteria above, then run your team's real questions against each. A team can start on open source. Malloy Publisher is MIT-licensed and serves a model to agents over MCP. To try it on a file of your own:

mkdir my-data && cd my-data
npm create @malloy-publisher/malloy-package@latest sales -- --data ~/orders.csv
npm start

The first command writes the package, the agent's MCP config and the skills. --data takes a CSV, Parquet, JSON or Excel file. Start your agent, such as Claude Code, in that directory and ask: "How are sales trending? Build out the model as you go." The tutorial covers the details, and a demo model you can run with nothing of your own.

Credible runs the same models as a managed service. It is an engine: it takes your data model and generates the semantic layer that serves your definitions to agents and apps. It signs each person in over OAuth and applies the model's access rules with the identity it verified, so a caller can't claim someone else's access. It keeps every published version. See how Credible controls access, pricing, or the docs.

Frequently asked questions

Do AI agents need a semantic layer?

Yes, when their answers have to agree with each other and with your reports. An agent needs your business rules written down where it reads them on every question: which revenue counts, which rows to exclude, which joins are safe. A data model holds those rules, and a semantic layer serves them to the agent with access rules applied.

What is the difference between a data model and a semantic layer?

A data model is where the definitions are written: what revenue means, how tables join, who may see which rows. A semantic layer is the software that serves those definitions to dashboards, apps and agents, so every tool computes a metric the same way. The model is the input, and the layer applies it to every query.

Is the dbt semantic layer enough for AI agents?

It can be, when the questions fit the metrics you define. MetricFlow is Apache 2.0 and builds the joins itself, so an agent can't write one that repeats rows. Check two limits. The serving APIs are part of the paid dbt platform. And a question that reshapes a metric, such as the share of revenue from new customers, needs a new named metric.

How should an AI agent authenticate to a semantic layer?

As the person asking, when a person is asking. Then each query runs with that person's access, the log names who asked, and one person's access can be revoked without affecting anyone else. A shared token gives every user the same identity. Keep shared tokens for automation that runs without a person.

The AI Analytics Engine

Make your data Credible

Model your data's meaning, and the AI Analytics Engine delivers answers you can trust to every agent, data app, and dashboard that asks.

Get started

Guide

12 MIN READ

How do you measure text-to-SQL accuracy on your own data?

Text-to-SQL accuracy is how often an AI agent or conversational analytics tool returns the checked answer, using your business's definitions. You measure it with a golden question set: your users' questions, each with a verified answer, run through your agent as your users run it.

Reviewed Nov 27, 2026

Guide

5 MIN READ

How do I know if an AI answer about our data is right?

You know an AI answer about your data is right when you can check it. The answer names the definition, dates and query it used, matches a number you already trust, and comes from a system tested on questions with verified answers.

Reviewed Nov 28, 2026

Guide

8 MIN READ

What are the Looker alternatives with AI chat?

Looker alternatives with AI chat include Omni, Sigma, Hex, Lightdash, ThoughtSpot, Power BI, Tableau and Credible. A team can also keep Looker and ask questions from an agent such as Claude through Looker's MCP server, or move its LookML into an open data model.

Reviewed Nov 27, 2026