Datacoves logo

Context Layer vs Semantic Layer: What AI Agents Need to Get Answers Right

ByNoel Gomez 16 mins read
One question, three answers: 25 vendors active in 12 months, 24 in 90 days, 21 by the ERP status flag
Key Takeaways
  • A semantic layer guarantees a metric is calculated the same way everywhere. It assumes someone already picked the right definition.
  • A context layer packages everything an agent needs to interpret your data, and the semantic layer is one part of it.
  • Sales, Product, and Finance each count active customers from a different system, and every count is defensible. An AI agent picks one of them without saying which.
  • Asked “how many active vendors do we have?”, an agent reading a sample project found 25, 24, and 21, each traced to a tested model. With a governed Definition of Record served over MCP it returned 25, cited its source column, and flagged an ERP field that disagreed with actual buying in 6 of 34 vendors.
  • Anthropic reported that without skills steering Claude to governed sources it answered no more than 21% of its analytics eval questions correctly, and above 95% with them.

A semantic layer defines metrics once and computes them the same way in every tool that asks. A context layer gives AI agents the wider business meaning they need to use that data: semantic models, documentation, lineage, glossary terms, and written knowledge. In most stacks, the semantic layer is one input to the context layer. Neither layer decides which definition of a business term is the approved one, and that missing decision is where most wrong AI answers start.

Three teams, three counts

Ask your company how many active customers it has. Sales counts signed contracts and gets 12,400. Product counts anyone who used the product in the last 30 days and gets 8,100. Finance counts customers who paid an invoice this quarter and gets 10,300. Same company, same quarter, three systems, three counts.

Those counts are illustrative. The disagreement they describe is ordinary, and it predates AI by about as long as dashboards have existed.

What changed is who answers. A business user now asks an agent directly, and the agent picks one of the three without flagging that it chose. The number lands in a forecast or a board deck, and the disagreement surfaces months later.

Get the free guide: One Question, Three Answers

Why three teams answer the same question three different ways, what context and semantic layers each miss, and a six-step checklist for settling your first definition.

Get the PDF
One Question, Three Answers, the Atlas guide

What is a semantic layer?

A semantic layer is a governed set of metric, dimension, and entity definitions that sits between your warehouse and every tool that queries it. You define net revenue once. Dashboards, notebooks, spreadsheets, and agents ask for net revenue and get the same SQL every time.

Semantic layers come in several forms. Some live in the transformation layer, like the dbt Semantic Layer. Some live inside the warehouse, like Snowflake Semantic Views and Databricks Unity Catalog metric views. Others are built into BI tools or run as standalone engines. They differ in where the definition lives and which engine runs it. All of them make the same promise: consistent computation.

What is a context layer?

A context layer is the business knowledge an AI agent reads before it writes SQL or answers a question. It usually bundles semantic models, model and column documentation, lineage, glossary terms, example queries, and unstructured knowledge from wikis and tickets, then exposes all of it to agents, often over MCP.

Most of the raw material already exists in tools you run. Catalogs and governance platforms such as Atlan, Collibra, Alation, and DataHub hold much of it: which assets exist, how data flows between them, who owns what, and what the business terms are supposed to mean. A context layer’s job is to assemble that into something an agent can read at the moment it’s asked a question.

Vendors package it differently. Fivetran describes its Context Layer, now in limited public preview, as a context inference and management service that turns the sources you already ingest into the context agents need, then publishes that metadata as open tables in your own warehouse for any agent with SQL access. Most definitions you’ll find agree on the shape: the context layer is the superset, and the semantic layer is one of its inputs.

That answer is accurate. It also skips the step that decides whether the agent’s answer is right.

How a context layer differs from a data catalog

A data catalog is built for a person searching for data. A context layer is built for an agent about to answer a question, so it has to be machine-readable and complete rather than browsable. Most context layers read from the catalog you already run, which is why the two get conflated. The catalog is an input to the context layer, not a replacement for it.

Where agent memory fits

