14 LAUNCHES IN 14 DAYS

SEE WHAT’S NEW

Context Layer: What It Is, vs Semantic Layer, How to Build

Context Layer: What It Is, vs Semantic Layer, How to Build

Context Layer: What It Is, vs Semantic Layer, How to Build

All Posts

What a context layer is, how it differs from a semantic layer, and how to build one for data agents, with OpenAI's six-layer architecture as the example.

Ka Ling Wu

Co-Founder & CEO, Upsolve AI

10 min

Context layer with structure, meaning, and trust feeding an AI agent that returns a verified revenue answer

Ask an AI agent “what was revenue growth last quarter?” and it faces a choice most people never see. There’s a fct_revenue table and a revenue_monthly_v2 view. One includes refunds, one doesn’t. One is maintained, one was abandoned in March. The model is smart enough to write the SQL, but it has no way to know which table your CFO trusts.

That gap is what a context layer fills. It’s the hottest term in data infrastructure in 2026, and almost every vendor defines it differently. This guide gives a clear definition, maps the competing ones, explains how a context layer differs from a semantic layer, and walks through how to build one, using OpenAI’s in-house data agent as a real-world reference.

Key Takeaways

  • A context layer is everything an agent needs beyond the model and the raw data: structure (what data exists), meaning (what it means here), and trust (what’s verified and allowed), kept current and assembled per question.

  • The semantic layer is inside it: a16z and Cube both describe the context layer as a superset of the semantic layer, with the semantic layer as the part that actually executes.

  • Gartner now calls for one: In May 2026, Gartner advised data and analytics leaders to establish a context layer as a core component of their D&A infrastructure.

  • Content does the work: An independent 2026 study found that semantic content drove most of the accuracy gain in text-to-SQL agents, lifting hard-task accuracy from 14–37% to 55–77%, while retrieval scaffolding alone added far less.

What Is a Context Layer?

A context layer is the governed body of knowledge an AI agent uses to answer business questions correctly and safely. It includes which tables exist and how they connect, what your metrics and terms mean, and which answers and sources are trusted. It sits between your data and your agents, stays current as the business changes, and supplies the right slice of knowledge for each question.

In simple terms, if the semantic layer is the rulebook for calculating numbers, the context layer is the whole briefing a new senior analyst would get in their first month.

Why the Term Took Off in 2026

The idea isn’t new, but the label is. MotherDuck’s primer calls the term “less than a year old.” In just a few months:

  • March 2026: a16z published “Your Data Agents Need Context,” arguing for “a contextual layer on top that helps agents understand business logic.”

  • May 2026: Gartner told data leaders to establish a context layer, noting that “traditional schema-based data models alone no longer suffice for agentic AI.”

  • June 2026: Snowflake launched Horizon Context, “The Governed Context Layer for AI, BI and Apps,” and Databricks launched Genie Ontology as “a new self-improving context layer.”

Seven Vendors, Seven Definitions

Read ten articles about context layers and you’ll notice each one defines it as roughly the shape of the author’s product:

Source

A context layer is…

Where the semantic layer sits

Redis

“The part of your AI stack that decides what an agent knows at any moment” (memory, retrieval, caching)

One input below it

Atlan

A wrapper around the semantic layer adding “lineage, policy, decision precedents, and sensitivity rules”

Inside it

DataHub

An extension of semantic definitions with “when, how, and under what rules that meaning applies”

A peer

Cube

“The superset”

“The one part that actually executes”

a16z

A data context layer that should “become a superset of what a semantic layer would traditionally cover”

Inside it

Microsoft

An ontology that “provides a common context layer”

Ontology built from Power BI semantic models

Snowflake

Horizon Context: a governed context layer in its catalog

Semantic views are its semantic component

Underneath the noise there are two families of meaning:

  1. Runtime: how the right information gets into the model’s context window at each step (memory, retrieval, compression). This is closest to what AI engineers call context engineering.

  2. Enterprise knowledge: what business meaning, rules, and trust signals exist, and how they stay governed and current. This is what data teams mean.

An agent needs both. The knowledge has to exist, and it has to reach the model at the right moment.

