← Blog
Guides

What Is a Context Layer for AI Agents?

A context layer for AI agents (also called a business context layer) is the governed layer between your business systems and your AI that tells agents what the data means: which records are the same customer, how metrics are defined, which rules apply, where an answer came from, and what changed over time. Access protocols like MCP let an agent reach your data; a context layer lets it understand that data the way your business does.

TL;DR: the five layers of business context

  • Semantic: what a metric or term means at your company
  • Entity: which records across systems are the same customer
  • Policy enforcement: which rules and permissions apply to a question
  • Lineage: where an answer came from
  • Memory: what happened before, and what changed

Riley builds all five on top of your existing systems and delivers them to Claude, ChatGPT, Copilot and your own agents through Riley MCP.

One question, four correct answers

Ask your AI "How many active customers do we have?" and it will give you a confident number. The trouble is that four of your systems each hold a different one, and each is right on its own terms:

SourceActive customersWhat "active" means there
CRM1,204Has an open subscription
Warehouse1,150Counted in last night's model run
Billing1,061Billed in the last 30 days
Support987Logged in this month

That is 217 customers apart. Your AI picks one source, and it does not tell you which.

This is the question revenue teams keep bringing us. They connected Salesforce, Snowflake and Zendesk to Claude, and the answers sound right but don't match what finance reports. Usually the data isn't wrong. The AI is using the wrong definition, missing a relationship, or reading the wrong time window. AI often exposes a context problem that looked like a data problem.

Access is not understanding

Most teams solve access first, and they should. MCP servers, APIs and connectors tell an agent where the data lives (does MCP make AI accurate?). They don't tell it what the data means for your company.

We use a simple model with every customer:

LayerWhat it answersExamples
4. AI (reasoning)"Given all this, what should we do?"Claude, ChatGPT, Copilot, your agents
3. Context (Riley)"What does this data mean here?"Definitions, entities, rules, lineage, history
2. Access"Where does the data live?"MCP, APIs, ETL, connectors
1. Business systems"What happened?"CRM, billing, product usage, support, calls

MCP gives AI access to your business. Riley gives it the context to understand your business.

The gap gets wider as you add agents, not narrower. If 100 agents each decide for themselves what "revenue", "at risk" or "healthy" means, you get 100 versions of reality. One uses logins, one uses product events, one uses CRM status. Each answer is plausible, and none agree. Agents shouldn't each rebuild the business. They should share one context.

There's a cost angle too. Sending raw tables to a model on every question burns tokens on context that never changes the answer. Turning data into governed signals before it reaches the model keeps prompts small and answers consistent.

The five layers of business context

A context layer sits between your enterprise data and the AI that reasons over it. Most definitions break it into five layers. Each answers a different question an agent can't answer from raw data alone.

LayerThe question it answersWhat breaks without it
SemanticWhat does this metric or term mean here?Two agents report two different ARR numbers
EntityAre these records the same thing?The same customer counts three times across CRM, billing and support
Policy enforcementWhich rules apply to this question?An agent improvises a pricing or forecast answer from the wrong source
LineageWhere did this answer come from?Nobody can check or reproduce the number when it's questioned
MemoryWhat happened before, and what changed?Every conversation starts from zero

Semantic is the shared vocabulary: canonical definitions of metrics, dimensions and business terms, so an agent and an analyst pulling "active customers" get the same number.

Entity is identity: knowing that the account in the CRM, the payer in billing and the requester in support are one customer. Mapped together, these relationships form a context graph. It's easy to describe, expensive to build, and the most under-invested part of most data stacks.

Policy enforcement is the rulebook: how specific kinds of questions must be handled, which sources are certified, and who is allowed to see what. The agent doesn't get to pick, which is what keeps its answers grounded.

Lineage is the audit trail: which sources, which transformations and how fresh the data was behind every answer. In regulated industries it isn't optional.

Memory is the record of the past: earlier states, decisions and signals, so an agent can reason about change instead of a single snapshot.

These layers matter because context is limited. As Anthropic puts it, context "must be treated as a finite resource with diminishing marginal returns." A context layer decides what's worth sending to the model, instead of sending everything.

How Riley builds each layer

The five layers are the easy part to list. The hard part is running them on a real company's data, where the same customer has three IDs and every team defines "active" differently. Here's how Riley does it, layer by layer.

Diagram of a context layer for AI agents: enterprise data (structured, unstructured, 3rd party) flows into five context layers (semantic, entity, policy enforcement, lineage, memory), which Riley builds with Knowledge, the data model, governance, citations and health signals, feeding AI agents, ML models, analytics, automated decisions and human-in-the-loop review, with governance across every layer

1. Semantic: one definition, used everywhere

How Riley does it: in Riley Knowledge, your team writes business definitions once: ARR, NRR, active customer, churn, adoption, plus your own acronyms and terms. Riley passes them as context to every analysis and every connected AI, so answers reflect how your team actually talks about the data. When Riley syncs a source, it also assigns each column a role (time, grouping or measure) and writes descriptions for every table and column. Change a definition once, and every health score, forecast and Claude answer uses the new one.

