Skip to content
NEW BLOG

Using Surrealism to build your own extensions

Read blog

1/2

The context wall whitepaper hero illustration

Why AI agents need a
multi-model foundation

Beyond knowledge graphs to real-time contextual reasoning.

Enterprise AI initiatives in 2026 share a common failure pattern. The cause is not the model. It is the architecture beneath the model. As the initial hype surrounding Large Language Models matures into the deployment of autonomous agents, enterprises are hitting a “Context Wall.” While LLMs provide the reasoning engine, they lack a persistent, structured, and real-time memory layer. This paper introduces the Enterprise Semantic Foundation (ESF) — a unified, multi-model substrate that merges the stability of Knowledge Graphs with the dynamism of Context Graphs. It argues that the next leap in AI utility will not come from larger models, but from a shift in data architecture.

EXECUTIVE SUMMARY

The problem

LLMs are stateless; RAG is a temporary patch. Agents need 'living' memory. Current attempts rely on fragmented 'frankenstacks' — disparate vector, graph, and document databases stitched together with complex glue code.

The thesis

Traditional single-model stores and fragmented data platforms are structurally misaligned with the requirements of agentic state. The bottleneck is architectural, not model-related.

The solution

A unified 'Context Graph' built on a multi-model foundation that treats storage as an active participant in reasoning — not a passive retrieval layer.

INTRODUCTION

From static graphs to active context

Enterprise infrastructure has evolved through three distinct generations. Each subsumes the previous one rather than replacing it. A well-designed context graph anchors itself to the canonical facts of a knowledge graph and the governed definitions of a semantic layer.

The semantic layer

Hand-built YAML definitions and LookML models that mapped business terms like “revenue” and “churn” to specific SQL queries. Semantic layers brought discipline to analytics, but they were static, manually maintained, and brittle. When a team member left or a product line launched, the definitions went stale.

The knowledge graph

Structured representations of what an organisation knows, encoded as nodes and relationships. Knowledge graphs brought relational structure to enterprise data — ontologies, entity resolution, and canonical facts. They remain powerful tools for search, recommendation, and retrospective analysis.

The context graph

A live, transactional representation of what is happening right now, enriched with the semantic meaning of why it matters. The context graph captures state: the agent's current goals, its observations, the relationships between the entities it is reasoning about, and the situational relevance of everything in its environment.

The architectural challenge is building a foundation that can hold all three — static definitions, stable facts, and dynamic state — in a single, unified, transactional system.

THE 2026 ENTERPRISE REALITY

Hitting the wall

Nearly every organisation with a data team attempted to deploy some form of agentic workflow in 2024 and 2025: a customer support agent, a data analyst, an internal knowledge assistant. Most of those efforts failed.

Failed pilots

Agents struggled to answer basic questions correctly. “What was revenue growth last quarter?” produced wrong answers, not because the model could not reason, but because the agent lacked the context to understand how revenue was actually defined in that organisation, which tables were authoritative, and how the definition had changed since a team member left.

Cost and governance

Running a production agentic system on a “frankenstack” of four specialist databases means paying for four sets of infrastructure, managing four data synchronisation pipelines, enforcing access controls across four systems, and debugging failures that span all of them. Procurement teams are asking for consolidation.

Architecture, not models

Models have improved. The context problem has not. Longer context windows do not solve the fundamental issue: an agent that cannot access reliable, structured, real-time context will hallucinate, contradict itself, and fail to coordinate with other agents regardless of how capable its underlying model is.

THE ARCHITECTURE OF AGENCY

Why AI needs a context layer

The shift from human-driven analytics to autonomous agency introduces a fundamentally different set of requirements. Humans query data to find insights. Agents query data to decide what to do next. That distinction changes everything about how a data architecture must behave.

The read-think-write loop

An AI agent operates through a continuous cycle: perceive the environment, reason over memory, commit an action or observation back to storage. This loop runs in milliseconds, and it never stops.

Modern data platforms are optimised for analytical throughput. They are designed to answer questions about the past at scale. Fast ingest makes data queryable quickly; it does not provide the ability to lock a record, mutate it, and guarantee that the next agent in the loop reads the updated value within the same millisecond window. That requires read-after-write transactional consistency — a property that streaming ingest architectures are not designed to deliver.