What Goes in a Context Layer: Structure, Meaning, Trust

We organize a context layer into three parts, which is how Upsolve’s own context architecture is built.

Structure: What Data Exists

Tables and columns with descriptions, primary and foreign keys, approved joins, lineage, query history, and the allowed values of categorical columns. Much of it is what a good data dictionary already holds. Structure answers “where is this, and how does it connect?”

Meaning: What It Means Here

Canonical metric definitions (and your semantic model, if you have one), business vocabulary, analysis conventions, and institutional knowledge that today lives in Slack threads, Notion pages, and people’s heads. Meaning answers “what does ‘active customer’ mean at this company?”

Trust: What’s Verified and Allowed

Verified answers and golden SQL, certified sources, usage signals (which tables people actually rely on), freshness, and permissions enforced outside the model. Trust answers “can this answer be relied on, and is this person allowed to see it?”

A Real Example: OpenAI’s In-House Data Agent

The clearest public reference architecture comes from OpenAI. Its in-house data agent serves about 3,500 internal users across 70,000 datasets and more than 600 petabytes. It grounds answers in six layers of context:

  1. Table usage: schema metadata, lineage, and historical queries.

  2. Human annotations: domain experts’ descriptions of intent and caveats.

  3. Codex enrichment: code-level analysis of how each table is built.

  4. Institutional knowledge: Slack, Google Docs, and Notion, with access controls.

  5. Memory: saved corrections and non-obvious filters.

  6. Runtime context: live warehouse queries when context is missing or stale.

It’s evaluated with curated question-and-golden-SQL pairs run as regression tests. Mapped onto our three parts (our interpretation), layers 1, 3, and 6 are Structure, layers 2 and 4 are Meaning, and memory plus evals and access controls are Trust. One of OpenAI’s own lessons is worth quoting: “Less is More.” Overlapping tools confused the agent.

Context Layer vs Semantic Layer


Semantic layer

Context layer

Core question

“How is this metric calculated?”

“What does the agent need to answer this correctly and safely?”

Contents

Metrics, dimensions, entities, joins

Structure + meaning (including the semantic layer) + trust + unstructured knowledge

Executes?

Yes, compiles to SQL

Mostly descriptive; the semantic layer is its executable core

Primary consumer

BI tools and analysts (now also agents)

AI agents

Coverage

Only what’s been modeled

The long tail of questions nobody modeled

Typical failure

Dashboards disagree; question out of scope

Agent is confidently wrong, or acts without permission

Examples

dbt Semantic Layer, Cube, LookML, Snowflake semantic views, Databricks metric views

Snowflake Horizon Context, Databricks Genie Ontology, Fabric IQ, Upsolve

Is the Semantic Layer Part of the Context Layer?

Mostly, yes. Cube CEO Artyom Keydunov puts it this way: “The context layer is real, and it’s the superset.” The semantic layer is “the one part that actually executes.” Most other context, like descriptions, docs, and Slack history, is descriptive: “nothing here produces an answer or enforces a rule.” DataHub is the notable dissenter, treating the two as peers that both consume context from a separate platform.

Do You Need a Semantic Layer First?

No. A semantic layer makes the metrics it covers exact. dbt Labs’ 2026 benchmark shows 100% accuracy on in-scope questions. But it can’t help with questions outside its model, and most companies don’t have a maintained one. The more important finding is from the 2026 ablation study above: the semantic content (what things mean) does most of the work, and a structured, versioned contract beats pasting the same knowledge into a prompt. In that study, fee rules appeared in the generated SQL 98% of the time from the contract versus 4% from the prompt. You can start that contract from your warehouse. If you do want a semantic layer, our semantic layer tools comparison can help you choose.

Context Layer vs Ontology vs Knowledge Graph

These overlap heavily, and vendors use them interchangeably. Microsoft and Databricks both literally describe their ontologies as context layers. A useful way to separate them: an ontology is one way to structure the Meaning part (entities, relationships, rules), a knowledge graph is one way to store it with real instances, and the context layer is the whole governed body of knowledge an agent draws from, structured or not. For a deeper dive, see our guide to data ontology.

