Skip to content
InovagioInovagio

Series · Knowledge layer deep dives

Semantic layer for AI agents: governed metrics for accurate answers

A semantic layer defines each business metric once, with its joins and its owner, so an AI agent asks for "credit note rate" instead of writing its own SQL. What the 2023 to 2026 benchmarks show, a worked metric definition, the open Ossie standard and where MCP fits.

· Published · Updated · 14 min read

On this page

A semantic layer for AI agents is a governed set of business definitions (metrics such as credit note rate, dimensions such as region, and the joins between tables) that every tool and agent uses to turn a question into a query. Define "credit note rate" once and give it an owner and a version number, and the agent's answer matches the CFO's dashboard.

Without one, an agent that's asked a number writes SQL from the column names and its best guess. Sometimes the guess is right. When it isn't, the query still runs, the number still looks reasonable, and nobody finds out until finance reconciles. An agent asked for an insurer's written premium on a delegated program, for example, might count a policy's premium again for every endorsement on it. The error surfaces only when someone matches the bordereau to the policy system. That quiet failure is the one to design against.

How an agent gets a number wrong

#

Take credit note rate at Tamsworth Supply, a building-products distributor (Example company): the value of credit notes issued, meaning price corrections and returns credited to customers, divided by net invoiced sales for the same period. Ask an agent for last quarter's wholesale credit note rate by region, and a typical first attempt looks like this.

sql
SELECT a.region,
       SUM(cn.credit_amount) / SUM(a.billed_ytd) AS credit_note_rate
FROM customer_account a
JOIN credit_note cn ON cn.account_id = a.account_id
WHERE a.segment = 'WHOLESALE'
  AND cn.credit_date >= DATE '2026-07-01' AND cn.credit_date < DATE '2026-10-01'
GROUP BY a.region;

It runs. It's wrong in three ways. The join repeats each account's billing once per credit note, so an account with three credit notes counts its billing three times. The inner join drops every account with no credit notes, so most of the billing vanishes from the denominator. And billed_ytd on the account row is year-to-date billing, not the quarter's. Two of those errors push the ratio down and one pushes it up, so the result can land close enough to last year's figure that nobody questions it.

Data engineers call the first problem fan-out, and BI modelers call the join that causes it a fan trap. It's the most common way a correct-looking query returns a wrong total, and it's exactly what a semantic layer exists to prevent: it knows the grain of each table and aggregates each measure at its own grain before joining.

The dbt Labs authors of the vendor study below list the failure types they saw from text-to-SQL: wrong joins, misread column meanings, queries that run but return the wrong result, and correct-looking numbers that differ slightly from run to run. Their summary of the difference: text-to-SQL fails with a plausible but incorrect answer, and the semantic layer fails with an error message (dbt Labs, April 7, 2026). For a board pack or an examiner, that difference is everything. An error gets fixed the same day. A plausible wrong number gets signed.

A table comparing an agent's own SQL with a semantic layer for AI agents on credit note rate: billing repeated by the join against measures aggregated at their own grain, dropped accounts against none, year-to-date billing against each measure's own time dimension, and a plausible wrong number against an error routed to the owner
Text-to-SQL fails with a plausible answer; a semantic layer fails with an error. Tamsworth Supply · Example company.

Semantic layer vs text-to-SQL: what the benchmarks measured

#

Three studies matter here, and each comes with a caveat.

Knowledge graph over SQL (2023). Sequeda, Allemang and Jacob asked a leading model of the time 43 questions over 13 tables drawn from the OMG standard insurance data model, once writing SQL against the tables and once querying a knowledge graph built over them. A model answered 16% of business questions correctly from the raw tables and 54% from a knowledge graph of the same data (arXiv 2311.07509, November 13, 2023). Our ontology guide breaks that down by question type.

Semantic layer against text-to-SQL (2023 and 2026), a vendor study. dbt Labs reran a subset of the same insurance benchmark, 11 questions with 20 runs each, through its own semantic layer. In 2023 the semantic layer scored 60.5% against 32.7% for text-to-SQL. In the 2026 update, with current models, the semantic layer answered every in-scope question correctly and returned an error, not a number, for the questions it couldn't express. After an AI-assisted change that added three models joining the needed tables, text-to-SQL reached 90.0% with one current model and the semantic layer 98.2%; with a second model the figures were 84.1% and 100%. The authors work for the vendor and the benchmark is small. Read it as direction, not as a league table.

Bar chart from a vendor study: text-to-SQL at 32.7% in 2023, then after light modeling in 2026 text-to-SQL at 90.0% and the semantic layer at 98.2% with the same current model
Source: dbt Labs, Semantic Layer vs. Text-to-SQL: 2026 Benchmark Update, April 7, 2026 (a vendor study, 11 questions).

