guide
guide9 min read

Which Semantic Layer Should You Pick for AI Agents?

Choose by where your metrics live, how the layer reaches agents over MCP, and what an eval says

Pick the semantic layer that already holds your governed metric definitions and can expose them to agents over the Model Context Protocol, then prove it with an eval on your own questions. The current MCP specification revision, 2025-06-18, defines how a server publishes tools to a client, and any layer an agent can reach through a tool call is a candidate. The real choice is among four approaches: warehouse-native layers, transformation-framework layers, headless layers, and enterprise OLAP-style layers. This guide names no vendors on purpose, because the decision rests on your stack, not a brand.

Key Takeaways

  • •Choose a semantic layer by where your metric definitions already live, not by feature checklists; moving definitions is the expensive part.
  • •An agent needs the layer exposed as a tool, so check for MCP support before anything else; the MCP specification defines the tool contract.
  • •Warehouse-native layers fit single-warehouse teams, headless layers fit multi-warehouse teams, and framework layers fit teams whose metrics already sit beside their transformations.
  • •Run a 20 to 50 question eval against each candidate, scoring both the answer and whether the agent used a governed metric.
  • •You can mix layers by domain; the agent's routing layer matters more than picking a single winner.

What an agent needs from a semantic layer

A dashboard user picks a metric from a menu. An agent has no menu. It receives a question such as "Why did row counts drop 40% overnight?" or "What was net revenue by region last quarter?" and must map those words to a definition, a grain, and a set of allowed joins. A semantic layer supplies that mapping in a form a machine can read, so the agent does not guess at column names or reinvent the revenue formula each time.

That changes what you should value. Human-facing BI features such as chart styling or drag-and-drop modeling do not matter. What matters is a queryable metadata surface, a deterministic query compiler, and clear errors when the agent asks for something the model does not allow. An agent that gets a precise refusal can recover. An agent that gets a plausible but wrong number cannot.

We covered the trade-off between free-form SQL generation and governed metrics in our earlier post on text-to-SQL versus a semantic layer. The short version is that production agents need a route to both: governed metrics for the numbers executives quote, and direct SQL for long-tail exploration. Choosing a layer is mostly choosing which of those two routes you can make safe.

Step 1: Find where your metrics live today

Start with an inventory, not a vendor demo. List every place a metric like active customers or gross margin is defined: BI tool models, transformation project YAML, warehouse views, spreadsheets, and application code. Most teams find three to five definitions of the same metric. The layer you pick will become the single source, so the cheapest candidate is usually the one closest to the definitions you trust most.

If your definitions sit in the transformation project, a framework-based layer lets you keep them in version control next to the models that produce the tables. The open-source metric framework documented in its official docs describes five metric types: simple, ratio, cumulative, derived and conversion. If most of your business questions reduce to those five shapes, a framework layer covers them without a separate service.

If definitions sit in warehouse views and the team runs a single warehouse, a warehouse-native layer avoids a new moving part, and permissions stay in one place. If you run several warehouses or query engines, a headless layer that sits outside any one of them avoids duplicating definitions per engine. Enterprise OLAP-style layers fit organizations with large existing cube-style models and spreadsheet consumers.

Step 2: Check how the layer reaches agents over MCP

An agent running in Claude Code, Cursor or any MCP-compatible client calls tools. So ask each candidate three questions. Does it ship an MCP server, or does a maintained community server exist? Which operations does it expose: list metrics, describe dimensions, run a governed query, or only raw SQL passthrough? And does the server return the metric definition alongside the data, so the agent can cite it?

The official MCP servers repository on GitHub is a useful reference for what a well-formed server looks like, including tool schemas and read-only patterns. Compare a candidate's server against it. A server that exposes only a free-text query tool pushes all the correctness burden back onto the model. A server that exposes discrete tools for metric discovery and governed query keeps the model on rails.

Also check the transport and auth story. A local stdio server is fine for a developer laptop. A shared team deployment needs remote transport with authentication, which the specification addresses in its authorization section. If a layer only offers a local server today, that is not a disqualifier, but plan for how you will host it before production.

Step 3: Test governance and access control

A semantic layer is a governance boundary as much as a modeling tool. Before you commit, test what happens when an agent asks for a column a given role should not see. Does the layer enforce row and column policies itself, or does it rely on the underlying warehouse role? Warehouse-native layers inherit the warehouse's policies, which is a real advantage. Headless layers need their own access model, and you must keep it in sync.