Context Layer vs Context Engineering

The two sound alike but describe different things:

  • The context layer is the asset: the stored, governed knowledge.

  • Context engineering is the runtime practice: choosing what goes into the model’s window at each step.

Anthropic defines context engineering as “the set of strategies for curating and maintaining the optimal set of tokens (information) during LLM inference”, with the goal of finding “the smallest possible set of high-signal tokens that maximize the likelihood of some desired outcome.”

The two depend on each other. Dumping the whole context layer into the prompt backfires. Chroma’s research on context rot found that performance “grows increasingly unreliable as input length grows” across 18 models. Drew Breunig catalogs how long contexts fail: poisoning, distraction, confusion, and clash. A great context layer with bad assembly fails, and great assembly with no context layer has nothing to assemble.

Does a Context Layer Actually Improve Accuracy? The Evidence

  • Independent ablation (2026): Across four models on the DABStep benchmark, adding semantic content raised hard-task accuracy from 13.9→55.1%, 22.6→56.6%, 22.9→68.4%, and 37.0→77.4%. Ungoverned agents issued 166 data-modifying statements; governed agents issued zero.

  • data.world (2023): GPT-4 answered 16.7% of enterprise questions over SQL vs 54.2% over a knowledge graph.

  • Cube (2026): A 4 KB semantic context document added 17–23 points across three frontier models. This was vendor research.

  • Databricks (internal): Genie with Ontology scored 84.5% vs 52.4% for a general-purpose coding agent on 28 enterprise questions. This is an internal benchmark.

The pattern: the model matters less than what it knows. And governance isn’t optional. Without it, agents don’t just answer wrong; they act wrong.

How to Build a Context Layer for AI, Step by Step

  1. Start from the questions, not the schema. Pull the 50 most-repeated data requests from Slack and your ticket queue. On Upsolve’s numbers, repeat questions make up 47% of a typical data team’s queue.

  2. Build the structure those questions need. Register only the relevant tables, with descriptions, keys, joins, and allowed values for categorical columns.

  3. Write down the meaning. Canonical definitions for every contested metric and term, plus the conventions an analyst would explain to a new hire.

  4. Add trust. Turn known-good answers into golden questions with verified SQL, run them as evals, and enforce permissions deterministically.

  5. Assemble just in time. Retrieve the context each question needs instead of loading everything into the prompt.

  6. Close the loop. Trace every conversation, surface where the agent lacked context, and version every change with drafts and rollback.

Where Upsolve Fits: A Context Layer Without a Semantic Layer

Upsolve’s Agent Studio is built around this architecture. Data Models, the first layer of the stack, holds Structure and Meaning: tables with descriptions and keys, canonical definitions in a versioned system prompt, and selectable columns whose values are pre-cached nightly. Permissions are enforced deterministically. Harness 2.0 traces every conversation end to end, and the built-in eval agent and context monitoring surface gaps so the context gets better with use.

No semantic layer is required. If you have dbt, bring it. If you don’t, start from your warehouse and add definitions as gaps appear.

Frequently Asked Questions

What is a context layer in AI?

A context layer is the governed knowledge an AI agent uses to answer questions about your business: which data exists and how it connects (structure), what metrics and terms mean (meaning), and which answers and sources are verified and permitted (trust). It sits between your data and your agents.

What is the difference between a context layer and a semantic layer?

A semantic layer defines how metrics are calculated and compiles them to SQL. A context layer is broader. It includes the semantic layer plus table structure, business knowledge from documents and conversations, verified answers, permissions, and freshness signals. The semantic layer is the context layer’s executable core.

How can I build a context layer for AI?

Start with the questions people actually ask, register the tables they need with descriptions and keys, write canonical definitions for contested metrics, add verified answers as evals, enforce permissions outside the model, and trace conversations to find gaps. Retrieve context per question rather than loading everything into the prompt.

What is the difference between semantics and context?

Semantics is meaning: what a term or metric represents and how to compute it. Context is everything surrounding that meaning that affects the right answer: who is asking, what they’re allowed to see, which source is current, and what was decided before.

Is a context layer just a rebranded semantic layer?