A short semantic document (2026). Rumiantsau and Fokeev gave three frontier models 100 questions over a retail dataset, each question asked twice: once with only the warehouse schema, once with a 4 KB hand-written Markdown document of business definitions added (arXiv 2604.25149, April 28, 2026). The document added 17 to 23 points for every model, taking them from 45.5% to 50.5% up to 67.7% to 68.7%. The three models were statistically indistinguishable from each other with the document and without it; the document was the only change that mattered. It's a preprint, not yet peer reviewed.

Two figures: with a 4 KB semantic document, every model gained 17 to 23 points, and the gap between three frontier models stopped being significant
Source: Rumiantsau and Fokeev, arXiv 2604.25149, April 2026 (preprint).

That last result is the one to put in front of a steering committee. Business definitions mattered more than which frontier model was used. Spending a quarter writing down what your metrics mean is a better bet than waiting for the next model. The definitions are also the part worth owning, because they outlast whichever model reads them.

The caveats cut both ways. None of these benchmarks covers your data, and a semantic layer can only answer what it defines. The dbt result shows the honest version of that limit: out of scope, the layer says so.

What a semantic layer contains

#

Tools use different words for the parts, but every one has these six.

PartWhat it isExample at Tamsworth
EntityA business object with a key, used to joinCustomer account (account_id), credit note (credit_note_id)
DimensionA way to slice: categorical, or time with a grainRegion, customer segment, credit date by day
MeasureAn aggregation over one table at its own grainSum of credit amount; sum of net invoiced sales
MetricWhat people ask for, built from measuresCredit note rate = credits ÷ net invoiced sales
Join pathWhich entities connect, and howCredit note to account on account_id; invoice to account on account_id
Owner and versionWho approved the definition, and which one this isReceivables finance steward, version 3

The metric types worth knowing are single-measure, ratio (two measures, each aggregated separately before dividing), derived (an expression over other metrics) and cumulative (running totals over a window). Ratio metrics are where fan-out bites hardest, which is why credit note rate makes a good first test.

A worked example

#

Here's credit note rate defined once. The YAML is a sketch rather than any one tool's format: field names differ between semantic-layer tools, but every mainstream one carries these parts.

yaml
# A sketch. Field names differ between semantic-layer tools.
semantic_models:
  - name: accounts
    table: customer_account
    entities:   [{ name: account, type: primary, expr: account_id }]
    dimensions: [{ name: region, type: categorical }, { name: segment, type: categorical }]
  - name: credit_notes
    table: credit_note
    entities:   [{ name: credit_note, type: primary, expr: credit_note_id },
                 { name: account, type: foreign, expr: account_id }]
    dimensions: [{ name: credit_date, type: time, grain: day }]
    measures:   [{ name: credited, agg: sum, expr: credit_amount, agg_time_dimension: credit_date }]
  - name: invoiced_sales
    table: invoice
    entities:   [{ name: invoice, type: primary, expr: invoice_id },
                 { name: account, type: foreign, expr: account_id }]
    dimensions: [{ name: invoice_date, type: time, grain: day }]
    measures:   [{ name: invoiced, agg: sum, expr: net_amount, agg_time_dimension: invoice_date }]

metrics:
  - name: credit_note_rate
    label: Credit note rate
    type: ratio          # non-additive: recomputed from its measures, never summed
    numerator: credited
    denominator: invoiced
    description: Value of credit notes issued over net invoiced sales for the same period.
    owner: receivables-finance-steward
    version: 3

The agent no longer writes SQL. It calls a tool and passes the metric by name, plus the slices and the period it wants:

json
{
  "tool": "query_metrics",
  "arguments": {
    "metrics": ["credit_note_rate"],
    "group_by": ["account__region"],
    "where": ["account__segment = 'WHOLESALE'"],
    "time": { "grain": "quarter", "start": "2026-07-01", "end": "2026-09-30" }
  }
}

The semantic layer compiles that into SQL that aggregates each measure at its own grain first, then joins, so neither the fan-out nor the dropped accounts can happen:

sql
WITH credits AS (
  SELECT a.region, SUM(cn.credit_amount) AS credited
  FROM credit_note cn JOIN customer_account a ON a.account_id = cn.account_id
  WHERE a.segment = 'WHOLESALE'
    AND cn.credit_date >= DATE '2026-07-01' AND cn.credit_date < DATE '2026-10-01'
  GROUP BY a.region
), sales AS (
  SELECT a.region, SUM(i.net_amount) AS invoiced
  FROM invoice i JOIN customer_account a ON a.account_id = i.account_id
  WHERE a.segment = 'WHOLESALE'
    AND i.invoice_date >= DATE '2026-07-01' AND i.invoice_date < DATE '2026-10-01'
  GROUP BY a.region
)
SELECT s.region, COALESCE(c.credited, 0) / NULLIF(s.invoiced, 0) AS credit_note_rate
FROM sales s LEFT JOIN credits c ON c.region = s.region;