Agent memory is what one assistant retains across turns or sessions: your preferences, what you asked last week, the thread of a conversation. It’s personal to you and it drifts. A context layer is shared, versioned, and the same for everyone who asks. An agent that remembers you like the 90-day number will keep handing you the 90-day number, which is the opposite of what a governed definition is for.

What a semantic layer does well

Credit where it’s earned. A good semantic layer moves metric logic out of individual dashboards and into one governed place. Definitions live in code or configuration, so they can be version-controlled, reviewed, and tested before they reach anyone. Joins come from declared relationships, which means analysts stop hand-writing join paths and stop getting them subtly wrong.

The payoff compounds as tools multiply. The same metric reaches a BI dashboard, a spreadsheet, a notebook, and increasingly an AI agent through an API or an MCP server, and every one of them gets the same number.

If you’ve ever sat in a meeting reconciling three dashboards that show three revenue numbers, you know what this fixes. Keep your semantic layer. The harder question is what it was never built to do.

Where a semantic layer stops: one question, three valid answers

We asked an AI agent running in Datacoves a plain business question against a Snowflake demo dataset: how many active vendors do we have? The agent had the dbt repo and read access to the project’s production schema. It read the model SQL, picked 25, and called it the project’s standard definition. Then it listed two other defensible answers, 24 and 21, and told the user the right one depends on what they mean by “active.”

Claude Code terminal output listing three definitions of active vendor with counts of 25, 24, and 21
Figure 1. Without Atlas. Claude Code in Datacoves, Snowflake demo dataset, data as of 2026-08-01.

It guessed right, and that’s the problem. The agent chose 25 because one model is named mart_active_vendors and the others aren’t. Rename a model, add a fourth one, or ask a different agent, and the “standard” answer moves. A table name was carrying a decision nobody had recorded.

None of these is a bug. Finance reviewing vendor risk may want twelve months. Procurement tracking supplier consolidation may want ninety days. The ERP admin trusts the status field because that’s what the ERP shows on screen. Each team has a reason, and each reason holds up.

A semantic layer will compute whichever one you encode, consistently, forever. Think of it as a calculator with a perfect memory: it never forgets the formula you gave it, and it never tells you the formula was the wrong one. Encode the 90-day version as “active vendors” and every dashboard and agent will agree with each other while disagreeing with the CFO.

The ERP flag shows how this goes wrong in practice. Five vendors marked inactive are still receiving purchase orders or invoices. One marked active hasn’t had either in twelve months. An agent that finds a column named status with a value of active will reach for it first, because it looks like the obvious answer.

Two-by-two grid comparing ERP status with purchasing activity across 34 vendors, showing 6 mismatches
Figure 2. The ERP status flag and actual purchasing activity disagree for 6 of 34 vendors.

Ask that agent again tomorrow, or ask a different agent, and you may get a different pick. Business users experience that as “the AI makes things up,” even though every number came from real, tested dbt models. We’ve written before about why LLMs still need people checking their work. This is the version of that problem that no model upgrade will fix.

AI made ambiguity cheap

A business question used to go to the data team. An analyst wrote the SQL, hit the judgment call, and walked over to ask which definition you meant. That conversation was slow, and it was also the safety check.

A business user now asks an agent directly. The agent finds the competing definitions, picks one, fills in whatever it doesn’t know, and returns a number with no hedging. Nobody asks which version it used, and usually nobody can tell from the answer.

The ambiguity was always there. AI removed the person who used to catch it, and made the answer cheap enough that nobody waits for the meeting.

What a context layer adds, and the decision it needs first

A context layer fixes a real problem: agents that don’t know which table holds vendors, what a column means, or how models connect. Give the agent lineage and documentation and it stops guessing at structure.

It leaves this problem untouched. In the vendor example, the context was already there. The agent found all three models, read their SQL, and described each one accurately. More context about an undecided term gives an agent more ways to be confidently wrong.

The missing step is agreement. Someone who owns the term chooses one definition, writes it down in plain language, and records the decision so it can be found, versioned, and challenged later. We call the result a Definition of Record.