SurrealQL

Multi-model query

Graph

Vector

Temporal

Unified result set

Result set

Multi-model query output

Documents

Relations

Vectors

History

Complete context

BEGIN TRANSACTION

ACID transaction boundary

Update

Create

Trigger

COMMITTED ✓

The state problem

Agents are not stateless. They track goals, monitor sub-tasks, and maintain a working memory of their progress. When an agent is coordinating a complex workflow, it must be able to lock a resource, update a belief, and trigger a downstream action — all within a single consistent operation. This requires ACID compliance and granular transactional control. Analytical platforms are not built for this. They are built to tell you what happened. Agents need infrastructure that shapes what happens next.

The missing layer: context

What is missing from every existing data architecture — whether a traditional warehouse, a modern lakehouse, or a distributed data mesh — is a dedicated context layer. A context layer is an active, low-latency, transactional substrate that holds the live state of an agent's understanding: what it knows right now, what it is currently doing, and how that relates to everything else in the system.

The context layer must live at the database layer, not above it, because only at the database layer can context be kept consistent, governed, secured, and transactionally unified with the canonical knowledge that grounds it.

How context gets built

Context enters the system through multiple channels: automated pipelines that ingest canonical data from existing warehouses and semantic layers, agent-generated observations written back during the read-think-write loop, human-curated business definitions and rules contributed by domain experts, and self-updating flows where agent corrections are incorporated back into the context graph.

A multi-model foundation supports all of these ingestion patterns natively. Canonical facts arrive as structured documents. Relationships between entities are expressed as graph edges. Semantic embeddings are stored alongside the data they describe. Because all three models exist in the same transactional system, an update to a business definition, its relationships, and its embedding can be committed atomically — eliminating the synchronisation gaps that plague fragmented architectures.

THE CONTEXT LAYER

Why multi-model wins

The transition from Large Language Models to Autonomous Agents represents a shift from “stateless inference” to “stateful reasoning.” In many current architectures, memory is fragmented across a “frankenstack” of specialised databases — a vector store for similarity, a graph database for relationships, and a relational or document store for metadata. This fragmentation imposes a significant “Cognitive Tax” on the agent and a “Semantic Tax” on the developer.

The fragmented memory tax

When an agent's memory is split across multiple systems, the unification of that data happens at the application layer. This creates several architectural bottlenecks.

App state

User session

Vector DB

Embeddings

Graph DB

Relations

Doc store

Documents

Auth

Identity

Data fragments at every system boundary

Agent

Vector DB

Graph DB

Doc store

Auth

Total

Cumulative latency

Latency of reconstruction

Every time an agent needs to 'remember' something, it must make multiple asynchronous calls to different APIs, wait for the results, and then use application logic to join that data together. In an autonomous loop, these milliseconds compound into seconds of 'thinking' time.

Semantic drift

When a document is updated in a NoSQL store, but its corresponding vector embedding in a separate store isn't refreshed, or its relationship in a graph database remains stale, the agent begins to reason over contradictory information.

Loss of dimensionality

A standalone vector search can tell an agent that 'Product A is similar to Product B,' but it cannot easily explain why — the relationship — or show the structured constraints — the price, the stock, the owner — without a complex multi-stage join.

Consistency boundaries

Each system has its own consistency model. The agent's view of the world depends on which system it queries and when — non-deterministic behaviour invisible in development, catastrophic in production.

Why memory middleware is not enough

Products such as Mem0 provide a useful abstraction layer, but are built on top of the same fragmented infrastructure: a vector store for semantic retrieval, optionally a graph layer for relationship tracking, and a relational store for metadata. The abstraction hides the complexity from the developer, but it does not eliminate it. When context changes in one underlying system, synchronisation to others is not guaranteed. The semantic drift problem persists underneath the abstraction.

Memory middleware treats context as something to be retrieved and injected into a prompt. It does not treat context as a live, transactional substrate that the agent reasons within. For autonomous agents coordinating complex workflows with enterprise governance requirements, the foundation must be deeper.

Vector DB

Similarity search

auth

config

monitor

Graph DB

Relationship store

auth

config

monitor

Doc store

Raw document index

auth

config

monitor