Each measure names its own time dimension, which is how one quarter filter lands on the credit date for the numerator and the invoice date for the denominator. One more decision belongs in the definition rather than in each query: whether region means the account's region today or on the date of the credit. Write it down once.

A metric card with numbered pins: the metric's name and label, the formula from two measures, the owner who approved it, the version, and the dimensions it can be sliced by
One definition, one owner, one version: the same number on every screen.

Two habits make this hold up in an audit. Record the metric's version with every answer, so a number can be traced to the definition that produced it. And ask for an error rather than a guess: when a question needs a metric or a join the layer doesn't define, the agent should say so and route the question to the metric's owner. That's the same discipline we apply to business rules in how a rule is approved.

Our Synesis product works this way: governed metrics and dimensions are bound to tables and approved through the same change sets as the rest of the knowledge layer, and the definitions live in MNEMOS beside the data they describe. The metric's name is a concept in the ontology, its dimensions are ontology classes bound to tables, and its join paths are the object properties bound to foreign keys. A ratio is declared non-additive, so it's recomputed from its measures, never summed. When a request would cross a fan trap or a chasm trap, or has two possible join paths, the compiler refuses it and names the problem. A Virtual Employee that gets that refusal sends the question to a person instead of guessing.

Apache Ossie, the open standard

#

For years every semantic layer had its own format, so definitions were locked to a tool. That changed in late 2025. A group of 17 data-platform vendors and users launched the Open Semantic Interchange on September 23, 2025 (SiliconANGLE, September 23, 2025). Its first specification followed under the Apache 2.0 license, covering datasets, metrics, dimensions, relationships and context (dbt Labs, January 29, 2026).

In July 2026 the project entered the Apache Software Foundation's incubator under a new name, Apache Ossie, to avoid confusion with other projects called OSI. The YAML format didn't change. The project describes Ossie as an open specification for both semantic layer and ontology (Apache Ossie, July 10, 2026). It's a YAML format, not an RDF one, so if you already keep an ontology in OWL and SKOS, check how Ossie's ontology parts map to it before you treat the two as interchangeable. Not every incubating project graduates, so treat it as promising rather than settled.

A timeline of the open semantic-layer standard: announced September 2025, a first specification under Apache 2.0 reported in January 2026, entered the Apache Incubator as Apache Ossie in July 2026
Sources: dbt Labs, January 29, 2026; Apache Ossie, July 10, 2026.

The practical advice: keep your definitions in a format you can export, and prefer tools that read and write an open one. We hold ourselves to the same test. In Inovagio, your rulebook exports free, in open standards (SKOS, OWL and SHACL), so the concepts and rules your metrics are bound to leave with you if you leave.

Permissions belong in the layer too

#

An agent that can query every metric for every region can leak the one number a user wasn't cleared to see. Put access rules where the definitions are. A semantic layer that runs each query as the person the agent acts for, and applies the warehouse's row-level security, gives the agent the same view that person would have on a dashboard. A credit controller in the Northeast sees Northeast credit note rates, not the board pack.

Three rules hold up in regulated work. The agent never queries with a service account broader than the user it acts for. Tenant and row filters are applied by the layer, not written into the prompt, where a cleverly worded request can talk the model out of them. And every metric call is logged with who asked, which definition answered and what came back. In Inovagio, Phylax attributes every action a Virtual Employee takes to the person it acts for, and MNEMOS applies roles, row-level security and document-level security trimming to every result; our trust page covers the rest of the controls.

Where MCP fits

#

The Model Context Protocol (MCP) gives an agent a standard way to call tools and read data. It's how the query_metrics call above reaches the semantic layer, and Connect is the MCP host and client in Inovagio. But MCP is plumbing. It carries requests; it doesn't know what credit note rate means. Cube, a vendor listed in Gartner's Market Guide for Agentic Analytics (February 9, 2026), quotes one prediction from it: Gartner predicts that by 2028, 60% of agentic analytics projects relying solely on MCP will fail due to the lack of a consistent semantic layer (Cube, March 3, 2026). We haven't seen the guide itself, so weigh it accordingly. The point stands on its own: connecting an agent to a warehouse through MCP is the same as giving it the raw schema.

How the semantic layer and the ontology fit together

#

They answer different questions. The semantic layer says which number: metrics over tables, at the right grain. The ontology says what a thing is and how things relate, independent of any table, and its constraints say which rules hold, such as a credit note always referring to an invoice already issued. In the W3C standards that's OWL for the concepts and SHACL for the rules. Gartner calls for a context layer that holds this kind of meaning, and its May 2026 release puts numbers on the stakes. Gartner predicts that by 2027, organizations that prioritize semantics in AI-ready data will increase agentic AI accuracy by up to 80% and reduce costs by up to 60% (Gartner, May 11, 2026). It's a forecast, not a measurement.