Partly, but not entirely. Much of what’s called a context layer builds on older ideas from semantic layers, catalogs, and knowledge graphs. What’s new is the consumer: AI agents need meaning, trust, and permissions at runtime, for questions nobody modeled in advance.

Do I need a semantic layer before building a context layer?

No. A semantic layer helps for the metrics it covers, but research shows business meaning (definitions, rules, descriptions) drives most of the accuracy gain. You can start from your warehouse with tables, keys, definitions, and allowed values, and add a semantic layer later.

Sources

  1. Gartner: Lack of Semantics Causes Inaccurate AI Agents and Wasted Spending (May 11, 2026). https://www.gartner.com/en/newsroom/press-releases/2026-05-11-gartner-says-lack-of-semantics-causes-inaccurate-artificial-intelligence-agents-and-wasted-spending

  2. Ye (arXiv, 2026): Which Part of the Context Layer Does the Work? Separating Semantic Content from Retrieval Scaffolding in Text-to-SQL Agents. https://arxiv.org/abs/2609.22259

  3. MotherDuck: Context, Semantics, and Ontology: A Primer for the Agentic Era (Sep 2026). https://motherduck.com/blog/context-layer-vs-semantic-layer-ontology/

  4. a16z: Your Data Agents Need Context (Mar 10, 2026). https://a16z.com/your-data-agents-need-context/

  5. Snowflake: Horizon Context: The Governed Context Layer (Jun 2026). https://www.snowflake.com/en/blog/horizon-context-governed-context/

  6. Databricks: Databricks launches Genie One (Jun 16, 2026). https://www.databricks.com/company/newsroom/press-releases/databricks-launches-genie-one-all-new-agentic-coworker-every-team

  7. Redis: What Is a Context Layer? (May 2026). https://redis.io/blog/what-is-a-context-layer/

  8. Atlan: Context Layer vs Semantic Layer. https://atlan.com/know/context-layer-vs-semantic-layer/

  9. DataHub: Context Layer vs Semantic Layer (Apr 2026). https://datahub.com/blog/context-layer-vs-semantic-layer/

  10. Cube: The context layer needs a semantic layer (Jul 2026). https://cube.dev/blog/the-context-layer-needs-a-semantic-layer

  11. Microsoft Learn: Fabric IQ ontology overview. https://learn.microsoft.com/en-us/fabric/iq/ontology/overview

  12. OpenAI: Inside our in-house data agent (2026). https://openai.com/index/inside-our-in-house-data-agent/

  13. dbt Labs: Semantic Layer vs. Text-to-SQL: 2026 Benchmark Update. https://docs.getdbt.com/blog/semantic-layer-vs-text-to-sql-2026

  14. Anthropic: Effective context engineering for AI agents (Sep 2025). https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents

  15. Chroma: Context Rot: How Increasing Input Tokens Impacts LLM Performance (Jul 2025). https://www.trychroma.com/research/context-rot

  16. Drew Breunig: How Long Contexts Fail (Jun 2025). https://www.dbreunig.com/2025/06/22/how-contexts-fail-and-how-to-fix-them.html

  17. Sequeda, Allemang & Jacob (arXiv, 2023): Knowledge graphs and LLM accuracy on enterprise SQL databases. https://arxiv.org/abs/2311.07509

  18. Rumiantsau & Fokeev (arXiv, 2026): Semantic Layers for Reliable LLM-Powered Data Analytics. https://arxiv.org/abs/2604.25149

  19. Upsolve AI: Data Models. https://upsolve.ai/features/data-models

Try Upsolve for Embedded Dashboards & AI Insights

Embed dashboards and AI insights directly into your product, with no heavy engineering required.

Fast setup

Built for SaaS products

30‑day free trial

See Upsolve in Action

Launch customizable dashboards and AI‑powered insights inside your app, fast and with minimal engineering effort. No code.

Follow us

Related Articles

Stop answering the same 10 questions today.

The Platform for Accurate, Reliable, and Trustworthy AI Analytics.

Agent Studio for Data Teams. Encode context. Deploy agents. Deliver clarity.

© 2026 Upsolve AI, Inc.  

|