Auth service

Identity & tokens

auth

config

monitor

Cache layer

Hot key store

auth

config

monitor

Five systems. Five auth configs. Five things to scale, secure, and keep alive.

The multi-model advantage: atomic context

A native multi-model foundation — where the database engine treats documents, graphs, and vectors as first-class citizens of the same storage layer — solves the memory problem by providing atomic context. A single “memory” is not a collection of pointers across different systems; it is a unified record.

From “pointers” to “rich edges”

In a traditional graph database, an edge is a simple line between two nodes. In a multi-model semantic foundation, edges are documents. An agent can traverse a relationship and find, embedded directly within that link, the vector embedding of the last interaction, the JSON metadata of the permissioning logic, and the relational history of the connection. The agent fetches a “complete thought” in one operation.

Reduced cognitive load

By eliminating the boundary between the “what” (document), the “how it relates” (graph), and the “what it's like” (vector), agents are provided with a memory layer that mirrors human cognition: interconnected, multidimensional, and instantly accessible.

Single transaction

Vector DB

Write embedding

Graph DB

Write relation

committed

inconsistent state

rolled back

CONTEXT GRAPH SUPPORT

Knowledge vs. experience: the static and the fluid

Most enterprises have spent the last decade building Knowledge Graphs as “dictionaries of truth.” They are excellent at defining what a company knows, but they are remarkably poor at helping an agent decide what to do now.

The knowledge graph (the map)

Contains stable, ontological facts. “Product X is a subscription service,” “User Y lives in New York,” “London is a city.” These are high-trust, low-velocity data points.

The context graph (the journey)

Contains ephemeral, situational relevance. “The agent is currently troubleshooting Product X for User Y, who is frustrated because of a recent billing error.” For an AI agent, the “truth” of the Knowledge Graph is useless without the “relevance” of the Context Graph.

Why native graph support matters for agency

Modern vector databases such as Pinecone, Chroma, and Weaviate now support metadata filtering, hybrid search, and namespace scoping. These are genuine improvements. However, they remain fundamentally flat: they can tell an agent that two things are semantically similar, but they cannot model the structured relationships between entities, enforce transactional consistency across updates, or traverse impact paths through a connected graph. Similarity is not context.

Consider a concrete example. An agent monitoring a production system receives an alert about a failing API endpoint. With a vector database, the agent can search for documentation semantically similar to the error message. Useful, but shallow. With a graph-capable multi-model database, the agent can traverse from the failing endpoint to the upstream service that depends on it, to the team that owns that service, to the on-call engineer currently assigned, and simultaneously retrieve the vector-embedded runbook most relevant to this specific failure mode — all in a single query.

The structural traversal and the semantic search are not two separate operations stitched together in application code; they are one atomic operation.

Relationship over similarity

A vector search might find a manual about 'Server Errors.' A graph-native query finds the specific server that is down, the upstream services it impacts, and the on-call engineer currently assigned to it.

The impact radius

When an event occurs, an agent can 'walk the graph' to see how far the ripples go. This is a structural calculation that flat data structures cannot perform efficiently.

Filtered reasoning

By using the graph as a native layer, agents can prune their search space. Instead of searching 'all documents,' the agent follows the edges: 'Search only the documents related to the specific version of the software this user is running.'

MULTI-AGENT SHARED STATE

Solving the shared state problem

As AI moves from single-task assistants to Multi-Agent Systems, the architectural challenge shifts from individual memory to shared state. When multiple agents — each with specific roles like “Researcher,” “Coder,” or “Reviewer” — work together, they require a common area where the current state of a task is visible, verifiable, and actionable by all participants.

The “blackboard” pattern

In many early multi-agent frameworks, agents communicate via direct message passing. This creates a “telephone game” effect: context is lost, versions diverge, and the source of truth becomes a moving target. A multi-model database acts as the central blackboard. Instead of agents telling each other what they found, they commit their findings to the shared context graph.

Why a database, not a platform

Analytical platforms are optimised for massive, high-latency scans. Agents operate in loops — they need to read a state, make a decision, and write a result in milliseconds. A warehouse “commit” can take seconds or minutes to be visible to other agents. Agents need transactional locking and live queries, not eventual consistency.

The agentic race condition