Two sources merging into one answer: governed metrics from the semantic layer and concepts and rules from the ontology produce an answer an agent can trace
Numbers from the semantic layer, meaning from the ontology.

Forrester puts the semantic layer first: the right starting point, with a data graph as the bridge and a knowledge graph as the destination (Forrester, June 2, 2026). Its August note goes further and describes a context layer that combines business semantics, ontology, enterprise knowledge and runtime events (Forrester, August 20, 2026). Binding each metric to the ontology concept it measures is what connects the two: "credit note rate" knows it's about credit notes and invoices, so an agent that has the ontology knows which rules apply to the credit notes behind the number. What a context layer is explains the whole picture for business readers, and context engineering for AI agents shows how the definitions reach an agent at each step.

Where to start with a semantic layer for AI agents

#

Pick the 10 to 20 numbers your board and regulators see. Write each one's definition and agree its grain with the person who owns it. Then write golden questions, the ones a CFO actually asks, with the answers finance has already reconciled, and run them against the layer every time a definition changes. Make the agent return an error, routed to the owner, when a question falls outside what's defined. You'll find the gaps fast. And because the golden questions rerun on every change, a gap you've closed doesn't quietly reopen. For short answers to the questions buyers ask next, see the knowledge layer questions and answers.

Further reading

#
  • Semantic Layer vs. Text-to-SQL: 2026 Benchmark Update, dbt Labs (Ganz and Perigaud), April 7, 2026: getdbt.com
  • Semantic Layers for Reliable LLM-Powered Data Analytics: A Paired Benchmark of Accuracy and Hallucination Across Three Frontier Models, Rumiantsau and Fokeev, April 28, 2026: arxiv.org
  • A Benchmark to Understand the Role of Knowledge Graphs on Large Language Model's Accuracy for Question Answering on Enterprise SQL Databases, Sequeda, Allemang and Jacob, November 13, 2023: arxiv.org
  • Report of the Open Semantic Interchange launch, SiliconANGLE (Gillin), September 23, 2025: siliconangle.com
  • What the Open Semantic Interchange (OSI) spec means for metrics, semantics, and AI, dbt Labs (Connors), January 29, 2026: getdbt.com
  • Gartner Market Guide for Agentic Analytics, February 9, 2026, as quoted by Cube, March 3, 2026: cube.dev
  • Apache Ossie (Incubating): The New Name for Open Semantic Interchange, Apache Ossie, July 10, 2026: apache.org
  • Build Meaning Before Machines, Forrester, June 2, 2026: forrester.com
  • The Next Evolution Of AI Will Rely On Context Layers, Forrester, August 20, 2026: forrester.com
  • Gartner Says Lack of Semantics Causes Inaccurate AI Agents and Wasted Spending, Gartner, May 11, 2026: gartner.com

Share

Questions

What people ask.

What is a semantic layer?

A semantic layer is a governed set of business definitions, including metrics, dimensions and the joins between tables, that every reporting tool and AI agent uses to turn a question into a query. Each metric is defined once, with an owner and a version, so the same question gets the same number everywhere.

Why do AI agents need a semantic layer?

Because an agent writing its own SQL guesses at joins and column meanings, and its mistakes run without error and return plausible wrong numbers. With a semantic layer the agent asks for a defined metric by name, the layer writes the query at the right grain, and a question it can't answer returns an error instead of a guess.

Is a semantic layer the same as an ontology?

No. A semantic layer defines numbers over tables, such as credit note rate by region and quarter. An ontology defines business concepts and the relationships between them, independent of any table, usually in OWL, with SHACL shapes for rules such as a credit note always referring to an invoice already issued. They work best together, with each metric bound to the concept it measures.

Does MCP replace a semantic layer?

No. The Model Context Protocol standardizes how an agent connects to tools and data, but it doesn't define what a metric means or how tables should be joined. An agent connected to a warehouse over MCP without a semantic layer is still writing its own SQL from the raw schema.

What is Apache Ossie?

Apache Ossie is the new name of the Open Semantic Interchange, an open YAML specification for semantic-layer definitions such as metrics, dimensions and relationships, which the project also describes as covering ontologies. It entered the Apache Software Foundation's incubator in July 2026.

How many metrics should we define first?

Start with the 10 to 20 numbers your board and regulators see, each with a definition, an owner and an agreed grain. Test them with questions finance has already reconciled, and add more as agents meet questions the layer can't yet answer.

Developer edition

Build on Inovagio.

The MNEMOS data engine, the command line and the desktop app, with guides and API references.

This is for

We use these details to answer your request. See our privacy policy.

What happens next

  1. 1We reply to every request.
  2. 2We send the next steps for your team.
  3. 3A direct line to the engineers who build it.