2. Entity: the same customer, everywhere

How Riley does it: Riley finds the joins between your tables itself and verifies each one by value overlap and key distinctness, then shows the result as a map of how your data fits together. In one workspace, Riley found 5 joins across 6 tables, so a question could span HubSpot companies, deals and support cases without anyone writing the join.

3. Policy: rules the agent can't improvise around

How Riley does it: your business rules (what counts toward revenue, which accounts qualify for expansion, what healthy adoption means) live in Riley as governed logic, not inside prompts or someone's spreadsheet. Permissions and governance are enforced on every interaction, including when Claude or GPT pulls context through Riley MCP. The model gets the approved context, not the raw tables.

4. Lineage: every answer shows its work

How Riley does it: every Riley answer carries citations back to the records behind it, and every health score breaks down into the signals and weights that produced it. Sync activity shows exactly what Riley did with each source. In one sync, that meant 1,615 records pulled across 3 object types, 18 columns validated and typed, 9 low-signal columns pruned, and 2 foreign keys connected. When a number is questioned, you can trace it in seconds.

5. Memory: knowing what changed, not just what's true

How Riley does it: this is where Riley goes past a lookup table. Most memory layers store past decisions and retrieve them on request. Riley also keeps every signal over time: usage trends, support spikes, stakeholder engagement, score history. So an agent can answer "what changed, and why now?" Health scores are recalculated as new data arrives and explain why they moved.

What it looks like in practice

An e-commerce technology company had customer data spread across Salesforce, Intercom and BigQuery, and no single view of customer health. With Riley, those sources became one customer intelligence layer with health scores updated in near real time. When a score changes, Customer Success sees the evidence behind it and acts before the renewal is at risk.

Read the full story on Riley's customer stories.

Could you build it yourself?

Probably, if you have the team. Sophisticated AI teams are already building semantic layers and entity models, which proves the category is real. The question is whether that's where you want your AI engineers spending their time.

To match a context layer in-house, you'd need to build and then keep running:

  • Entity resolution across every GTM system
  • A semantic layer with versioned definitions
  • Continuous ingestion that survives schema changes
  • Lineage from every answer back to source records
  • Signal history at the account level, over time
  • Permissions and governance for every AI tool that reads it
  • Delivery to each model and agent (MCP, APIs)

Then maintain it: new sources, definition changes, drift, on-call. The real cost isn't the first build. It's every quarter after. Riley gives teams that infrastructure ready-made, so they can spend their time on the agents and decisions on top of it.

When you don't need a context layer: if all you want is to summarize calls, search Salesforce or chat with a PDF, MCP, RAG or a workflow tool is enough. The need shows up when AI starts making judgments (who's at risk, where to invest) across several systems.

How to start: one question, not a platform project

Don't start with a data-infrastructure roadmap. Start with one business question your AI should answer correctly, such as "Which accounts are most likely to expand this quarter?"

  1. Write down what your best analyst would need to answer it: usage, CRM history, support, contract dates, past expansion patterns.
  2. Connect those two or three sources to Riley with Managed Sync, on your own or with our team.
  3. Add the definitions that matter to that question in Riley Knowledge (what "expansion" and "active" mean for you).
  4. Let Riley map the entities and build a health model, then check the evidence behind its first answers.
  5. Connect Riley to Claude through MCP and ask the same question there.

Most teams get a first trustworthy answer in days, then add sources and questions on top of the same context. For a longer walkthrough, see how to give AI business context or how Riley works as an AI context layer.

Ready to try it? Build your context layer or book a 20-minute walkthrough.

FAQ

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

A semantic layer standardizes what metrics and dimensions mean. A context layer includes that and adds identity resolution, relationships, business rules, lineage, history and delivery to AI. The semantic layer is one part of the context layer.

Is MCP a context layer?

No. MCP is an access protocol: it lets an AI tool reach your systems. A context layer sits behind that access and tells the AI what the data means. Riley delivers its context to Claude, ChatGPT and Copilot through MCP.

Why do our AI pilots keep giving wrong answers about our business?

Usually the data isn't wrong. The AI is missing business context: which definition to use, which records are the same customer, or which time period applies. Fixing that context, not the prompt, is what makes answers consistent.

How do I keep AI answers in sync when business definitions change?

Keep definitions in one governed place that every AI reads from, instead of inside prompts. In Riley, you change a definition once in Knowledge and every analysis, health score and connected AI uses the new version.

How do I get started giving AI business context?

Pick one business question, connect the two or three systems that answer it, write down the definitions it depends on, and check the first answers against their sources. Then expand from there.

Does a context layer replace our data warehouse or BI tools?

No. It sits on top of the systems you already have, including Snowflake, BigQuery and your CRM, and makes them usable by AI. Your warehouse stays the store of record.

Can a context layer reduce AI costs?

Yes. Sending governed signals instead of raw tables keeps each prompt smaller, so models process fewer tokens for the same or better answer.

Resources