Without a robust database layer, multi-agent systems fall victim to the “Agentic Race Condition” — where Agent A acts on information that Agent B is currently changing. ACID transactions with snapshot isolation ensure each agent reasons over a consistent view. Committed writes from one agent are immediately visible to subsequent transactions from other agents.

The “live” requirement

In a multi-agent environment, agents should not have to keep asking “Is it done yet?” A modern database supports live queries. When the “Coder” agent finishes a script and writes it to the database, the “Reviewer” agent is instantly notified by the database itself.

THE COMPETITIVE LANDSCAPE

What else is being built

The market has recognised the context problem. Several architectures are competing to answer the question of where the context layer should live. Understanding the distinctions matters for any organisation making infrastructure decisions.

Memory middleware: Mem0

The most widely deployed product in the adjacent “AI memory” space, with over 80,000 developers on its cloud platform. Its approach is to provide a managed memory abstraction layer over existing storage infrastructure. The architectural limitation is that memory middleware sits above the storage layer rather than within it. The semantic drift problem is not eliminated; it is managed. Treating memory as a retrieval layer is a different paradigm from treating memory as a live operational substrate.

Document databases: MongoDB Atlas

MongoDB has added vector search and graph traversal capabilities to its document-first platform. The key distinction is that these multi-model capabilities are additive rather than architecturally unified. Vector search runs on a separate process that is not part of the same ACID transaction as document writes — creating the same consistency risks as a fully fragmented stack.

Vector databases: Pinecone and Chroma

Both are significantly more capable in 2026 than when RAG architectures first emerged. Both support metadata filtering, hybrid search, sparse-dense retrieval, and namespace-based isolation. Yet no vector database can provide structured relationship traversal, transactional consistency across model types, or the ability to model impact, causality, and proximity rather than just semantic similarity. These are architectural properties, not feature gaps.

Data platforms: Databricks and Snowflake

Databricks Lakebase represents a genuinely new architecture: compute separated from storage, data in open formats, serverless Postgres with instant branching. Their data gravity is a meaningful advantage. The distinction is design intent: these platforms are not optimised for the high-frequency transactional read-think-write loop of an autonomous agent, nor the rich edge model that allows an agent to traverse a relationship and find an embedded vector in the same operation.

SurrealDB occupies a distinct position. The context layer does not live above the database as a middleware abstraction, nor inside an analytical platform as a bolt-on feature. It lives in the database itself, as a native property of a storage model that treats graph, vector, and document as first-class citizens of the same transactional system.

THE ARCHITECTURE

Towards an Enterprise Semantic Foundation

The Enterprise Semantic Foundation (ESF) is the architectural response to semantic drift. It is not a single database or a rigid schema; it is a unified, multi-model substrate that serves as the common language for the entire organisation.

Applications
Spectron
Spectron
Memory
Entity extraction
Knowledge graph
Temporal facts
Hybrid retrieval
SurrealDB
SurrealDB
Context
Documents
Graphs
Vectors
Time-series
Auth
APIs
SurrealDS
Storage
Storage
TAPIR consensus
Compute-storage sep.
Scale to zero
SurrealDS
Object Storage (S3 / GCS / Azure Blob)

Anchoring canonical meaning

The Foundation utilises the Knowledge Graph to house high-integrity, governed facts — the 'Gold Standard' data that has passed through traditional ETL and quality checks.

Activating real-time meaning

The Context Graph captures the high-velocity, 'lived experience' of AI agents. Because these exist in the same multi-model system, the context is always anchored to the canonical truth.

Unified access control

Permissions are defined once at the data layer. Whether an agent is performing a vector similarity search, a graph traversal, or a document lookup, the database enforces the same security constraints.

Explainable AI

Because relationships are first-class citizens, the path an agent took to reach a conclusion is traceable. You can query the graph to see exactly which contextual edge led to a specific decision.

Solving the security and governance paradox

In a traditional “frankenstack” — vector store + graph store + document store — enforcing security is an operational nightmare. If a user's permissions change, those changes must be propagated and synchronised across three or four different systems simultaneously. If the synchronisation lags, an AI agent might inadvertently “remember” or “reason” over sensitive data it is no longer authorised to see.