A Definition of Record is a plain-English, versioned, attributed statement of what an organization has agreed a business term means, published so that people and AI agents use the same meaning.

What governed sources did for Anthropic’s own evals

Anthropic’s data team published how it runs self-service analytics on Claude. Without skills steering the model to governed sources, Claude answered no more than 21% of their analytics eval questions correctly. With them, accuracy went above 95%.

They tried the shortcut first. Bootstrapping the semantic layer by having an LLM generate metric definitions from raw tables produced plausible-looking definitions that encoded the ambiguity they were trying to remove, and it scored net-negative on their evals. Claude now writes the documentation and a person owns the definition.

The same question, with Atlas connected

Atlas is the agreement layer we built for this step. It records Definitions of Record and serves them to agents over MCP. We connected it and asked the same question in the same session. The agent returned one answer, 25 active vendors out of 34, and showed its work:

  • It named the governed Active Vendor definition: at least one purchase order or invoice in the trailing 12 months, counted by vendor_id.
  • It cited the column it used, BALBOA.L3_ACCOUNTS_PAYABLE.MART_ACTIVE_VENDORS.is_active.
  • It told the user not to use the ERP status flag for this question and explained the six mismatches.
  • It noted that the repo’s active_vendor_reference_counts test also expects 25 at 2026-08-01.
  • It labeled the other 9 as dormant vendors, the governed opposite term, and offered the 90-day trend as a separate view.
Claude Code terminal output citing the governed Atlas Active Vendor definition, its source column, and a warning against the ERP status flag
Figure 3. With Atlas connected. Same agent, same Snowflake demo dataset.

That last point matters more than it looks. The 90-day number didn’t disappear. It just stopped borrowing the name of a number the business had already settled.

The same discipline carries into reporting. A dbt Charts dashboard built on the Atlas-governed dbt models shows 25 active vendors and the 6 ERP mismatches. Its 90-day trend chart is titled “Vendors with Activity in the Prior 90 Days.” The words “active vendor” appear only on the governed number. One chart title did more for trust than a page of documentation would have.

dbt Charts dashboard showing 25 active vendors in the trailing 12 months, 6 vendors whose ERP status disagrees with activity, and a trend chart titled Vendors with Activity in the Prior 90 Days
Figure 4. The vendor activity dashboard, built with dbt Charts on Atlas-governed dbt models. Demo dataset, data as of 2026-10-17.

Telling the agent how much to trust a term

Atlas also tells the agent where a term stands. A term is governed when an approved Definition of Record exists. It’s declared but thin when the business has named it but the definition still has gaps. It’s out of scope when nobody has defined it yet. An agent that knows which state it’s in can answer, hedge, or route the question to the owner instead of picking a column and hoping.

Atlas sits upstream of both your semantic layer and your context layer, and it replaces neither. Once a definition is approved, your team encodes it in whatever semantic layer you run, and your context layer serves it alongside everything else. Fivetran’s Context Layer infers context from what you already ingest and model. Atlas complements that kind of tool by recording which definition the business approved, who approved it, and every change since.

Stack diagram showing Definitions of Record feeding the semantic layer, context layer, transformation models, and AI agents over MCP
Figure 5. Definitions of Record feed every layer above the warehouse over MCP.

Beyond metrics: rules, processes, people, and policies

Treat an agent like a new hire. It’s fast and tireless, and it showed up without the context your team spent years building. A new analyst asks before guessing. An agent usually guesses.

Much of what it needs has no metric to attach to:

  • Rules. Test accounts never count toward revenue.
  • Processes. Who reviews the forecast, and in what order.
  • People. Who knows how monthly active users is calculated.
  • Policies. Holidays and PTO rules by country.

A semantic layer computes metrics, and a context layer describes tables, columns, and lineage. A PTO policy has no column to attach to, and a forecasting review has no formula. Rules like excluding test accounts do often end up in code, and the decision behind them still needs an owner and a record.

