For architects choosing how to give agents knowledge of the business.
Updated
Use a semantic layer when you need governed, consistent metrics over structured data. Use RAG when an assistant should answer from a body of documents. Use agent memory when an agent should remember a user's preferences and past sessions. Use a context layer when several agents need one reviewed, shared model of how the business works, spanning schema, documents, events and procedures. They overlap, and many teams use more than one.
A semantic layer defines metrics and dimensions once over structured data so every tool computes them the same way. Strong for consistent numbers. Failure mode: it only covers what has been modeled in it, so documents, events, rules and procedures are outside it, and it does not say which table or policy an agent should use for a question that is not a metric.
RAG retrieves passages from a corpus at query time and gives them to the model. Strong when the answer is written in a document, and simple to start. Failure mode: it returns text, not definitions. Two documents can disagree, an old one can outrank a new one, and nothing records which wins or that a term means something specific in your business.
Memory stores what an agent or user said or learned so a later session can use it. Strong for personalization and continuity. Failure mode: it is usually per user and per tool, and unreviewed, so one person's wrong note persists and a colleague's agent never sees what yours learned.
A context layer holds a reviewed, shared model of the business: structure, documents, events and procedures, served to every agent. Strong when meaning lives in people's heads and several agents need the same view. Failure mode: it needs setup and curation, its quality depends on your sources and on people reviewing what ingestion proposes, and it does not replace your systems of record or your guardrails.
| Scenario | Best fit | Why |
|---|---|---|
| Dashboards and agents must agree on revenue | Semantic layer | Governed metric definitions over structured data |
| An assistant answers questions from a policy handbook | RAG | The answer is in a passage of text |
| An assistant remembers a user's preferences across sessions | Agent memory | Per-user, session-spanning state |
| Several agents need to know which table backs which entity and which rules apply | Context layer | Shared, reviewed structure plus documents |
| You need to know what was decided or what happened about an account | Context layer | Traces and briefs tied to entities |
| One agent, a few documents, low change | RAG | Simplest thing that works |