An Enterprise Semantic Foundation solves this through record-level and field-level permissions native to the database.

The end of semantic drift

By moving semantics from the application code (where it is hidden and fragmented) into the database (where it is transparent and shared), organisations create a “self-describing” data environment. The database does not just store bytes; it stores intent. When a new agent is deployed, it does not need to be “trained” on how to interpret the data; it simply queries the Enterprise Semantic Foundation to understand the relationships, constraints, and context inherent in the system.

Integration, not replacement

A production context layer cannot exist in isolation. Enterprise data lives in Snowflake, Databricks, S3, and dozens of operational systems. SurrealDB is designed to complement existing data platforms. Canonical data from warehouses and lakehouses flows into the context graph through standard ingestion pipelines. Agents query the context layer for real-time state and relationships, while analytical workloads remain on the platforms best suited for them.

This is not a rip-and-replace proposition. It is an architectural addition: a transactional, multi-model layer purpose-built for the operational requirements that analytical platforms were never designed to meet. The data platform answers “what happened.” The context layer answers “what should happen next.”

Developer experience and time-to-value

Single query language

SurrealQL handles document operations, graph traversals, vector search, and access control in one language, eliminating the need to learn and integrate multiple query syntaxes.

Flexible schema

Tables can operate in schemaless mode for rapid prototyping, then transition to schemafull mode as the data model stabilises, without migration overhead.

Embedded to distributed

The same SurrealDB binary runs as an embedded library, a single-node server, or a distributed cluster backed by cloud object storage, allowing teams to start small and scale without re-architecture.

Native SDKs and protocol support

SDKs for Rust, JavaScript, Python, Go, Java, and .NET, along with HTTP and WebSocket APIs, allow integration with any existing agent framework.

CONCLUSION

The architecture of the agentic era

The first generation of graph databases solved the problem of interconnected data for human analysts. The next generation must solve the problem of interconnected reasoning for AI agents.

The leap from simple RAG to true autonomous agency requires a move away from static data warehouses, fragmented specialty stores, and analytical platforms that were never designed for real-time agentic state. It demands a multi-model Enterprise Semantic Foundation — a system where the graph provides the structure, the document provides the substance, and the vector provides the intuition.

The market is beginning to understand this. Specialist databases are addressing parts of the problem. Memory middleware is abstracting over the fragmentation. Data platforms are building context features on top of existing products. Each of these efforts is moving the industry forward. But none of them solve the problem at the foundation level, where graph, vector, and document exist as a single unified transactional model, governed by a single permission system, queryable in a single language, and consistent within a single transaction.

SurrealDB was built specifically for this transition. The context layer will live in the database. The question is which database is ready for it.

TECHNICAL APPENDIX

Implementing semantic context with SurrealDB

To illustrate how a multi-model foundation simplifies agentic workflows, the following examples show how SurrealQL collapses complex operations into single, atomic queries.

A. The “Rich Edge” (Graph + Document)

Instead of just a pointer, an edge in SurrealDB can store the full context of an interaction, including the vector embedding of the sentiment.

-- Relate an agent to a user with a rich edge
-- containing metadata and vectors
RELATE agent:researcher->interacts_with->user:customer123
SET
time = time::now(),
topic = "Billing Dispute",
sentiment_score = 0.2,
-- Store the embedding for semantic retrieval
context_embedding = [0.12, 0.45, -0.31, ...],
summary = "User frustrated regarding double-billing on invoice #55";

B. The unified search (Vector + Graph)

An agent can find “Similar Memories” (Vector) but immediately filter them by “Established Relationships” (Graph).

-- Find interactions similar to current context,
-- but only for a specific product
SELECT * FROM interacts_with
WHERE context_embedding <|2|> [0.12, 0.45, ...]
AND out.purchased_product = product:enterprise_saas
AND time > time::now() - 30d;

C. Live queries for multi-agent sync

Instead of polling a warehouse, agents subscribe to changes in the shared state.

-- A 'Supervisor' agent listens for any sub-task
-- being marked as 'Completed'
LIVE SELECT * FROM task
WHERE status = 'Completed'
AND project = project:ai_migration;

GET STARTED

Build on the context layer

The context layer will live in the database. Start building on the Enterprise Semantic Foundation.