Run a concrete test: create an agent identity with access to one business domain, then ask for a metric from another domain. The correct result is a clear denial that the agent can report to the user. The dangerous results are silent empty answers and silent success. Also test whether every query is logged with the identity of the agent, the metric requested, and the SQL actually executed.

Our approach is read-only by default in the open-source edition, with writes and approval workflows added in Pro. The same principle applies to the layer you choose: the agent should be able to ask questions of governed metrics without any ability to alter the definitions. Keep metric changes behind code review, and keep the agent's identity separate from the humans who approve those changes.

Step 4: Run an eval on your own questions

Public benchmarks will not tell you how a layer behaves on your schema. Build a set of 20 to 50 questions that real stakeholders ask, with a known correct answer for each. Include easy lookups, multi-step questions that need a join, and a handful of questions the model should refuse because no governed metric exists. Run each candidate layer through the same agent and the same prompts.

Score two things per question. First, whether the final number is right. Second, whether the agent used a governed metric or fell back to ad hoc SQL. A layer that gets the right number through an ungoverned path is hiding risk. Track latency and token cost as well, since returning a long metric catalog on every call can inflate context and slow the agent.

Repeat the eval after any metric change. This is where context engineering pays off: the descriptions, synonyms and sample questions you attach to each metric act as the agent's documentation. Teams that treat those descriptions as code, reviewed in pull requests, tend to see steadier accuracy than teams that fill them in once and forget them.

Step 5: Decide per domain, not once for the company

Most organizations do not need one layer for everything. Finance may have a mature enterprise model that auditors trust. Product analytics may keep metrics in the transformation project. A new data product may live entirely in one warehouse. Forcing all three into a single tool delays the work and gives each team a worse fit. Pick per domain, and put a thin routing layer in front.

The routing layer is the part agents actually touch. It decides which layer answers a question, falls back to direct SQL when no governed metric matches, and records which route it took. If the routing logic lives in prompts alone, it will drift. Put it in a tool with explicit rules and an audit trail, so a reviewer can see why a number came from one source instead of another.

Set a review date. The market is moving quickly, and layers that lacked agent support a year ago now ship it. Re-run your eval every quarter, and keep your metric definitions in a format you can export, so a later switch costs weeks of work rather than a rebuild.

Where Data Workers fits

We do not replace your semantic layer, and we do not ask you to pick ours. The Insights Agent produces text-to-SQL grounded by whichever semantic layer you already run, and it returns analyses with citations and stated assumptions. When a governed metric exists, it uses it. When none matches, it says so and labels the fallback SQL as ungoverned.

The Catalog Agent federates metadata across the catalogs you already use, so metric descriptions and ownership stay discoverable from one place. The Connectors Agent reaches the warehouses underneath. Because every agent is an MCP server, your engineers invoke them from Claude Code or Cursor without opening another dashboard.

The swarm matters when something breaks. If a metric changes because an upstream schema changed, the agents that know about the schema, the catalog entry and the downstream consumers already share that context. That is the gap point tools leave to an engineer to close by hand, and it is why we treat the semantic layer as one input to a coordinated system, not the whole answer.

Frequently Asked Questions

Do I need a semantic layer if my agent writes good SQL?

Good SQL generation answers many exploratory questions, but it cannot tell the agent which of three revenue definitions the business approved. A semantic layer fixes that by giving one governed definition per metric. If your agent only serves analysts who verify every query, direct SQL may be enough. If it serves executives or customers, add governed metrics.

Should I choose a warehouse-native layer or a headless layer?

Choose warehouse-native if you run one warehouse and want policies, billing and lineage in one place. Choose headless if you run several engines or expect to switch, because definitions stay portable. In both cases, confirm MCP exposure and run the eval from step 4 before committing.

Can I use more than one semantic layer?

Yes. Many teams run one layer per domain and route questions by topic. The risk is conflicting definitions of the same metric, so assign one owner per metric and have the routing layer log which source answered. Keep the number of layers small, usually two or three at most.

How do I stop an agent from changing metric definitions?

Give the agent read-only access to the layer and keep definitions in version control behind pull-request review. The agent can propose a change as a diff, but a human approves it. Log every agent query with its identity so you can audit what it asked for.