Each piece gets settled the way a metric does: the person who knows it confirms it, and the agreed version is recorded with an owner and a history. Settle each one the first time somebody needs it. Nobody is going to review a hundred definitions that nobody has asked about.

Where OSI fits

The Open Semantic Interchange launched in 2025 with Snowflake, Salesforce, dbt Labs, Databricks, and other partners. Its first specification shipped under Apache 2.0 in January 2026, and on July 10, 2026 the project entered the Apache Incubator as Apache Ossie, where it’s still incubating.

OSI gives teams a vendor-neutral format for metrics, dimensions, and relationships, so a definition written for dbt can move to Snowflake or Tableau without being rewritten. That’s useful, and overdue.

Portability has no opinion about correctness. OSI will carry the 90-day definition of “active vendor” into every tool as faithfully as the 12-month one. Portability without agreement just spreads the wrong number faster. The order that works is agree, encode, then port.

Context layer vs semantic layer: side-by-side comparison

Which layer comes first

Starting from nothing, start with agreement. Pick the terms your agents get asked about most, settle what each one means, and record who signed off. Those definitions become the spec for everything you build after.

Add a semantic layer when you need the same number computed the same way in every tool. Built from settled definitions, the code reflects a decision someone owns, and an agent can draft most of it.

Add a context layer when agents can’t find the right tables or misread columns. Your Definitions of Record are already the most valuable context it will serve.

The order holds if you already run one or both. Agreement goes upstream, and the layers you have start reading from it.

Picking by symptom gets you to the same place. Dashboards that disagree with each other are a computation problem, and any mainstream semantic layer handles it. Agents that can’t find the right tables or that misread columns are a structure problem, and documentation, lineage, and glossary context solve it. Confident numbers that business owners dispute, or two teams answering the same question differently, are an agreement problem. Encoding and retrieval can’t settle that one, and building a semantic layer on top of it locks the disagreement in.

There’s one case where your semantic layer alone is fine for now: agents answering questions inside a single well-owned metric set, such as finance querying its own revenue model. A single owner is already doing the agreement work informally.

Most enterprise data teams rolling agents out to business users are in the third situation, whether they’ve noticed or not.

How to start without new tooling

None of this needs a platform project or a purchase order.

  1. Pick the metric that changes depending on who you ask. Active customer is a good place to start.
  2. Count how many models, views, or reports compute it today. More than one means a decision is waiting.
  3. Name the people who own the answer, usually in Sales, Product, and Finance.
  4. Agree on one plain-English definition, signed off by whoever is accountable for the number.
  5. Record who agreed, when, and why, so the next person can change it on purpose.
  6. Point your AI tools at that definition, then ask the question again.

A markdown file in the repo your agent already reads will carry the first few terms. What it can’t do is tell you when a definition has gone stale, show you who disagreed and why, or stop two teams from writing the same term twice under different names. That’s the work Atlas automates, and doing it by hand first is the cheapest way to find out how much of it you need.

For the thinking behind Atlas, read Introducing Atlas: an agreement layer for enterprise AI or listen to Atlas and the Agreement Layer. We also walked through this vendor example on the show floor in Datacoves Launches Atlas at dbt Summit 2026.

Pick the ten business terms your agents get asked about most and count how many models, views, or reports compute each one. Any term with more than one answer is a Definition of Record waiting to happen, and it’s probably why your pilot users have stopped trusting the agent.

FAQs

Does a context layer replace a semantic layer?

+

No. A context layer serves semantic layer metrics to agents alongside documentation, lineage, and other context. Teams keep their semantic layer for consistent computation and add context so agents can find and interpret the right data.

Does OSI (Apache Ossie) solve inconsistent metric definitions?

+

It makes definitions portable. OSI gives teams a vendor-neutral format to move metrics, dimensions, and relationships between tools without rewriting them. Choosing which definition the business approved still has to happen first, or OSI carries the disagreement into every tool.

Do we need a semantic layer before adopting Definitions of Record?

+

No. If you have one, keep it. If you don’t, the slow part of building one is getting people to agree, and that’s what Definitions of Record capture. Your team can then encode approved definitions in whichever semantic layer you choose.

How do AI agents access governed definitions?

+

Over the Model Context Protocol (MCP). Atlas publishes Definitions of Record to any MCP client, including chat assistants and coding agents, along with whether each term is governed, declared but thin, or out of scope.

How do I build a context layer without buying new tooling?

+

Start with the terms your agents get asked about most. Pick one that changes depending on who you ask, count how many models or reports compute it today, get the people who own the answer to agree on one plain-English definition, and record who signed off. A markdown file in the repo your agent already reads will carry the first few terms. What a file cannot do is tell you when a definition has gone stale, or stop two teams from defining the same term twice under different names.

Is a context layer the same as a data catalog?

+

No. A data catalog is built for a person searching for data, so it optimizes for browsing and discovery. A context layer is built for an agent about to answer a question, so it has to be machine-readable and complete. Most context layers read from the catalog a team already runs, which makes the catalog an input to the context layer rather than a replacement for it.

Is a context layer the same as a semantic layer?

+

No. A semantic layer defines and computes metrics consistently. A context layer is broader: it includes semantic models plus documentation, lineage, glossary terms, and unstructured knowledge that AI agents use to interpret data. In most stacks, the semantic layer is one input to the context layer.

Should we just fix the status field in the ERP?

+

Fix it if it’s wrong, but it won’t settle the question. A well-maintained status field usually answers whether a vendor is approved to do business with you. That’s a different question from whether you bought from them recently. Decide which question “active” answers, then record it.

What are the components of a context layer?

+

A context layer usually holds semantic models, model and column documentation, lineage, glossary terms, example queries, and unstructured knowledge pulled from wikis and tickets. Much of that raw material comes from catalogs and governance tools a team already runs, such as Atlan, Collibra, Alation, or DataHub. The context layer assembles it into something an agent can read at the moment it is asked a question, usually over MCP.

What is a context layer?

+

A context layer is the business knowledge an AI agent reads before it writes SQL or answers a question. It bundles semantic models, model and column documentation, lineage, glossary terms, example queries, and written knowledge from wikis and tickets, then exposes all of it to agents, usually over MCP. The semantic layer is one of its inputs. A context layer helps an agent find and interpret the right data, and it does not decide which definition of a business term the organization approved.

What is a Definition of Record?

+

A Definition of Record (DoR) is the business-approved meaning of a term, such as active vendor, along with the logic, source, and owner behind it. In Atlas, each DoR is versioned and reviewed, so every change has a history, and it is published so people and AI agents work from the same meaning.

Why does my AI agent give different answers to the same question?

+

Usually because your data project contains more than one valid definition of the term. An agent reading model SQL can find several defensible answers, such as a 12-month activity window, a 90-day window, and a source-system status flag, and pick one without telling you. A governed Definition of Record removes that choice from the agent.

Last updated onNovember 10, 2026
Noel Gomez
Noel Gomez
Author

Datacoves Co-founder | 15+ Years Data Platform Expert. Solving enterprise data challenges quickly with dbt & Airflow.

Continue reading

End-to-end data analytics with Managed dbt and Airflow

Don’t let platform limitations or maintenance overhead hold you back.

Noel gomez

Subscribe to our newsletter & be a part of our Exclusive Crew!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Datacoves Logo

Datacoves is an enterprise DataOps platform with Managed dbt and Airflow for data transformation and orchestration, as well as VS Code in the browser for development

LinkedIn X YouTube
Datacoves is snowflake ready technology badge
© 2026 Datacoves. All rights reserved.
Privacy Policy Terms of Service Sitemap

Apache, Apache Airflow, Airflow, Apache Superset, the Airflow logo, the Apache feather logo, Superset, and the Superset logo are trademarks of the Apache Software Foundation. Dbt, dbt core, dbt logo are trademarks of the dbt Labs, Inc. Airbyte, Airbyte logo are trademarks of the Airbyte, Inc. Snowflake, Snowflake logo are trademarks of the Snowflake Inc.