<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mark Gyles</title>
    <description>The latest articles on DEV Community by Mark Gyles (@mgyles).</description>
    <link>https://dev.to/mgyles</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1602559%2Ff82af600-3936-4f4a-a067-dfee7a3228d4.jpg</url>
      <title>DEV Community: Mark Gyles</title>
      <link>https://dev.to/mgyles</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mgyles"/>
    <language>en</language>
    <item>
      <title>How to build a context layer for AI agents</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Wed, 25 Nov 2026 20:52:46 +0000</pubDate>
      <link>https://dev.to/surrealdb/how-to-build-a-context-layer-for-ai-agents-4b6f</link>
      <guid>https://dev.to/surrealdb/how-to-build-a-context-layer-for-ai-agents-4b6f</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/IgnacioPaz87" rel="noopener noreferrer"&gt;Ignacio Paz&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A context layer is the part of your stack that gives every AI agent the facts it needs: current, connected, permissioned and traceable to a source. To build one, model your business as typed entities and relationships, and bring your systems of record into one store. Enforce permissions inside every query, keep the history of every fact, and give agents a single interface to reach it all.&lt;/p&gt;

&lt;p&gt;This guide walks through why agents need a context layer, how it supports context engineering, why the usual approach fails in production, and how to build one in eight steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agents are only as good as the context they are given. The model supplies the intelligence, and everything it reasons about has to be supplied to it.&lt;/li&gt;
&lt;li&gt;Most teams stitch context together from several separate stores, such as a vector database, transactional databases, a data platform and a graph database. The failures live in the seams between those stores, reducing accuracy, increasing LLM token usage, and impacting performance.&lt;/li&gt;
&lt;li&gt;A governed context layer can answer four questions about every fact: who could see it, where it came from, when it held, and what was kept out.&lt;/li&gt;
&lt;li&gt;Those four answers let security and legal approve more data for AI, which is where the value is.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is a context layer, and how does it fit context engineering?
&lt;/h2&gt;

&lt;p&gt;A context layer is the shared system that holds what your agents need to know and serves the right slice of it to each agent at the right moment. It sits between your systems of record and your agents. Context engineering is the practice of getting the right data, with the right permissions, to an agent at the right moment. The context layer is the infrastructure that context engineering runs on.&lt;/p&gt;

&lt;p&gt;Context covers far more than documents. An agent doing real work needs facts too fresh for the model's training data. It needs to know who the user is and what they prefer. It needs the thread of the conversation, the state of the task, and a record of what it did earlier. Retrieval-augmented generation (RAG) is one tap into that material.&lt;/p&gt;

&lt;p&gt;Context also comes in two kinds. Some matters only for the next step, like the document open right now. The rest has to persist: who the customer is, what turned out to be true, what the agent learnt last week. That second kind is memory, and it is harder, because it accumulates, ages and contradicts itself.&lt;/p&gt;



&lt;h3&gt;
  
  
  Why not put everything in the prompt?
&lt;/h3&gt;

&lt;p&gt;Context windows keep growing, so it is tempting to send everything on every call. The prompt is rebuilt each time, so you pay again for every token on every turn. Models also attend unevenly to long inputs, and the one fact you needed gets lost in the middle. The memory features built into assistants such as ChatGPT and Claude do not close the gap either. They remember one person's preferences inside one product, and that memory does not travel to your other agents or to another model. It knows nothing about your systems of record. It also gives security no way to see who can read a fact, where it came from or when it stopped being true.&lt;/p&gt;

&lt;p&gt;The prompt is where context is used. A context layer is where it lives.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do agents need a context layer now?
&lt;/h2&gt;

&lt;p&gt;Large organisations are moving agents from pilots into production: copilots, support, operations and compliance. In a pilot, a person reads every answer and catches the wrong ones. In production, the agent acts on its own conclusions, and a wrong fact turns into a chain of confident, wrong decisions.&lt;/p&gt;

&lt;p&gt;A memory that is missing fails loudly, and you fix it. A memory that is wrong fails quietly. Four failures cause most of the damage:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Entity collision.&lt;/strong&gt; Two suppliers with similar names merge into one, and the payment terms of one attach to the other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Silent overwrite.&lt;/strong&gt; A new value replaces the old one, so nobody can say what was true on the day a decision was made.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scope leakage.&lt;/strong&gt; A fact from one customer surfaces in a reply to another, because the boundary lived in application code that a new query path skipped.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Untraceable answers.&lt;/strong&gt; The agent reports a figure, and nobody can find the document or conversation it came from.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A stronger model fixes none of these. Each one is a property of how the context was stored.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do stitched stacks fail in production?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7o9nxpjhbi7tcjv4o0jy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7o9nxpjhbi7tcjv4o0jy.png" alt="Diagram: AI agents wired separately to seven stores (a vector database, Postgres, Oracle, MongoDB, SQL Server, Databricks and Neo4j), with ETL jobs copying data between them" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most organisations build agent context today by wiring each agent to each system: a vector database for embeddings, several transactional databases, a data platform, and a graph database fed by ETL jobs. That arrangement causes five problems.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;th&gt;Impact on agents&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Integration sprawl&lt;/td&gt;
&lt;td&gt;Every agent wires into every system&lt;/td&gt;
&lt;td&gt;Inconsistent answers across agents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Copied, stale data&lt;/td&gt;
&lt;td&gt;ETL copies drift from the source&lt;/td&gt;
&lt;td&gt;Confident answers built on outdated facts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Context in pieces&lt;/td&gt;
&lt;td&gt;Vectors, records and graph live apart&lt;/td&gt;
&lt;td&gt;Missed connections and more hallucination&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Permissions that do not travel&lt;/td&gt;
&lt;td&gt;Each agent re-implements access rules&lt;/td&gt;
&lt;td&gt;Data leaks, or answers blocked by caution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Siloed memory&lt;/td&gt;
&lt;td&gt;Each agent keeps its own memory&lt;/td&gt;
&lt;td&gt;Agents cannot learn from each other&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Teams usually try one of three arrangements to fix this. The first is a stitched stack of specialist stores. The second is one relational database with extensions for vectors and graph. The third is a memory product layered on top of several stores.&lt;/p&gt;

&lt;p&gt;Each is a reasonable choice, and each leaves the context spread across parts that can fall out of step. A single new fact is a document, an embedding, some relationships and a summary row. Across separate stores, that is several writes with no shared all-or-nothing. The vector index can learn about a fact that the graph never hears of.&lt;/p&gt;

&lt;p&gt;The instinct is to manage the seams better with synchronisation jobs, message buses and reconciliation. Those reduce the drift. The seams remain, and the seams were the fault.&lt;/p&gt;

&lt;h2&gt;
  
  
  What makes a context layer governed?
&lt;/h2&gt;

&lt;p&gt;A governed context layer can answer four questions about every fact an agent uses. These are the questions security, legal and data owners ask before they approve an AI project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Who could see it?&lt;/strong&gt; The boundary has to hold on every path, including vector search, even for a confused or manipulated agent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Where did it come from?&lt;/strong&gt; Every claim should point at a sentence in a document, a turn in a conversation or a row in a system of record.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Was it true then?&lt;/strong&gt; Audits ask about the day a decision was made. The context layer has to know what held on that date.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What was kept out?&lt;/strong&gt; Card numbers, credentials and privileged advice should be refused before they are stored, with no copy left in a log or cache.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In most stacks each answer lives somewhere different: a filter in application code, a metadata field on a chunk, whatever the last write left behind. The honest answer to the approver is "probably", and nobody can sign that.&lt;/p&gt;

&lt;p&gt;Governance here widens what AI may use. Once the four answers are properties of the data, the approver can say yes to the contracts, the support history and the client files, each under a rule that can be shown.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to build a context layer in eight steps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Start from the questions agents must answer
&lt;/h3&gt;

&lt;p&gt;List the decisions each agent supports and the questions behind them. "Is this supplier cleared?" "What did we agree with this client in March?" "Which open tickets touch this account?" The questions tell you which entities matter, which relationships to follow, and which facts change over time.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Map your systems of record and how each one arrives
&lt;/h3&gt;

&lt;p&gt;Most of what a company knows sits in its product databases, CRM, ticketing system, data warehouse, wiki and chat. Choose an ingest path for each source:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Change data capture or streams&lt;/strong&gt; for operational data that changes constantly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch loads&lt;/strong&gt; for warehouses and slower systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API pulls&lt;/strong&gt; for on-demand lookups.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A document pipeline&lt;/strong&gt; that chunks and embeds files, PDFs and wiki pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connectors&lt;/strong&gt; for conversations: chat, meetings, email and code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep the source on every record as it arrives: the system, the key, and when it was read. That pointer is what makes an answer traceable later.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Model the business as an ontology
&lt;/h3&gt;

&lt;p&gt;An ontology is a typed model of the things your business talks about and how they relate: customers, facilities, invoices, incidents. Agents then query meaning instead of raw tables, and two spellings of one client resolve to one entity.&lt;/p&gt;

&lt;p&gt;On SurrealDB, an ontology is ordinary schema. Each entity type is a table, each relationship is a typed graph edge, and each record ID is a stable identity. Permissions sit on the same definitions.&lt;/p&gt;

&lt;p&gt;A small customer ontology in SurrealDB:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Entities as typed tables, with a row-level permission&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="no"&gt;SCHEMAFULL&lt;/span&gt;
  &lt;span class="no"&gt;PERMISSIONS&lt;/span&gt; &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="nv"&gt;$auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;regions&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;   &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;lei&lt;/span&gt;    &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;facility&lt;/span&gt; &lt;span class="no"&gt;SCHEMAFULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;credit_limit&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;facility&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="kt"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Relationships as typed graph edges, with their own validity&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;holds&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="no"&gt;RELATION&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="no"&gt;OUT&lt;/span&gt; &lt;span class="n"&gt;facility&lt;/span&gt; &lt;span class="no"&gt;SCHEMAFULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;valid_from&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;holds&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="kt"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- An agent follows meaning, not joins&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;holds&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;facility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;credit_limit&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;limits&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;acme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Version the model like code. A change to how the business defines a customer deserves a review, the same as a change to the application. See &lt;a href="https://surrealdb.com/blog/modelling-a-financial-services-enterprise-ontology-in-surrealdb" rel="noopener noreferrer"&gt;Modelling a financial services enterprise ontology in SurrealDB&lt;/a&gt; for more examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Put every data model on one substrate
&lt;/h3&gt;

&lt;p&gt;Agent context is multi-model by nature. One fact is a document, a vector, a set of graph edges and a point in time. Store all of them in one engine, and write them in one transaction, so a fact lands everywhere at once or not at all.&lt;/p&gt;

&lt;p&gt;One engine removes the seams between separate stores. One hybrid query can then combine vector similarity, full-text keyword search, graph traversal and time filters against one consistent view. The agent receives the few facts that matter, in place of pages of loosely similar chunks.&lt;/p&gt;

&lt;p&gt;That matters for cost as well as accuracy. Similar is not the same as relevant. The right fact often shares the exact identifier, follows a relationship, or holds on a given date, and an embedding sees none of those. Precise retrieval sends the model less, so every call costs less.&lt;/p&gt;

&lt;p&gt;In a &lt;a href="https://surrealdb.com/blog/multi-hop-graph-traversal-inside-surrealdb" rel="noopener noreferrer"&gt;multi-hop graph traversal benchmark on SurrealDB 3.x&lt;/a&gt; (September 2026), three hops from a seed record reached 512 nodes. With filters applied at every hop, one query returned the 14 entities that mattered. The same result took 6 round trips and about 4,900 bytes when the traversal ran in application code, against 1 round trip and 241 bytes inside the database.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Enforce permissions inside the query
&lt;/h3&gt;

&lt;p&gt;Put access rules in the database, next to the data, and evaluate them on every read for the person the agent acts for. The rule then travels with the data to every agent and every interface, and &lt;a href="https://surrealdb.com/blog/even-a-jailbroken-llm-cant-exceed-its-database-permissions-heres-how" rel="noopener noreferrer"&gt;database permissions hold even when the LLM is jailbroken&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Check that the permission applies inside the vector search itself. A filter that only trims results after the nearest-neighbour search can still reveal, through counts and timing, that forbidden records exist. For a small tenant, the same filter often returns nothing at all, as shown in &lt;a href="https://surrealdb.com/blog/why-does-my-vector-search-return-nothing-when-i-add-a-filter-2" rel="noopener noreferrer"&gt;why a filtered vector search can return nothing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Give each agent one narrowly scoped key, and let keys narrow access but never widen it. Decide separately what may enter at all: screen incoming text for card numbers, credentials and personal data before anything is stored.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Supersede facts instead of overwriting them
&lt;/h3&gt;

&lt;p&gt;When a fact changes, keep the old version, dated and sourced, beside the new one. Link them, and close the old one's validity window. The context layer can then answer what is true now, what was true on a given date, and what the agent believed when it acted.&lt;/p&gt;

&lt;p&gt;Track time on more than one clock. When a fact was true in the world often differs from when you learnt it. A client who moved in 2023 and told you in 2026 has a fact valid from 2023 and known from 2026.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Give agents a shared memory
&lt;/h3&gt;

&lt;p&gt;Agents learn during their work: a preference stated in a meeting, a conclusion reached after three tool calls. Store that memory in the context layer, scoped and sourced like any other fact, so what one agent learns can reach the others it is meant to.&lt;/p&gt;

&lt;p&gt;Treat memory as several kinds of fact, each with its own lifespan. A person's name should last for years. Last Tuesday's task state should fade. Record what the agent does not know yet as well, so it asks instead of guessing.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Give agents one interface, and measure retrieval
&lt;/h3&gt;

&lt;p&gt;Expose the context layer through the interfaces your agents already use: an &lt;a href="https://surrealdb.com/mcp" rel="noopener noreferrer"&gt;MCP server&lt;/a&gt; for assistants such as Claude and Cursor, SDKs, framework adapters and an HTTP API. Every agent then reaches the same context through the same rules.&lt;/p&gt;

&lt;p&gt;Measure retrieval quality on its own, separately from the answering model. Change one variable at a time, and record the test protocol, the judge and the date beside every score.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which architecture should you choose?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Consistency across models&lt;/th&gt;
&lt;th&gt;Where permissions live&lt;/th&gt;
&lt;th&gt;History of facts&lt;/th&gt;
&lt;th&gt;What you operate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Stitched stack of specialist stores&lt;/td&gt;
&lt;td&gt;Several writes, no shared transaction&lt;/td&gt;
&lt;td&gt;In each store and each agent&lt;/td&gt;
&lt;td&gt;Depends on each store&lt;/td&gt;
&lt;td&gt;Several systems and the glue between them&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Relational database with extensions&lt;/td&gt;
&lt;td&gt;One transaction, one native model&lt;/td&gt;
&lt;td&gt;In the database&lt;/td&gt;
&lt;td&gt;Built by hand&lt;/td&gt;
&lt;td&gt;One database, several extensions to version together&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory product over separate stores&lt;/td&gt;
&lt;td&gt;Consolidated logic, data still split underneath&lt;/td&gt;
&lt;td&gt;In the product's application tier&lt;/td&gt;
&lt;td&gt;Varies&lt;/td&gt;
&lt;td&gt;A service plus the stores under it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Native multi-model context layer&lt;/td&gt;
&lt;td&gt;One transaction across every model&lt;/td&gt;
&lt;td&gt;In the query, on every read&lt;/td&gt;
&lt;td&gt;Kept by design&lt;/td&gt;
&lt;td&gt;One engine&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every option has a place. If your need is semantic search over a static set of documents, a vector database alone is the right tool. A single engine also has costs: a specialist store may tune its one task harder at extreme scale, and you take on a new query language. For agent context that spans documents, relationships, history and permissions, the seams usually cost more.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you build a context layer on SurrealDB?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4vg33u3b45ap95y8q8we.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4vg33u3b45ap95y8q8we.png" alt="Diagram: the SurrealDB context layer stack, with the business ontology on top, Agent Memory and SurrealFS for memory, the multi-model SurrealDB engine underneath, and self-hosted or cloud deployment" width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SurrealDB builds the context layer from three parts, available self-hosted or in SurrealDB Cloud.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SurrealDB, the engine.&lt;/strong&gt; Documents, graphs, vectors, relations, time series and live queries in one engine, with one query language, SurrealQL. Full-text search and row-level permissions apply to the same records.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The ontology.&lt;/strong&gt; The typed model of your business, built as SurrealDB tables, typed graph relations and permissions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://surrealdb.com/agent-memory" rel="noopener noreferrer"&gt;SurrealDB Agent Memory&lt;/a&gt;, for memory.&lt;/strong&gt; It is the governed context and memory layer. It extracts entities, builds the knowledge graph, keeps temporal facts with their sources, and runs hybrid retrieval. &lt;a href="https://github.com/surrealdb/surrealfs" rel="noopener noreferrer"&gt;SurrealFS&lt;/a&gt; gives agents and people a shared file system for Markdown and documents, stored in SurrealDB. See &lt;a href="https://surrealdb.com/blog/agent-memory-is-a-filesystem-building-one-on-surrealdb" rel="noopener noreferrer"&gt;Building a filesystem-based agent memory on SurrealDB&lt;/a&gt; for how it works.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Systems of record arrive through change data capture, batch loads, API pulls and the document pipeline. Conversations from chat, meetings, email and code arrive through Agent Memory's connectors. SurrealDB and Agent Memory share one graph. Agents reach it through the &lt;a href="https://surrealdb.com/docs/agent-memory/integrations/mcp-server/install" rel="noopener noreferrer"&gt;Agent Memory MCP server&lt;/a&gt;, SDKs, framework adapters, skills and hooks, or the HTTP API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftswy5r4vq2rishmb9taz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftswy5r4vq2rishmb9taz.png" alt="enterprise context layer" width="800" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result for the business:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;More accurate agents.&lt;/strong&gt; Answers rest on connected, current and permissioned facts, with their sources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faster answers.&lt;/strong&gt; Agents call tools in loops, so every slow lookup is paid many times over. SurrealDB answers a context request in one query, without a round trip to each store or a merge step in application code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graph traversals without joins.&lt;/strong&gt; Relations are stored as edges between records, so the engine follows them directly. Walking from a customer to its facilities, owners and open tickets stays fast as the graph grows, with no join tables to scan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid search in one pass.&lt;/strong&gt; Vector similarity, full-text relevance and graph filters run in the same query, with the permission rules applied as it runs. Results arrive already ranked, filtered and allowed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fewer tokens per answer.&lt;/strong&gt; One hybrid query returns the relevant facts and relations, in place of pages of raw chunks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One engine in place of several.&lt;/strong&gt; Separate vector, graph and document stores are no longer needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Governed by default.&lt;/strong&gt; Permissions live in the database, with the data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory that compounds.&lt;/strong&gt; Agents reuse what they already concluded, which saves tokens on repeat questions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is context engineering?
&lt;/h3&gt;

&lt;p&gt;Context engineering is the practice of deciding what information an agent receives at each step: which facts, from which sources, under which permissions. A context layer is the infrastructure that makes context engineering repeatable across every agent, instead of rebuilt inside each one.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the difference between a context layer and RAG?
&lt;/h3&gt;

&lt;p&gt;RAG retrieves passages that are similar to a question. A context layer holds everything an agent needs, including identity, task state, relationships, history and permissions, and RAG is one way of reading from it.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the difference between a context layer and a semantic layer?
&lt;/h3&gt;

&lt;p&gt;A semantic layer defines business metrics for analytics and dashboards. A context layer serves agents, so it also carries relationships, conversations, memory, provenance and per-person permissions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is a context layer the same as agent memory?
&lt;/h3&gt;

&lt;p&gt;Agent memory is part of a context layer. The context layer also covers systems of record, documents and the rules on who may see what. Memory is the part that persists, changes and learns across sessions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need a graph database to build a context layer?
&lt;/h3&gt;

&lt;p&gt;You need relationships that agents can follow, because the right fact is often one link away from the question. A multi-model engine stores those relationships as graph edges next to the documents and vectors, so you do not need a separate graph database.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I stop agents seeing data the user cannot see?
&lt;/h3&gt;

&lt;p&gt;Enforce permissions in the database, and run every query the agent makes as the person it acts for. Make sure the rule applies inside vector search too, so a semantic match cannot surface a row that person could not open.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens when two sources disagree, or a fact changes?
&lt;/h3&gt;

&lt;p&gt;Give each source a level of trust, so the system of record can outrank a chat message. When a fact changes, supersede the old version instead of deleting it, so you can still answer what was believed on any date.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I know a context layer is working?
&lt;/h3&gt;

&lt;p&gt;Test retrieval separately from the model that writes the answer. Keep a set of real questions with known answers, run them as different users to check permissions, and record the date and method beside every score.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does MCP relate to a context layer?
&lt;/h3&gt;

&lt;p&gt;MCP, the Model Context Protocol, is how assistants such as Claude, ChatGPT and Cursor reach outside themselves. It is the interface. The context layer is what sits behind it and decides what each agent is handed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Build your first governed context layer on SurrealDB.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://studio.surrealdb.com/current/instances/deploy" rel="noopener noreferrer"&gt;Create a free SurrealDB instance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://surrealdb.com/docs" rel="noopener noreferrer"&gt;Get started&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://surrealdb.com/whitepapers/context-at-any-scale" rel="noopener noreferrer"&gt;Read the "Context at any scale" whitepaper&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>surrealdb</category>
      <category>contextlayer</category>
    </item>
    <item>
      <title>Agent memory in one SurrealQL query: vectors, graph, text</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Mon, 23 Nov 2026 11:47:54 +0000</pubDate>
      <link>https://dev.to/surrealdb/agent-memory-in-one-surrealql-query-vectors-graph-text-2c0p</link>
      <guid>https://dev.to/surrealdb/agent-memory-in-one-surrealql-query-vectors-graph-text-2c0p</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A single SurrealQL query can search records by meaning, by their connections and by the exact words they contain, inside one transaction. One &lt;code&gt;SELECT&lt;/code&gt; can combine HNSW vector search, full-text matches, filters on document fields and graph traversal. Any application that searches this way can use the pattern, and this post builds an AI agent's memory with it, because an agent needs all three kinds of recall at once: what a memory means, what it connects to and what was said.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does an agent need to recall?
&lt;/h2&gt;

&lt;p&gt;An agent's memory answers three questions about a topic: what is close to it in meaning, what is connected to it, and what was said about it in specific words. A fourth question, about when, who and what kind, narrows the answer. SurrealDB answers each one with a feature of the same database:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What does it mean?&lt;/strong&gt; An HNSW vector index and the KNN operator, used below as &lt;code&gt;embedding &amp;lt;|3,COSINE|&amp;gt; $q&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What was said?&lt;/strong&gt; A full-text index with an analyzer, used below as &lt;code&gt;text @@ 'migration'&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What does it connect to?&lt;/strong&gt; &lt;code&gt;RELATE&lt;/code&gt; edges and graph traversal, used below as &lt;code&gt;-&amp;gt;mentions-&amp;gt;entity&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When, who and what kind?&lt;/strong&gt; Ordinary document fields: &lt;code&gt;kind&lt;/code&gt;, &lt;code&gt;speaker&lt;/code&gt; and &lt;code&gt;said_at&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many stacks keep these in four separate systems and join the results in application code. In SurrealDB they are four kinds of index on the same records.&lt;/p&gt;



&lt;h2&gt;
  
  
  How do you model the memory?
&lt;/h2&gt;

&lt;p&gt;Define one table of memories, one table of entities and two relation tables.&lt;/p&gt;

&lt;p&gt;Each memory stores an embedding: an array of numbers that represents the meaning of its text, produced by an embedding model. Texts with similar meanings get arrays that are close together. Each number captures one aspect of the meaning, so real models use long arrays to tell fine differences apart: OpenAI's &lt;code&gt;text-embedding-3-small&lt;/code&gt; produces 1,536 numbers per text and &lt;code&gt;text-embedding-3-large&lt;/code&gt; produces 3,072, while Voyage AI's &lt;code&gt;voyage-3.5&lt;/code&gt;, the provider Anthropic recommends for embeddings, produces 1,024 by default. Arrays that long are impossible to read in a blog post, so the examples here use embeddings of only three numbers, written by hand. With a real model, only the &lt;code&gt;DIMENSION&lt;/code&gt; value of the index and the length of the array change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Memories: what was said, by whom, when, and what it means&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="no"&gt;SCHEMAFULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="s1"&gt;'turn'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'document'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;speaker&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;said_at&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="kt"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Vector index: finds memories by meaning&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;memory_embedding&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;
    &lt;span class="no"&gt;FIELDS&lt;/span&gt; &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="no"&gt;HNSW&lt;/span&gt; &lt;span class="no"&gt;DIMENSION&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="no"&gt;DIST&lt;/span&gt; &lt;span class="no"&gt;COSINE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Full-text index: finds memories by the words they contain.&lt;/span&gt;
&lt;span class="c1"&gt;-- The analyzer splits text into words, lowercases them and reduces&lt;/span&gt;
&lt;span class="c1"&gt;-- each word to its stem, so "migrations" matches "migration".&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;ANALYZER&lt;/span&gt; &lt;span class="n"&gt;memo_text&lt;/span&gt;
    &lt;span class="no"&gt;TOKENIZERS&lt;/span&gt; &lt;span class="n"&gt;blank&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;punct&lt;/span&gt;
    &lt;span class="no"&gt;FILTERS&lt;/span&gt; &lt;span class="n"&gt;lowercase&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ascii&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;snowball&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;english&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;memory_text&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;
    &lt;span class="no"&gt;FIELDS&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="no"&gt;FULLTEXT&lt;/span&gt; &lt;span class="no"&gt;ANALYZER&lt;/span&gt; &lt;span class="n"&gt;memo_text&lt;/span&gt; &lt;span class="no"&gt;BM25&lt;/span&gt; &lt;span class="no"&gt;HIGHLIGHTS&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Entities: the people, systems and projects that memories mention&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt; &lt;span class="no"&gt;SCHEMAFULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Graph edges: from a memory to an entity it mentions...&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="no"&gt;RELATION&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="no"&gt;OUT&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;-- ...where each memory can mention each entity only once&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;unique_mention&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt; &lt;span class="no"&gt;FIELDS&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="k"&gt;UNIQUE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- ...and from one entity to another&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;relates_to&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="no"&gt;RELATION&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt; &lt;span class="no"&gt;OUT&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;DEFINE&lt;/span&gt; &lt;span class="no"&gt;FIELD&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;relates_to&lt;/span&gt; &lt;span class="no"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The full-text index ranks matches with BM25, a standard relevance formula used by most search engines. BM stands for "best matching", and 25 is the number of the formula in the series that introduced it. The &lt;a href="https://surrealdb.com/docs/reference/query-language/statements/define/indexes" rel="noopener noreferrer"&gt;DEFINE INDEX reference&lt;/a&gt; covers the index options, and the &lt;a href="https://surrealdb.com/docs/reference/query-language/statements/define/analyzer" rel="noopener noreferrer"&gt;DEFINE ANALYZER reference&lt;/a&gt; covers tokenizers and filters.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you load memories and a graph?
&lt;/h2&gt;

&lt;p&gt;The example data is the memory of an agent that helps a small engineering team. The team is running a project, the ledger migration, which moves the data of its billing service off a database that is reaching the end of its support. In the queries below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;entity:ada&lt;/code&gt; is a person, Ada, who owns the ledger migration.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;entity:ledger&lt;/code&gt; is the ledger migration project.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;entity:billing&lt;/code&gt; is the billing service, which the migration changes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;entity:postgres&lt;/code&gt; is the Postgres 14 database the migration depends on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Create the four entities and connect them with &lt;a href="https://surrealdb.com/docs/reference/query-language/statements/relate" rel="noopener noreferrer"&gt;RELATE&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- The people, systems and projects&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ada&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Ada'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'person'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;billing&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Billing service'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'system'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Ledger migration'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'project'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;postgres&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Postgres 14'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'system'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- How they relate to each other&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ada&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;relates_to&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'owns'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;relates_to&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;billing&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'changes'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;relates_to&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;postgres&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'depends on'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then store four memories and link each one to the entities it mentions. Three are turns from a conversation with the agent, and one is a passage from a document:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m1&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Ada said the ledger migration must finish before the invoice run on Friday'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'turn'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;said_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="s1"&gt;'2026-11-02T09:00:00Z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m2&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'The billing service retries failed payments three times with backoff'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'document'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'docs'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;said_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="s1"&gt;'2026-10-20T09:00:00Z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m3&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Lunch order for the offsite is vegetarian pizza'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'turn'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;said_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="s1"&gt;'2026-11-01T12:00:00Z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m4&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Postgres 14 reaches end of life so the ledger migration moves data first'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'turn'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;said_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="s1"&gt;'2026-11-03T10:00:00Z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Which entities each memory mentions&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m1&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ada&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m1&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m2&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;billing&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m4&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;postgres&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m4&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What does each index return on its own?
&lt;/h2&gt;

&lt;p&gt;The KNN operator &lt;code&gt;&amp;lt;|3,COSINE|&amp;gt;&lt;/code&gt; returns the three memories nearest to a query vector, and &lt;code&gt;vector::distance::knn()&lt;/code&gt; gives the distance of each. The full-text operator &lt;code&gt;@0@&lt;/code&gt; matches the analyzed text, and &lt;code&gt;search::score(0)&lt;/code&gt; and &lt;code&gt;search::highlight()&lt;/code&gt; give the BM25 score and the matched words.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- The embedding of the agent's question&lt;/span&gt;
&lt;span class="no"&gt;LET&lt;/span&gt; &lt;span class="nv"&gt;$q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.85&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- By meaning: the three nearest memories&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;distance&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;knn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;distance&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;|&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="no"&gt;COSINE&lt;/span&gt;&lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$q&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;distance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- By words: memories that contain "migration"&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;highlight&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'&amp;lt;b&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;/b&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;hit&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt; @&lt;span class="mi"&gt;0&lt;/span&gt;@ &lt;span class="s1"&gt;'migration'&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The vector search ranks the ledger memory, the billing document and the Postgres memory, and leaves out the lunch order. The full-text search finds the two memories that contain the word.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"memory:m1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"distance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.0037&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Ada said the ledger migration must finish before the invoice run on Friday"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"memory:m2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"distance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.0185&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"The billing service retries failed payments three times with backoff"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"memory:m4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"distance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.0272&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Postgres 14 reaches end of life so the ledger migration moves data first"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"memory:m1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"score"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.645&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"hit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Ada said the ledger &amp;lt;b&amp;gt;migration&amp;lt;/b&amp;gt; must finish before the invoice run on Friday"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"memory:m4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"score"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.645&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"hit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Postgres 14 reaches end of life so the ledger &amp;lt;b&amp;gt;migration&amp;lt;/b&amp;gt; moves data first"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How do you recall with meaning, connections and words in one query?
&lt;/h2&gt;

&lt;p&gt;Put every condition in the same &lt;code&gt;WHERE&lt;/code&gt; clause and traverse the graph in the projection. The query below finds memories that are near the question vector, contain the word "migration", are turns of the conversation and were said after 1 November 2026. For each one it then follows the &lt;code&gt;mentions&lt;/code&gt; and &lt;code&gt;relates_to&lt;/code&gt; edges. It runs between &lt;code&gt;BEGIN&lt;/code&gt; and &lt;code&gt;COMMIT&lt;/code&gt;, so every read comes from one consistent view of the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;BEGIN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;LET&lt;/span&gt; &lt;span class="nv"&gt;$q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.85&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;said_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;distance&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;knn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;distance&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;-- The entities this memory mentions&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;-- The entities those entities relate to&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;relates_to&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;connected_to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;-- Who owns what this memory mentions&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;relates_to&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'owns'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;owners&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;|&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="no"&gt;COSINE&lt;/span&gt;&lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$q&lt;/span&gt;      &lt;span class="c1"&gt;-- by meaning&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="nd"&gt;@@&lt;/span&gt; &lt;span class="s1"&gt;'migration'&lt;/span&gt;          &lt;span class="c1"&gt;-- by words&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'turn'&lt;/span&gt;                &lt;span class="c1"&gt;-- by kind&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;said_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="s1"&gt;'2026-11-01T00:00:00Z'&lt;/span&gt;  &lt;span class="c1"&gt;-- by time&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;distance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;COMMIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is the agent's recall, one object per memory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"memory:m1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Ada said the ledger migration must finish before the invoice run on Friday"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"speaker"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"said_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-02T09:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"distance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.0037&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"mentions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Ledger migration"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Ada"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"connected_to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Postgres 14"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Billing service"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Ledger migration"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"owners"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Ada"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"memory:m4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Postgres 14 reaches end of life so the ledger migration moves data first"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"speaker"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"said_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-03T10:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"distance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.0272&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"mentions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Postgres 14"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Ledger migration"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"connected_to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Postgres 14"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Billing service"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"owners"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Ada"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each result answers all three questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it means:&lt;/strong&gt; the memory is close to the question vector, and the distance shows how close.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What was said:&lt;/strong&gt; the &lt;code&gt;text&lt;/code&gt;, &lt;code&gt;speaker&lt;/code&gt; and &lt;code&gt;said_at&lt;/code&gt; fields, filtered by the full-text match.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What it connects to:&lt;/strong&gt; the entities it mentions, the systems they touch and the person who owns the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The billing document is not in the result, because it is not a turn and does not contain the word. The lunch order was never close enough in meaning to appear.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can the agent write and recall in the same transaction?
&lt;/h2&gt;

&lt;p&gt;Yes. A transaction sees its own writes in the vector index, the full-text index and the graph. The query below stores a new memory, links it to two entities and recalls it before committing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;BEGIN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m5&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Ada moved the ledger migration cutover to Monday'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'turn'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;said_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="s1"&gt;'2026-11-04T08:00:00Z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.88&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.02&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m5&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ada&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m5&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- The new memory is already visible to all three kinds of search&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;distance&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;knn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;distance&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;|&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="no"&gt;COSINE&lt;/span&gt;&lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.85&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="nd"&gt;@@&lt;/span&gt; &lt;span class="s1"&gt;'cutover'&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;distance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;COMMIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;SELECT&lt;/code&gt; returns the new memory, at a &lt;code&gt;distance&lt;/code&gt; of 0.0014, with &lt;code&gt;mentions&lt;/code&gt; of &lt;code&gt;["Ledger migration", "Ada"]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The transaction also keeps a memory and its links together when a write fails. An agent usually finds the entities in a text with a language model, and two phrases in one text can resolve to the same entity: below, "the ledger cutover" and "the cutover" both resolve to the ledger migration. The &lt;code&gt;unique_mention&lt;/code&gt; index refuses the second edge, and the whole transaction is cancelled with it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;BEGIN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m6&lt;/span&gt; &lt;span class="no"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'The ledger cutover needs a read-only window on the billing service'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'turn'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;said_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="s1"&gt;'2026-11-05T08:00:00Z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m6&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m6&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;billing&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;-- "the cutover" also resolved to the ledger migration&lt;/span&gt;
&lt;span class="no"&gt;RELATE&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;m6&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;ledger&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;COMMIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error output
──────────────────────────────
Database index `unique_mention` already contains [memory:m6, entity:ledger], with record `mentions:doegt5zm2zhb80w0wcoy`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Afterwards, &lt;code&gt;SELECT * FROM memory:m6&lt;/code&gt; returns an empty array, and so does a search for its edges. The memory, both of its edges and its entries in the vector and full-text indexes were never written, so the agent can deduplicate the entities and try again without first cleaning up half a memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does this relate to SurrealDB Agent Memory?
&lt;/h2&gt;

&lt;p&gt;Because SurrealDB has vector, full-text, document and graph indexes on the same records, it can be the memory of an agent, as the queries above show. A memory built by hand quickly needs more design decisions than these queries make, though. It has to decide how text becomes entities and edges, what happens when two names refer to the same thing, how a new fact replaces an old one without losing the history, how to answer what was true at a past date, and how to keep each user's or agent's memories apart. And not every team that needs an agent's memory also wants to run a database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://surrealdb.com/agent-memory" rel="noopener noreferrer"&gt;SurrealDB Agent Memory&lt;/a&gt; makes those decisions and runs the database for you. It is built on SurrealDB and adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ingestion&lt;/strong&gt; of conversations, text and documents, with extraction of entities and relationships.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reconciliation and supersession&lt;/strong&gt;, which match new facts to the entities already stored and record a correction as a new value that replaces the old one, with the full history kept.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A tri-temporal model&lt;/strong&gt;, which records when each fact was true, when it was known and when it was stored, so an agent can ask what was true on any past date.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid recall&lt;/strong&gt;, which fuses vector similarity, BM25 and graph traversal into one ranking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scoping&lt;/strong&gt;, which keeps each user's, agent's or team's memories apart.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;a href="https://surrealdb.com/docs/agent-memory" rel="noopener noreferrer"&gt;Agent Memory documentation&lt;/a&gt; covers each of these, and the &lt;a href="https://surrealdb.com/blog/introducing-surrealdb-agent-memory" rel="noopener noreferrer"&gt;introduction to SurrealDB Agent Memory&lt;/a&gt; covers the product.&lt;/p&gt;

&lt;p&gt;The queries in this post show the primitives that Agent Memory is built on. Write them yourself when you want to design the schema, the extraction and the ranking for your own application. Use Agent Memory when you want an agent to have a memory without building and running one.&lt;/p&gt;

</description>
      <category>agentmemory</category>
      <category>surrealdb</category>
      <category>surrealql</category>
      <category>articificialintelligenceagent</category>
    </item>
    <item>
      <title>Introducing SurrealDS: fault-tolerant distributed storage</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Wed, 18 Nov 2026 09:38:13 +0000</pubDate>
      <link>https://dev.to/surrealdb/introducing-surrealds-fault-tolerant-distributed-storage-58ad</link>
      <guid>https://dev.to/surrealdb/introducing-surrealds-fault-tolerant-distributed-storage-58ad</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alongside SurrealDB 4, we recently introduced SurrealDS, a new distributed storage engine for SurrealDB backed by object storage, designed for elastically scalable, fault-tolerant deployments across multiple nodes and availability zones.&lt;/p&gt;

&lt;p&gt;Available as part of new &lt;strong&gt;SurrealDB Cloud multi-node clusters&lt;/strong&gt; and &lt;strong&gt;SurrealDB Enterprise Edition&lt;/strong&gt; for self-hosted deployments, SurrealDS separates database compute from durable storage.&lt;/p&gt;

&lt;p&gt;Each SurrealDB node keeps a fast local working set, while persistent data is stored in shared object storage: Amazon S3 and S3-compatible stores, Azure Blob Storage, or Google Cloud Storage.&lt;/p&gt;

&lt;p&gt;The result is an architecture designed to combine local performance with the durability, scalability, and operational characteristics of object storage.&lt;/p&gt;



&lt;h2&gt;
  
  
  Why did we build SurrealDS?
&lt;/h2&gt;

&lt;p&gt;Running a database on one machine is relatively straightforward. Running it reliably across machines and availability zones introduces a different set of problems.&lt;/p&gt;

&lt;p&gt;A distributed database needs to answer questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When can a write safely be acknowledged?&lt;/li&gt;
&lt;li&gt;What happens when a node fails during a write?&lt;/li&gt;
&lt;li&gt;How does another node take over without serving stale data?&lt;/li&gt;
&lt;li&gt;How do nodes agree on the order of transactions?&lt;/li&gt;
&lt;li&gt;How do you recover from failure without copying the entire database between machines?&lt;/li&gt;
&lt;li&gt;How do you scale compute and storage independently?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our new distributed engine is designed around these problems.&lt;/p&gt;

&lt;p&gt;Rather than treating a database node and its disk as a single unit, it separates the durable data layer from the compute processes executing SurrealQL. This gives SurrealDB a storage architecture designed for distributed cloud environments where compute can be added, removed, or replaced independently of the underlying data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Local performance, shared durable storage
&lt;/h2&gt;

&lt;p&gt;Each node works across three storage tiers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Memory&lt;/strong&gt; for the hottest data and active transactional state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local disk&lt;/strong&gt; for the commit log and caching.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shared object storage&lt;/strong&gt; for durable database pages and long-term storage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Queries therefore do not need to fetch every piece of data from object storage. Frequently accessed data can remain close to the database process, while the durable representation of the dataset lives independently of any individual node.&lt;/p&gt;

&lt;p&gt;This also removes the need for every compute node to maintain its own complete copy of the database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Elastically scalable compute and storage
&lt;/h2&gt;

&lt;p&gt;Traditional distributed databases often tie compute capacity to storage capacity. If you need more compute, you add another database node. That node often comes with another full replica of the data, whether or not you actually need additional storage.&lt;/p&gt;

&lt;p&gt;By using shared object storage as the durable data layer, SurrealDB can scale these dimensions more independently. Compute capacity can be increased by adding nodes to serve additional workloads, while the underlying dataset remains in shared storage.&lt;/p&gt;

&lt;p&gt;Likewise, storage can continue growing without requiring a corresponding increase in the number or size of database nodes. This architecture forms the basis for elastic scaling in &lt;strong&gt;SurrealDB Cloud multi-node clusters&lt;/strong&gt;, where infrastructure can adapt to changing workloads without treating every node as a permanent holder of the full dataset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writes are ordered before they are acknowledged
&lt;/h2&gt;

&lt;p&gt;Within a distributed deployment, writes are placed into an ordered commit log. One node is responsible for sequencing writes for a given scope. Each transaction receives a position in that sequence before it becomes part of the durable state of the database.&lt;/p&gt;

&lt;p&gt;In a multi-zone deployment with the default policy, a write is acknowledged only after it is durable on the sequencing node and on a second node in another availability zone. If no such node is available, the write is refused rather than acknowledged on a single copy. Under that policy, an acknowledged write has been retained across two failure domains.&lt;/p&gt;

&lt;p&gt;Other nodes follow the same ordered log and maintain a consistent view of committed state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reads without routing everything through one node
&lt;/h2&gt;

&lt;p&gt;Many distributed database architectures route writes through a leader and then send consistency-sensitive reads through that same node. SurrealDB takes a different approach.&lt;/p&gt;

&lt;p&gt;Every node runs the database engine and can serve queries. Reads are checked against the point in the ordered log that the node has observed. Data pages carry the log position they represent. If nothing relevant has changed since that point, the existing value can be returned. If newer changes exist, those changes are incorporated before the result is served.&lt;/p&gt;

&lt;p&gt;This allows nodes to serve consistent reads without requiring all read traffic to pass through a single coordinator. Transactions operate against a pinned snapshot and validate their read set when they commit. The engine provides serializable isolation within a scope. Through SurrealDB, transactions run at snapshot isolation by default, with serializable isolation available as an option.&lt;/p&gt;

&lt;h2&gt;
  
  
  From the commit log to durable database pages
&lt;/h2&gt;

&lt;p&gt;The commit log handles recent changes, but it is not intended to grow indefinitely. The engine periodically folds accumulated changes into a copy-on-write tree and publishes a new root representing the database at that point in time.&lt;/p&gt;

&lt;p&gt;The resulting pages are &lt;strong&gt;content-addressed&lt;/strong&gt;. If a page has not changed between two versions of the database, both versions can reference the same underlying page instead of storing another copy.&lt;/p&gt;

&lt;p&gt;This means unchanged data does not need to be rewritten whenever a new database state is published, and historical roots can share the same underlying storage.&lt;/p&gt;

&lt;p&gt;Because those pages live in object storage, the durable database state is also independent of the lifecycle of an individual compute node.&lt;/p&gt;

&lt;h2&gt;
  
  
  Built for node and zone failure
&lt;/h2&gt;

&lt;p&gt;Distributed infrastructure eventually fails. Processes crash. Disks become unavailable. Networks partition. Availability zones can disappear temporarily. The distributed engine is built around explicit recovery from these conditions.&lt;/p&gt;

&lt;p&gt;A production deployment can run nodes across multiple availability zones. The system tracks which node is responsible for sequencing transactions and which other node holds the second durable copy of acknowledged writes. If the active node becomes unavailable, another node can take ownership through a coordinated succession process.&lt;/p&gt;

&lt;p&gt;Before serving in its new role, the group verifies the required state and repairs missing data where necessary. A key principle is that the database should not return a plausible but potentially incorrect result simply because the cluster is unhealthy. Where correctness cannot be established, the operation is refused rather than serving data from the wrong state or point in time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Object storage as the durable layer
&lt;/h2&gt;

&lt;p&gt;Using object storage changes how distributed database infrastructure can be designed. Traditional architectures commonly maintain several full copies of a dataset on attached disks. That provides redundancy, but it also means storage consumption increases with the number of database nodes.&lt;/p&gt;

&lt;p&gt;With SurrealDB's new architecture, durable database pages live in shared object storage instead. Compute nodes maintain the local logs, caches, and state required for low-latency operation, while the complete durable dataset exists independently in the shared storage layer. Replacing a compute node therefore does not mean replacing one of the only authoritative copies of the database. It also makes long-term storage capacity less dependent on the shape of the compute cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kubernetes-native deployment
&lt;/h2&gt;

&lt;p&gt;The new distributed engine is designed for multi-node SurrealDB deployments on Kubernetes. A typical deployment places nodes across availability zones, with each node running its own SurrealDB process and local persistent volume while sharing the same object store.&lt;/p&gt;

&lt;p&gt;The SurrealDB Operator manages the surrounding infrastructure, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Availability-zone placement&lt;/li&gt;
&lt;li&gt;Persistent volumes for local logs&lt;/li&gt;
&lt;li&gt;Peer configuration&lt;/li&gt;
&lt;li&gt;Services and routing&lt;/li&gt;
&lt;li&gt;TLS between nodes&lt;/li&gt;
&lt;li&gt;Readiness and liveness checks&lt;/li&gt;
&lt;li&gt;Disruption budgets&lt;/li&gt;
&lt;li&gt;Rolling configuration changes&lt;/li&gt;
&lt;li&gt;Deployment strategies for version upgrades&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nodes communicate over authenticated peer connections, while applications continue interacting with SurrealDB through the normal database interface. The distributed storage architecture therefore remains largely transparent to the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Safer distributed upgrades
&lt;/h2&gt;

&lt;p&gt;Upgrading a distributed stateful system requires more than replacing containers one at a time. SurrealDB and the SurrealDB Operator determine whether a version change can safely happen as a rolling upgrade or whether the deployment needs a coordinated restart.&lt;/p&gt;

&lt;p&gt;Compatible versions can roll node by node while the group continues serving traffic. Where storage or communication formats are incompatible, the deployment can instead perform a controlled stop-and-start process rather than allowing incompatible nodes to participate in the same group.&lt;/p&gt;

&lt;p&gt;The operator reports the deployment's phase through the resource's Kubernetes status: deciding, rolling, stopping, starting, serving, refused or failed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tested around failure, not just normal operation
&lt;/h2&gt;

&lt;p&gt;Distributed storage is difficult to validate through unit testing alone. The engine is tested using several complementary methods.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic simulation testing&lt;/strong&gt; exercises storage and recovery across thousands of reproducible failure scenarios, including message loss, network delays, partitions, disk failure, and interrupted recovery.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Formal models&lt;/strong&gt; are used to verify core distributed protocols and invariants.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fault-injection testing&lt;/strong&gt; runs real multi-node deployments while deliberately disrupting nodes, disks, and network paths, with more scenarios being added.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Performance testing also includes deliberately broken variants of the system to confirm that benchmarks actually measure the property they claim to measure. The goal is not simply to prove that a healthy cluster works. It is to validate how the system behaves when parts of the infrastructure fail.&lt;/p&gt;

&lt;h2&gt;
  
  
  A new foundation for distributed SurrealDB
&lt;/h2&gt;

&lt;p&gt;SurrealDB now has storage engines designed for different deployment requirements.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SurrealKV&lt;/strong&gt; provides high-performance persistent storage on a single node.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SurrealMX&lt;/strong&gt; provides in-memory storage for workloads where minimum latency is the priority.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;SurrealDS&lt;/strong&gt;, a separate engine from both, provides &lt;strong&gt;elastically scalable, fault-tolerant storage backed by object storage&lt;/strong&gt; for deployments spanning multiple machines and availability zones.  It combines ordered transactions, local caching, shared object storage, multi-zone durability, consistent reads, and coordinated recovery into a storage architecture designed specifically for SurrealDB.&lt;/p&gt;

&lt;p&gt;It is available through &lt;strong&gt;SurrealDB Enterprise Edition&lt;/strong&gt; and already runs new &lt;strong&gt;SurrealDB Cloud multi-node clusters&lt;/strong&gt;. For applications, the database remains the same: SurrealQL, the same multi-model capabilities, and the same client interfaces. What changes is the architecture underneath it.&lt;/p&gt;

&lt;p&gt;Want to try it? &lt;a href="https://surrealdb.com/contact" rel="noopener noreferrer"&gt;Contact us to get started&lt;/a&gt; or &lt;a href="https://surrealdb.com/docs/manage/enterprise/product/surrealds" rel="noopener noreferrer"&gt;read the documentation&lt;/a&gt; to learn more.&lt;/p&gt;

</description>
      <category>surrealdb</category>
      <category>surrealds</category>
      <category>distributedstorage</category>
      <category>news</category>
    </item>
    <item>
      <title>SurrealDB 4. The database and memory for every agent</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Fri, 13 Nov 2026 17:35:41 +0000</pubDate>
      <link>https://dev.to/surrealdb/surrealdb-4-the-database-and-memory-for-every-agent-437g</link>
      <guid>https://dev.to/surrealdb/surrealdb-4-the-database-and-memory-for-every-agent-437g</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SurrealDB 4 is generally available today. It is the database and memory for every agent. And with it, SurrealDB Earth: serverless SurrealDB, built on Cloudflare, that scales to as many agents and users as you need, wherever they are. SurrealDB 4, the engine underneath, returns vectors, graphs, documents and full text in one query, in one transaction, and speaks PostgreSQL and MySQL over their own wire protocols, so users and agents can write the SQL they already know.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is in the release
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SurrealDB 4&lt;/strong&gt; is the database engine: a rebuilt query core, PostgreSQL SQL and MySQL support over their wire protocols, mql.js 1.0 and more than 240 fixes that no 3.x release contains. It runs embedded, on a laptop, in the browser, on your own servers or in SurrealDB Cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SurrealDB Earth&lt;/strong&gt; is serverless SurrealDB, built on Cloudflare, that scales to as many agents and users as you need, wherever they are. Every Earth database is its own isolated instance, with dedicated storage and commit log.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SurrealDS&lt;/strong&gt; is distributed storage backed by object-storage for large SurrealDB clusters, in SurrealDB Cloud multi-node clusters and self-hosted Enterprise Edition deployments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent Memory&lt;/strong&gt;, launched in October, is a separate, managed service built on the same engine. Memory in one query is built into the engine, and Agent Memory is the managed way to get it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Earth is where you run it, and SurrealDB 4 is what you run.&lt;/p&gt;



&lt;h2&gt;
  
  
  Try it now
&lt;/h2&gt;

&lt;p&gt;If you already work in Postgres and do not want to touch SurrealQL yet, this is where you can start. SurrealDB does not need PostgreSQL installed: the listener lets Postgres clients talk to SurrealDB. On your machine, start SurrealDB 4 with the PostgreSQL listener on, then connect with &lt;code&gt;psql&lt;/code&gt; and select the PostgreSQL dialect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;surreal db start --user root --pass secret --postgres-bind 127.0.0.1:5432 memory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psql &lt;span class="s2"&gt;"host=127.0.0.1 port=5432 user=root password=secret dbname=main/main options='-c dialect=pgsql'"&lt;/span&gt; -c &lt;span class="s1"&gt;'SELECT 1;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both wire protocol listeners are off until you pass &lt;code&gt;--postgres-bind&lt;/code&gt; or &lt;code&gt;--mysql-bind&lt;/code&gt;. The &lt;a href="https://surrealdb.com/docs/reference/rest-api/postgres-protocol" rel="noopener noreferrer"&gt;PostgreSQL&lt;/a&gt; and &lt;a href="https://surrealdb.com/docs/reference/rest-api/mysql-protocol" rel="noopener noreferrer"&gt;MySQL&lt;/a&gt; protocol references list the connection options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do agents need a database?
&lt;/h2&gt;

&lt;p&gt;Most agents today are short-lived. Their state is rebuilt from a conversation history, a vector store or a set of external systems each time they run. As agents become persistent software, they need somewhere durable to keep:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;long-term memory&lt;/li&gt;
&lt;li&gt;the entities they know about and how those entities relate&lt;/li&gt;
&lt;li&gt;current and historical state&lt;/li&gt;
&lt;li&gt;tasks and intermediate results&lt;/li&gt;
&lt;li&gt;documents and embeddings&lt;/li&gt;
&lt;li&gt;permissions and identity&lt;/li&gt;
&lt;li&gt;state shared transactionally with other agents&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That state has to outlive whichever model or process happens to be running the agent at the time. SurrealDB is built to hold it, and SurrealDB Agent Memory, launched in October, is the managed product built on the same engine for exactly this job.&lt;/p&gt;

&lt;h2&gt;
  
  
  SurrealDB Earth: serverless SurrealDB on Cloudflare
&lt;/h2&gt;

&lt;p&gt;SurrealDB Earth runs SurrealDB serverless on Cloudflare's global points of presence. Instead of provisioning a server and sizing it in advance, your application or agent creates databases on demand, and Earth decides where and how they run. Every Earth database is its own isolated instance, with dedicated storage and commit log, keeping each tenant's data separate. Each one is fully transactional and spins up and down on demand. Earth is web-native, so it connects over HTTP and WebSocket.&lt;/p&gt;

&lt;p&gt;A database starts with its first query, in ~300ms from cold, and scales to zero instantly when idle, so you pay for requests and storage, with no idle server costs. Its data stays durable in Cloudflare's storage.&lt;/p&gt;

&lt;p&gt;That makes fine-grained isolation practical. A SaaS platform can give each customer a database, an application can give each project one, and an AI platform can give an agent a persistent database of its own when it needs one. Each one's data is isolated, and removing a customer removes their database.&lt;/p&gt;

&lt;p&gt;Scale is one reason to choose Earth, and not the only one. At peak, Earth handles 10+ billion rows per second, fully transactional.&lt;/p&gt;

&lt;p&gt;Start free on Earth with no card, see the full &lt;a href="https://surrealdb.com/pricing" rel="noopener noreferrer"&gt;Earth pricing&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SurrealDS: compute is replaceable, data stays durable
&lt;/h2&gt;

&lt;p&gt;SurrealDS is distributed storage for workloads that grow beyond a single machine and runs on object-backed storage. It separates compute from durable storage, a pattern common in analytical databases and rare in transactional ones. Query nodes keep the state and caches they need to run queries quickly, while durable database pages live in shared object storage such as Amazon S3. Compute and storage each grow on their own, with no manual sharding.&lt;/p&gt;

&lt;p&gt;The design assumes that nodes, disks and networks will fail. A write is acknowledged only once it is on two disks in two zones, and a replacement node recovers from the surviving copy and object storage rather than from the machine that failed. The protocol is model-checked. The aim is predictable behaviour when infrastructure stops being healthy, not only availability when everything is fine.&lt;/p&gt;

&lt;p&gt;Together with Earth, it gives SurrealDB one range:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One agent: one lightweight database on Earth.&lt;/li&gt;
&lt;li&gt;Many agents: many isolated databases, each its own Earth instance.&lt;/li&gt;
&lt;li&gt;Large agent platforms: shared SurrealDS clusters, where many agents read and write the same data transactionally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The data model is the same at each step. SurrealDS is available in SurrealDB Cloud multi-node clusters and self-hosted Enterprise Edition deployments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory in one query
&lt;/h2&gt;

&lt;p&gt;Memory in one query is built into the engine. An agent's memory is several kinds of data at once: what something means, what it is connected to, and what was actually said. SurrealDB returns all three in one statement, inside one transaction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    text,
    -&amp;gt;mentions-&amp;gt;person.name AS people,
    search::score(1) AS relevance
FROM note
WHERE embedding &amp;lt;|5,40|&amp;gt; $question
    AND text @1@ 'contract renewal'
ORDER BY relevance DESC;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The example query finds the five notes nearest in meaning to the question, keeps those that mention a contract renewal, follows the graph to the people each note mentions, and ranks the results by relevance.&lt;/p&gt;

&lt;h2&gt;
  
  
  SurrealDB 4 adds PostgreSQL SQL and MySQL
&lt;/h2&gt;

&lt;p&gt;PostgreSQL and MySQL clients connect to SurrealDB 4 over their own wire protocols. SurrealDB 4 adds PostgreSQL SQL, selected for each connection, and the MySQL protocol with MySQL SQL. Each listener is off until you turn it on, and a connection picks its dialect. That SQL runs through the same query planner as SurrealQL and reaches the same records, so an agent can write the SQL it was trained on.&lt;/p&gt;

&lt;p&gt;The PostgreSQL dialect (select it with &lt;code&gt;SET dialect = 'pgsql'&lt;/code&gt;, or with &lt;code&gt;options=-c dialect=pgsql&lt;/code&gt; when you connect) supports joins, grouping, aggregates, inserts with &lt;code&gt;ON CONFLICT&lt;/code&gt;, schema changes, transactions, non-recursive &lt;code&gt;WITH&lt;/code&gt;, &lt;code&gt;COPY&lt;/code&gt; in text and CSV, and pgvector columns. The MySQL dialect supports joins, grouping, aggregates, non-recursive &lt;code&gt;WITH&lt;/code&gt; and &lt;code&gt;INSERT ... ON DUPLICATE KEY UPDATE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is a defined subset of SQL. Window functions, recursive CTEs and &lt;code&gt;FULL OUTER JOIN&lt;/code&gt; are refused with a named error (&lt;code&gt;0A000&lt;/code&gt;), and a few statements, such as &lt;code&gt;CREATE SCHEMA&lt;/code&gt; in the PostgreSQL dialect, are accepted but change nothing. The &lt;a href="https://surrealdb.com/docs/reference/rest-api/postgres-protocol" rel="noopener noreferrer"&gt;PostgreSQL&lt;/a&gt; and &lt;a href="https://surrealdb.com/docs/reference/rest-api/mysql-protocol" rel="noopener noreferrer"&gt;MySQL&lt;/a&gt; protocol references list what is supported, what is refused and where behaviour differs.&lt;/p&gt;

&lt;p&gt;For Node.js applications written for the MongoDB driver, mql.js 1.0 brings that driver's API to SurrealDB, including aggregation pipelines and Mongoose models. mongosh, Compass and MongoDB drivers in other languages cannot connect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Faster at every size
&lt;/h2&gt;

&lt;p&gt;A database scales furthest when each query costs less, so SurrealDB 4 rebuilds the query core to do less work for every query.  Our &lt;a href="https://surrealdb.com/surrealdb/benchmarks" rel="noopener noreferrer"&gt;benchmarks&lt;/a&gt; page goes into full details on the full results and how they were measured. We'll continue to expand our benchmarks for distributed database comparisons, vector search (HNSW throughput and recall), full-text search (BM25), graph query performance benchmarks, and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stability is a feature
&lt;/h2&gt;

&lt;p&gt;Some reliability work is not dramatic: finding edge cases, improving error handling, tightening correctness. It is a major part of this release. SurrealDB 4 includes more than 240 fixes to the database that no 3.x release contains, including more than 90 community bug reports on GitHub.&lt;/p&gt;

&lt;p&gt;Rebuilding a query core can quietly change years of behaviour, so the change was made behind a safety net: while the new engine was built, every query test ran on both the earlier engine and the new one, and failed if the two disagreed. Today more than 4,500 SurrealQL test files run in CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Also in SurrealDB 4
&lt;/h2&gt;

&lt;p&gt;SurrealDB also includes many other features such as: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ISO GQL support, for graph pattern matching&lt;/li&gt;
&lt;li&gt;Schema migrations: existing rows convert as they are read, and the table is rewritten in the background&lt;/li&gt;
&lt;li&gt;Filtered, exact and permission-aware vector search&lt;/li&gt;
&lt;li&gt;Python SDK 3&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Upgrading from 3.x
&lt;/h2&gt;

&lt;p&gt;SurrealDB 4 is recommended for new (greenfield) database deployments. For existing deployments running 3.x, we recommend upgrading to SurrealDB 4.1 once it becomes available. Our internal testing of the migration process has shown promising results, but we want to validate it further against a broader range of real-world workloads and deployment scenarios from our community before recommending it for production migrations. This additional validation will help us deliver a more robust and reliable upgrade experience in 4.1.&lt;/p&gt;

&lt;p&gt;For those who want to test upgrading from 3.x to SurrealDB 4, we've introduced an experimental in-place upgrade process designed to make the transition as seamless as possible, without requiring an export and import of your data. This requires explicit opt-in and should only be attempted after taking and verifying a backup, ideally using a copy of your data. The upgrade is one-way, meaning migrated datastores cannot be reopened with 3.x.&lt;/p&gt;

&lt;p&gt;Before testing the upgrade, we recommend updating to the latest 3.3 release, running the new &lt;code&gt;surreal db upgrade-check&lt;/code&gt; command to identify compatibility issues, and updating your SDKs.&lt;/p&gt;

&lt;p&gt;A few additional changes to be aware of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;RocksDB and IndexedDB have been replaced by SurrealKV.&lt;/strong&gt; Existing RocksDB datastores are automatically converted on first use, requiring additional time and disk space. Existing SurrealKV datastores also migrate to the new storage format.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Some indexes need rebuilding&lt;/strong&gt; to preserve query correctness, while others can be rebuilt to benefit from performance improvements in SurrealDB 4.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SurrealML has been removed.&lt;/strong&gt; Existing models must be exported, if needed, and removed before upgrading.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For detailed instructions, including how to enable the experimental upgrade, compatibility considerations and rollback options, see our &lt;a href="https://surrealdb.com/docs/build/migrating/from-old-surrealdb-versions/3x-to-4x" rel="noopener noreferrer"&gt;3.x to 4.0 upgrade guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://surrealdb.com/earth" rel="noopener noreferrer"&gt;Start free on SurrealDB Earth&lt;/a&gt; or &lt;a href="https://surrealdb.com/surrealdb/install" rel="noopener noreferrer"&gt;install SurrealDB 4&lt;/a&gt; to run it locally. See &lt;a href="https://surrealdb.com/4" rel="noopener noreferrer"&gt;everything in the release&lt;/a&gt;. For deploying SurrealDS clusters, &lt;a href="https://surrealdb.com/contact/sales" rel="noopener noreferrer"&gt;talk to our team&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The goal is one database that grows from a single lightweight workload to the infrastructure behind millions of users, devices and agents. SurrealDB 4 is the biggest step towards it so far. Thank you to everyone who reported a bug, opened a pull request or answered a question on Discord this year: a large part of this release is yours.&lt;/p&gt;

</description>
      <category>surrealdb</category>
      <category>database</category>
      <category>agentmemory</category>
      <category>ai</category>
    </item>
    <item>
      <title>Agent memory benchmarks are baked</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Thu, 15 Oct 2026 09:19:13 +0000</pubDate>
      <link>https://dev.to/surrealdb/agent-memory-benchmarks-are-baked-ca8</link>
      <guid>https://dev.to/surrealdb/agent-memory-benchmarks-are-baked-ca8</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every agent memory vendor publishes a benchmark score. While most of these scores are true, very few of them measure the same thing.&lt;/p&gt;

&lt;p&gt;We read the test harnesses (the code that runs a benchmark), prompts, judge settings and per-question output files behind the published scores on &lt;a href="https://arxiv.org/abs/2510.27246" rel="noopener noreferrer"&gt;BEAM&lt;/a&gt; and &lt;a href="https://snap-research.github.io/locomo/" rel="noopener noreferrer"&gt;LoCoMo&lt;/a&gt;, two benchmarks for agent memory, and we did the same for our own. A memory benchmark score is the result of several choices: which model writes the answers, which model judges them, which prompts they get and which scoring rule turns the judgements into a number. Change any one of these and the score changes. Without them, a headline score is hard to interpret.&lt;/p&gt;

&lt;p&gt;This post describes what we found when we ran SurrealDB Agent Memory on these benchmarks, what we changed in our own run, and every number behind our headline score, including the ones that lower it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A score is a recipe
&lt;/h2&gt;

&lt;p&gt;BEAM gives a memory system long conversations, up to ten million tokens, and then asks questions about them. An answering model writes each answer from what the memory system retrieves. For each question, the benchmark lists the points a correct answer must contain, called rubric items. A judge model scores each rubric item 0, 0.5 or 1, the question's score is the average of its items, and the headline is the mean across all questions.&lt;/p&gt;

&lt;p&gt;Each step has settings that a vendor chooses. Who answers? Who judges? Does the judge see the question? Does the answering prompt know what kind of question it is? Does half credit count? How is event ordering scored?&lt;/p&gt;

&lt;p&gt;While none of these settings is dishonest on its own, a headline score rarely says how they were set.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five ways a score gets easier
&lt;/h2&gt;

&lt;p&gt;All of these practices appear in published runs. The code and output files for each are linked from our &lt;a href="https://surrealdb.com/agent-memory/benchmarks" rel="noopener noreferrer"&gt;benchmarks page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The answering prompt includes parts of the answer.&lt;/strong&gt; BEAM stores metadata with each question, such as the topics a correct answer has to put in order. &lt;a href="https://hindsight.vectorize.io/" rel="noopener noreferrer"&gt;Hindsight&lt;/a&gt;'s April 2026 harness and &lt;a href="https://exabase.io/" rel="noopener noreferrer"&gt;Exabase&lt;/a&gt;'s published prompt add fields from this metadata to the answering prompt. In Hindsight's own outputs, 66 of 70 event-ordering answers name every expected topic, and none of those topics appears in the question. &lt;a href="https://hydradb.com/" rel="noopener noreferrer"&gt;HydraDB&lt;/a&gt; says it reused Hindsight's original prompts unchanged, and it has published no outputs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The question category chooses the prompt.&lt;/strong&gt; BEAM sorts its questions into categories, such as event ordering and instruction following. Hindsight, Exabase and &lt;a href="https://www.cognee.ai/" rel="noopener noreferrer"&gt;Cognee&lt;/a&gt; choose an answering prompt based on the question's category, and &lt;a href="https://honcho.dev/" rel="noopener noreferrer"&gt;Honcho&lt;/a&gt; sends instruction-following questions through a separate pipeline. In production, a memory system does not know in advance what kind of question it is about to answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The scoring rule gets more lenient.&lt;/strong&gt; The BEAM paper scores event ordering with Kendall tau, a measure of how closely the answer's order matches the correct order. A rubric average only checks whether each event is mentioned, in any order. &lt;a href="https://mem0.ai/" rel="noopener noreferrer"&gt;Mem0&lt;/a&gt; and Cognee use the rubric average. We use Kendall tau, as the paper does. Event ordering is our lowest-scoring category, so this choice lowers our mean, but it is the only rule of the two that checks whether the order is correct, which is what the category exists to test. Scored by rubric average, the same answers would read 79.3% instead of 77.2%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. The retrieval budget grows.&lt;/strong&gt; Mem0's headline on BEAM 1M (the version with conversations of one million tokens) gives the answering model up to 200 memories. Mem0’s own files show a score of 64.1% with 200 memories and 60.4% with 50. Our published run gives the answering model the top 50 memories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. On LoCoMo, the hardest questions are removed and the judge accepts near misses.&lt;/strong&gt; LoCoMo groups its questions into five categories. Category 5 holds the adversarial questions, which cannot be answered from the conversation, so a correct response says that the information is not there. Following the Mem0 paper, most published LoCoMo scores leave this category out. Mem0's judge also counts an answer as correct when it gives one correct item out of a list, or a date up to 14 days away from the right one. In April 2026, an &lt;a href="https://dev.to/penfieldlabs/we-audited-locomo-64-of-the-answer-key-is-wrong-and-the-judge-accepts-up-to-63-of-intentionally-33lg"&gt;audit by Penfield Labs&lt;/a&gt; found that LoCoMo's judge accepted 62.81% of answers that were deliberately wrong but on the right topic.&lt;/p&gt;

&lt;p&gt;The choice of models also affects the score. Most vendors use models from the same family to answer and to judge, and many use a stronger answering model than the original papers did. Some headline scores have no per-question files behind them at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Counting only full marks
&lt;/h2&gt;

&lt;p&gt;A BEAM mean hides partial credit. A question where every rubric item gets half marks scores 0.5, and it raises the mean just as a correct answer does.&lt;/p&gt;

&lt;p&gt;So we also counted something simpler: the share of questions where every rubric item got full marks. We call this the strict score. None of the vendors we compared publishes one, so we calculated it from their own per-question files wherever those files exist.&lt;/p&gt;

&lt;p&gt;On BEAM 1M:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;System&lt;/th&gt;
&lt;th&gt;Headline mean&lt;/th&gt;
&lt;th&gt;Strict&lt;/th&gt;
&lt;th&gt;Answering model&lt;/th&gt;
&lt;th&gt;Judge&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SurrealDB Agent Memory&lt;/td&gt;
&lt;td&gt;77.2%&lt;/td&gt;
&lt;td&gt;57.1%&lt;/td&gt;
&lt;td&gt;Gemini 3.8 Flash&lt;/td&gt;
&lt;td&gt;Gemini 3.5 Flash Lite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exabase&lt;/td&gt;
&lt;td&gt;75.0%&lt;/td&gt;
&lt;td&gt;48.0%&lt;/td&gt;
&lt;td&gt;Gemini 3 Flash Preview&lt;/td&gt;
&lt;td&gt;Gemini 2.5 Flash-Lite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hindsight&lt;/td&gt;
&lt;td&gt;73.9%&lt;/td&gt;
&lt;td&gt;48.4%&lt;/td&gt;
&lt;td&gt;Gemini 3.1 Pro Preview&lt;/td&gt;
&lt;td&gt;Gemini 2.5 Flash-Lite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mem0 (top-200)&lt;/td&gt;
&lt;td&gt;64.1%&lt;/td&gt;
&lt;td&gt;40.1%&lt;/td&gt;
&lt;td&gt;GPT-5&lt;/td&gt;
&lt;td&gt;GPT-5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Honcho&lt;/td&gt;
&lt;td&gt;63.1%&lt;/td&gt;
&lt;td&gt;41.4%&lt;/td&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;Claude Sonnet 4.5 (harness default)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HydraDB&lt;/td&gt;
&lt;td&gt;82.0%&lt;/td&gt;
&lt;td&gt;Not countable&lt;/td&gt;
&lt;td&gt;Not stated&lt;/td&gt;
&lt;td&gt;GPT-5.4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every strict score we could count is between about 20 and 27 points below its headline mean. A gap of this size is expected, because the mean gives credit for answers that are partly correct. Publishing both numbers shows how much of each score comes from that partial credit.&lt;/p&gt;

&lt;p&gt;Read the table as a record of how each score was produced. The rows use different answering models, different judges and different retrieval budgets, so they cannot be ranked against each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we did in our own run
&lt;/h2&gt;

&lt;p&gt;We followed the BEAM paper wherever we could, and we list every place where we did not.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Same judge prompt.&lt;/strong&gt; The judge prompt is the official BEAM prompt. The judge model is Gemini 3.5 Flash Lite instead of the GPT-4.1 Mini that the authors' code uses, so the judge model is one of the ways our run differs from the paper.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nothing extra in the prompts.&lt;/strong&gt; The question category is never given to the answering model, and the judge sees the answer and the rubric but not the question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Half marks counted, and shown separately.&lt;/strong&gt; The mean counts 0.5 scores, as the paper specifies. The strict score of 57.1% counts only full marks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Our own prompt and retrieval.&lt;/strong&gt; The run answers with the product's own prompt and retrieval, instead of the paper's baseline prompt with the top 5 results.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ten non-default settings.&lt;/strong&gt; We switched on ten retrieval and chat settings that the product does not enable by default. Eight change retrieval: &lt;code&gt;SPECTRON_RETRIEVAL_TURN_ORDER&lt;/code&gt;, &lt;code&gt;SPECTRON_RETRIEVAL_CLAIM_CONFLICTS&lt;/code&gt;, &lt;code&gt;SPECTRON_RETRIEVAL_GROUNDING_CHECK&lt;/code&gt;, &lt;code&gt;SPECTRON_RETRIEVAL_EPISODIC_TREE&lt;/code&gt;, &lt;code&gt;SPECTRON_RETRIEVAL_EVENT_DIGESTS&lt;/code&gt;, &lt;code&gt;SPECTRON_RETRIEVAL_TREE_BREADTH&lt;/code&gt;, &lt;code&gt;SPECTRON_RETRIEVAL_GROUNDING_PROVENANCE&lt;/code&gt; and &lt;code&gt;SPECTRON_RETRIEVAL_TREE_ADAPTIVE_BUDGET&lt;/code&gt;. Two change how the chat answer is written: &lt;code&gt;SPECTRON_CHAT_ANSWER_CONTRACTS&lt;/code&gt; and &lt;code&gt;SPECTRON_CHAT_STANDING_INSTRUCTIONS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event ordering scored by Kendall tau.&lt;/strong&gt; As in the paper, the score checks whether the order is correct. We score 49.7% in this category, and 1 of its 70 questions gets full marks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failures score zero.&lt;/strong&gt; When a judge call fails twice, the rubric item scores 0, and a score outside the range 0 to 1 is clamped to that range. The BEAM reference code stops scoring the whole conversation instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On LoCoMo, our strict score is 75.8% across all five categories, including the adversarial one, over 1,986 questions. Under Mem0's own protocol, which leaves out the adversarial category and uses the more lenient judge, the same system scores 92.6% with GPT-5 answering and judging, and 90.1% with GPT-OSS 120B answering and GPT-4o judging. We publish all three numbers together so that readers can compare them directly.&lt;/p&gt;

&lt;p&gt;Our 700 BEAM 1M answers are published on the &lt;a href="https://surrealdb.com/agent-memory/benchmarks" rel="noopener noreferrer"&gt;benchmarks page&lt;/a&gt;, each with its question and rubric, so you can grade them with any judge you like. The harness commands are not public yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Be your own judge
&lt;/h2&gt;

&lt;p&gt;Before you trust any memory benchmark score, including ours, ask five questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Which model answered, and which model judged?&lt;/li&gt;
&lt;li&gt;Did the prompt know the question's category, or any part of the answer?&lt;/li&gt;
&lt;li&gt;Does the headline include partial credit, and what is the strict score?&lt;/li&gt;
&lt;li&gt;How much context did the answering model get?&lt;/li&gt;
&lt;li&gt;Are the per-question files published, so that you can check the count yourself?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A score that comes with answers to all five can be checked. A score without them has to be taken on trust.&lt;/p&gt;

&lt;p&gt;Every run, judge, protocol and vendor comparison is on our &lt;a href="https://surrealdb.com/agent-memory/benchmarks" rel="noopener noreferrer"&gt;benchmarks page&lt;/a&gt;, with sources linked for every claim.&lt;/p&gt;

</description>
      <category>agentmemory</category>
      <category>ai</category>
      <category>agents</category>
      <category>news</category>
    </item>
    <item>
      <title>Introducing SurrealDB Agent Memory</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Thu, 15 Oct 2026 08:51:50 +0000</pubDate>
      <link>https://dev.to/surrealdb/introducing-surrealdb-agent-memory-e8p</link>
      <guid>https://dev.to/surrealdb/introducing-surrealdb-agent-memory-e8p</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI agents have a memory problem: most of what they know lives either in the current context window, in local siloed memory solutions, or in an external retrieval system.&lt;/p&gt;

&lt;p&gt;That works up to a point. But once an agent needs to remember information across sessions, distinguish current facts from old ones, understand relationships between entities, or explain where a fact came from, storing conversation history or embedding chunks into a vector database stops being enough.&lt;/p&gt;

&lt;p&gt;Today, we’re introducing &lt;strong&gt;SurrealDB Agent Memory&lt;/strong&gt;, a memory and knowledge layer for AI agents built on SurrealDB. It takes conversations, documents, and structured data and turns them into persistent, queryable memory: entities, attributes, relationships, instructions, source information, embeddings, and retrieval traces stored together in SurrealDB.&lt;/p&gt;

&lt;p&gt;The goal is fairly simple: give agents persistent state that can change over time without losing track of what changed, when it changed, or why.&lt;/p&gt;

&lt;h2&gt;
  
  
  How we benchmark Agent Memory
&lt;/h2&gt;

&lt;p&gt;Memory benchmarks are easy to quote and hard to compare. Scores can vary significantly depending on the answering model, judge model, number of retrieved results, and which settings are enabled. So we’ve published our results, methodology, and configuration on a dedicated &lt;a href="https://surrealdb.com/agent-memory/benchmarks" rel="noopener noreferrer"&gt;benchmarks page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;BEAM 1M&lt;/strong&gt;, a long-term memory benchmark based on conversations of around one million tokens, Agent Memory scores:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;77.2%&lt;/strong&gt; mean score&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;57.1%&lt;/strong&gt; strict accuracy, where an answer only counts if it is fully correct&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;82.9%&lt;/strong&gt; of questions scoring at least 0.5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We report strict accuracy alongside the mean because partially correct answers can raise the average. Strict accuracy shows how often the system produced a fully correct answer, which is an important distinction for production use.&lt;/p&gt;

&lt;p&gt;We also document where our run differs from the reference setup. The 77.2% result uses Agent Memory’s own retrieval and prompting pipeline rather than the paper’s top-5 baseline, enables ten retrieval and chat settings that are not on by default, and uses a different judge model from the authors’ reference implementation. Our weakest category is &lt;strong&gt;event ordering&lt;/strong&gt;, at &lt;strong&gt;49.7%&lt;/strong&gt;. Temporal reasoning remains an area we are actively working to improve.&lt;/p&gt;

&lt;p&gt;Our reporting follows four rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Name the models.&lt;/strong&gt; Every result identifies both the answering and grading models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Show strict accuracy alongside the mean.&lt;/strong&gt; We don’t report only the more favorable aggregate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid ranking claims.&lt;/strong&gt; Different models, judges, retrieval settings, and configurations can make leaderboards compare setups rather than systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document every deviation.&lt;/strong&gt; Any departure from the benchmark’s reference methodology is listed explicitly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Where other vendors publish per-question results, we calculate strict accuracy from those files using the same method. The benchmarks page also documents eleven practices that can materially affect scores and shows which apply to each published result, including ours.&lt;/p&gt;

&lt;p&gt;We’ll publish our per-question results and run configuration so the numbers can be independently checked. Results for &lt;strong&gt;BEAM 10M&lt;/strong&gt; and &lt;strong&gt;LoCoMo&lt;/strong&gt; are available on the same page.&lt;/p&gt;

&lt;h2&gt;
  
  
  From retrieval to structured, evolving memory
&lt;/h2&gt;

&lt;p&gt;The simplest implementation of agent memory is to store previous messages, generate embeddings, and retrieve the most similar chunks when the agent needs context. That works for basic recall, but it becomes harder to manage as information changes over time.&lt;/p&gt;

&lt;p&gt;If a user first says: "&lt;em&gt;I work at Pied Piper as VP of Engineering&lt;/em&gt;&lt;em&gt;" and later says: "*I’ve moved to Hooli as CTO&lt;/em&gt;"&lt;em&gt;, both statements may be relevant to the question “*Where does this person work?&lt;/em&gt;”. Similarity alone does not tell the system which one is current. SurrealDB Agent Memory treats this as a state-management problem, not just a retrieval problem.&lt;/p&gt;

&lt;p&gt;When new information arrives, it is first extracted into structured memory such as entities, attributes, relationships, instructions, and uncertainties. That structured information is then reconciled against what the system already knows.&lt;/p&gt;

&lt;p&gt;Reconciliation determines whether the new information should be added, update an existing fact, supersede an older one, or remain uncertain because sources disagree. So instead of storing a growing collection of disconnected chunks, Agent Memory maintains an evolving model of what is currently believed, what was true previously, and how that state changed over time.&lt;/p&gt;

&lt;p&gt;This makes it possible to answer both: "&lt;em&gt;Gilfoyle’s role now is CTO&lt;/em&gt;" and "&lt;em&gt;Gilfoyle's role last year was VP of Engineering&lt;/em&gt;". The older fact is not deleted. It remains part of the historical record while the newer fact becomes current.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every fact keeps its source
&lt;/h2&gt;

&lt;p&gt;A useful memory system should be able to answer more than “&lt;em&gt;What do I know?&lt;/em&gt;”. It should also be able to answer:&lt;em&gt;"Where did I learn this?&lt;/em&gt;". Fact-bearing records in Agent Memory carry structured provenance. This can include the originating conversation or document, the location of the source text, the source type, its trust level, and lineage when a fact was derived from other information. This means an application can trace a stored fact back to the conversation turn or document passage that produced it.&lt;/p&gt;

&lt;p&gt;That is useful when debugging an agent, but it also changes how applications can present answers. Instead of simply generating a response and hoping the retrieved context was correct, applications can expose the underlying sources that contributed to it. Agent Memory also stores retrieval, reconciliation, and response traces, making it possible to inspect which records were considered and how a stored belief changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time is part of the data model
&lt;/h2&gt;

&lt;p&gt;Facts often have more than one relevant timestamp. Something may have been true in January, mentioned in March, and stored by the database in April.&lt;/p&gt;

&lt;p&gt;Agent Memory uses a tri-temporal model to distinguish different notions of time, including when information was valid in the real world, when the system knew about it, and the database's own transaction history.&lt;/p&gt;

&lt;p&gt;This lets applications ask questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is true now?&lt;/li&gt;
&lt;li&gt;What did we believe last month?&lt;/li&gt;
&lt;li&gt;What was true at a specific point in time?&lt;/li&gt;
&lt;li&gt;When was this information corrected?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without temporal modelling, older and newer facts tend to become competing chunks in the retrieval layer. With temporal state, the database itself can distinguish current information from historical information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Documents and conversations in one graph
&lt;/h2&gt;

&lt;p&gt;Agents typically need two types of information: &lt;strong&gt;authoritative knowledge&lt;/strong&gt; (policies, documentation, repositories, product data, manuals, and other curated sources) and &lt;strong&gt;experiential knowledge&lt;/strong&gt; (what users said, decisions made during previous sessions, preferences, observations, and things the agent itself has learned). Agent Memory stores both in one SurrealDB substrate rather than maintaining separate databases for documents, conversations, vectors, and relationships.&lt;/p&gt;

&lt;p&gt;Because SurrealDB supports multiple data models in the same database, documents, entities, relations, embeddings, and traces can be stored and queried together under the same transactional system. That means a retrieval query can combine several different signals rather than requiring application code to join results from separate systems, improving accuracy, retrieval latency, and LLM token usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Retrieval is hybrid
&lt;/h2&gt;

&lt;p&gt;Not every memory question is a semantic-search problem. Finding a paraphrased passage benefits from vector search. Finding an exact product ID benefits from full-text search. Finding something related to a particular customer, person, or project can benefit from graph relationships.&lt;/p&gt;

&lt;p&gt;Agent Memory supports hybrid retrieval across these different signals. Vector similarity, full-text search, graph structure, and other ranking inputs can contribute to the same retrieval process. It also uses a tiered read path.&lt;/p&gt;

&lt;p&gt;Simple questions can resolve directly against structured memory. Previously generated responses can sometimes be reused when the facts they depended on remain current. More complex questions can escalate to broader hybrid retrieval and model synthesis.&lt;/p&gt;

&lt;p&gt;This is useful because asking “&lt;em&gt;What timezone does this user prefer&lt;/em&gt;?” should not necessarily require the same retrieval and inference path as “&lt;em&gt;Summarise everything relevant to this customer's current project.&lt;/em&gt;”&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory has a lifecycle
&lt;/h2&gt;

&lt;p&gt;Not everything an agent learns should remain equally important forever. Agent Memory separates three different operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Supersession&lt;/strong&gt; handles information that has been replaced. The previous fact remains in history but is no longer current.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decay&lt;/strong&gt; reduces the importance of information as it becomes less relevant, while allowing frequently useful memories to be reinforced.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forget&lt;/strong&gt; removes information from the agent's active working set when explicit removal is required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keeping these concepts separate prevents a common problem where “old,” “wrong,” and “deleted” all end up meaning the same thing. They are not the same thing, and applications often need different behaviour for each.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scoping memory to the right user, team, or agent
&lt;/h2&gt;

&lt;p&gt;Memory is only useful if the agent retrieves the right information for the current situation. SurrealDB Agent Memory uses &lt;strong&gt;scopes&lt;/strong&gt; to partition memory within a Context. A scope is a hierarchical path such as: &lt;code&gt;org/piedpiper/user/gilfoyle&lt;/code&gt; or &lt;code&gt;org/piedpiper/project/thebox&lt;/code&gt;. This lets applications decide which memories belong to an organisation, user, team, project, or another boundary that makes sense for the product.&lt;/p&gt;

&lt;p&gt;For example, a customer-support agent might store company-wide policies at: &lt;code&gt;org/piedpiper&lt;/code&gt; while Gilfoyle's preferences and previous interactions live under: &lt;code&gt;org/piedpiper/user/hooli&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When the agent is working with Gilfoyle, it can retrieve both the organisation-level knowledge and Gilfoyle's own memory without exposing another user's information. Session scopes are also propagated to the records created during that session, so new memories remain attributed to the right part of the application.&lt;/p&gt;

&lt;p&gt;Scopes are different from permissions. Scope determines where a memory belongs; grants determine who is allowed to read or write it. Together, they provide a practical way to build multi-user and multi-tenant agents without maintaining a separate memory database for every user.&lt;/p&gt;

&lt;p&gt;For stronger isolation, Agent Memory uses &lt;strong&gt;Contexts&lt;/strong&gt;. A useful rule is: scopes partition data within the same application; Contexts separate entirely different memory environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Built on SurrealDB
&lt;/h2&gt;

&lt;p&gt;Agent Memory runs as an application layer in front of SurrealDB. A Context provides the isolation boundary for a memory environment, with its own SurrealDB namespace and database. Within a Context, conversations, documents, entities, relationships, embeddings, traces, and other memory state live together.&lt;/p&gt;

&lt;p&gt;Contexts are managed through SurrealDB Studio, where developers can work with conversations, inspect known entities, upload documents, explore the knowledge graph, and see what the system retrieved and learned during individual interactions.&lt;/p&gt;

&lt;p&gt;Applications can integrate through the REST API, MCP, Python and TypeScript SDKs, or adapters for agent frameworks including LangChain, OpenAI Agents, and Vercel AI SDK.&lt;/p&gt;

&lt;p&gt;A basic workflow looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Remember&lt;/strong&gt;: Send a conversation turn, document, or fact to Agent Memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extract&lt;/strong&gt;: Convert unstructured input into entities, attributes, relationships, instructions, and other structured state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reconcile&lt;/strong&gt;: Compare that information with existing memory and decide what is new, what changed, and where uncertainty exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Store&lt;/strong&gt;: Write the resulting state, provenance, embeddings, relationships, and traces into SurrealDB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recall&lt;/strong&gt;: Query memory through structured lookups or hybrid retrieval, scoped to the relevant user, agent, organisation, or application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That creates a loop in which the agent's state can continue evolving between conversations instead of being reconstructed from scratch every time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory as persistent application state
&lt;/h2&gt;

&lt;p&gt;We think agent memory becomes much easier to reason about once it is treated less like a cache around an LLM and more like persistent application state. Agents need to know what is currently true, what used to be true, where information came from, which sources should be trusted, and how different pieces of information relate to one another. Those are fundamentally data problems.&lt;/p&gt;

&lt;p&gt;SurrealDB Agent Memory brings those capabilities together in one layer: structured memory, document knowledge, graph relationships, temporal history, provenance, reconciliation, and retrieval, backed by SurrealDB.&lt;/p&gt;

&lt;p&gt;The result is agents that do not simply retrieve previous text, but can can maintain a persistance, queryable shared memory layer of what it has learned - and update that layer as the world changes. &lt;a href="https://studio.surrealdb.com/current/contexts" rel="noopener noreferrer"&gt;Get started with Agent Memory&lt;/a&gt; or &lt;a href="https://surrealdb.com/docs/agent-memory" rel="noopener noreferrer"&gt;explore the documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>surrealdb</category>
      <category>agentmemory</category>
      <category>ai</category>
      <category>agents</category>
    </item>
    <item>
      <title>We are replacing RocksDB with SurrealKV 1.0</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Wed, 14 Oct 2026 08:30:00 +0000</pubDate>
      <link>https://dev.to/surrealdb/we-are-replacing-rocksdb-with-surrealkv-10-4pi9</link>
      <guid>https://dev.to/surrealdb/we-are-replacing-rocksdb-with-surrealkv-10-4pi9</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SurrealKV 1.0 is a new open source persistent storage engine for SurrealDB, written in Rust and released under Apache 2.0 on 13 October 2026. With synchronous durability, it reads 7.95× faster than RocksDB and 73.7× faster than SlateDB, and it will be the only persistent storage engine in SurrealDB 4.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why replace RocksDB?
&lt;/h2&gt;

&lt;p&gt;RocksDB is a very good engine, and SurrealDB has run on it for years. It is also a large C++ library that SurrealDB does not control. SurrealKV is an engine we can read from end to end, change when SurrealDB needs it to change, and ship as a Rust crate.&lt;/p&gt;

&lt;p&gt;SurrealKV is a log-structured merge-tree with snapshot-isolated transactions. It runs embedded in an application and as the storage layer of a SurrealDB server.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does SurrealKV reach these numbers?
&lt;/h2&gt;

&lt;p&gt;Three design decisions each remove shared work or shared waiting from a hot path.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A radix-tree memtable.&lt;/strong&gt; Writes land in a concurrent adaptive radix tree allocated from a fixed arena. RocksDB and Pebble use skiplists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A commit ring.&lt;/strong&gt; Many committers validate their transactions at the same time. One flusher task then orders what has accumulated into a group, appends it to the write-ahead log with at most one fsync, applies it to the memtable and publishes it. A burst of commits costs one log append.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cheap reads.&lt;/strong&gt; A read pins a sequence number and nothing else.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What else does SurrealKV include?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Versioned trees&lt;/strong&gt;, opt in. &lt;code&gt;get_at&lt;/code&gt; reads a key as of a time, &lt;code&gt;history&lt;/code&gt; returns every version of a key, and compaction keeps versions for a retention period that you set.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Value separation&lt;/strong&gt;, opt in, for values larger than 1 KiB, so that compaction does not rewrite large values again and again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Encryption at rest&lt;/strong&gt;, transparent, with AES-256-GCM or XChaCha20-Poly1305.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Differential testing&lt;/strong&gt; against an in-memory reference model: 500 seeds of 5,000 steps each, 2,500,000 operations, in every CI run. Any divergence fails the run.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What do the benchmarks show?
&lt;/h2&gt;

&lt;p&gt;With synchronous durability, every commit is flushed to disk before it returns. SurrealKV 1.0 delivered these results on 13 October 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engine&lt;/th&gt;
&lt;th&gt;Point reads (OPS)&lt;/th&gt;
&lt;th&gt;Creates (OPS)&lt;/th&gt;
&lt;th&gt;Updates (OPS)&lt;/th&gt;
&lt;th&gt;Deletes (OPS)&lt;/th&gt;
&lt;th&gt;Scans (OPS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SurrealKV&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;6,804,864&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;229,376&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;221,341&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;264,089&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;905,132&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RocksDB&lt;/td&gt;
&lt;td&gt;855,851&lt;/td&gt;
&lt;td&gt;8,568&lt;/td&gt;
&lt;td&gt;36,263&lt;/td&gt;
&lt;td&gt;32,043&lt;/td&gt;
&lt;td&gt;852,661&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SlateDB&lt;/td&gt;
&lt;td&gt;92,303&lt;/td&gt;
&lt;td&gt;8,257&lt;/td&gt;
&lt;td&gt;8,122&lt;/td&gt;
&lt;td&gt;8,242&lt;/td&gt;
&lt;td&gt;17,985&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Against RocksDB, SurrealKV is 7.95× faster on point reads, 6.10× faster on updates, 8.24× faster on deletes and 1.06× faster on range scans. Against SlateDB, which ran on local disk and not on object storage, it is 73.7× faster on point reads and 27.3× faster on updates.&lt;/p&gt;

&lt;p&gt;SurrealKV creates records 26.8× faster than RocksDB. RocksDB's create rate with synchronous durability is far below its own update rate of 36,263 operations a second, and we have not explained why, so this post does not headline it.&lt;/p&gt;

&lt;p&gt;The benchmark ran with &lt;a href="https://github.com/surrealdb/crud-bench" rel="noopener noreferrer"&gt;crud-bench&lt;/a&gt; on an AMD Ryzen Threadripper 9970X (32 cores, 64 threads) with 128 GB of RAM and a 4 TB NVMe SSD. It used 500,000 keys, 48 worker threads and 128 clients. The harness runs SurrealKV with value separation on and a larger memtable than the engine's defaults. Each figure is a single run. Fjall, ReDB, LMDB and libmdbx are not in the table, because their runs with synchronous durability were too slow to finish at this dataset size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where is RocksDB faster?
&lt;/h2&gt;

&lt;p&gt;Without synchronous durability, RocksDB is faster at writes. SurrealKV is 1.88× slower on creates, 2.22× slower on updates and 2.41× slower on deletes, and 8.26× faster on point reads.&lt;/p&gt;

&lt;p&gt;Without synchronous durability, the engines also make different promises about what survives a crash, so those figures measure speed and not safety. Only the synchronous-durability table compares engines that each flush before acknowledging.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do range scans compare?
&lt;/h2&gt;

&lt;p&gt;Without synchronous durability, SurrealKV scans the first 100 key-value pairs of the dataset 896,366 times a second. LMDB leads that scan at 1,192,772 scans a second, and RocksDB manages 851,848. The table shows scans per second over the same 500,000 keys, with 5,000,000 iterations of each scan.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engine&lt;/th&gt;
&lt;th&gt;Limit (OPS)&lt;/th&gt;
&lt;th&gt;Keys, limit (OPS)&lt;/th&gt;
&lt;th&gt;Skip + limit (OPS)&lt;/th&gt;
&lt;th&gt;Keys, skip + limit (OPS)&lt;/th&gt;
&lt;th&gt;Full count (OPS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SurrealKV&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;896,366&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2,313,942&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;96,365&lt;/td&gt;
&lt;td&gt;98,612&lt;/td&gt;
&lt;td&gt;402&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RocksDB&lt;/td&gt;
&lt;td&gt;851,848&lt;/td&gt;
&lt;td&gt;851,580&lt;/td&gt;
&lt;td&gt;35,539&lt;/td&gt;
&lt;td&gt;35,902&lt;/td&gt;
&lt;td&gt;159&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SlateDB&lt;/td&gt;
&lt;td&gt;26,187&lt;/td&gt;
&lt;td&gt;26,266&lt;/td&gt;
&lt;td&gt;7,460&lt;/td&gt;
&lt;td&gt;7,477&lt;/td&gt;
&lt;td&gt;87&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fjall&lt;/td&gt;
&lt;td&gt;132,698&lt;/td&gt;
&lt;td&gt;151,861&lt;/td&gt;
&lt;td&gt;4,335&lt;/td&gt;
&lt;td&gt;4,383&lt;/td&gt;
&lt;td&gt;42.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ReDB&lt;/td&gt;
&lt;td&gt;561,837&lt;/td&gt;
&lt;td&gt;571,629&lt;/td&gt;
&lt;td&gt;44,438&lt;/td&gt;
&lt;td&gt;44,462&lt;/td&gt;
&lt;td&gt;249&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LMDB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1,192,772&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1,195,166&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;549,220&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;552,090&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;902&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;libmdbx&lt;/td&gt;
&lt;td&gt;384,128&lt;/td&gt;
&lt;td&gt;260,769&lt;/td&gt;
&lt;td&gt;183,361&lt;/td&gt;
&lt;td&gt;185,073&lt;/td&gt;
&lt;td&gt;848&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limit&lt;/strong&gt; (&lt;code&gt;select(*) limit(100)&lt;/code&gt;) returns the first 100 key-value pairs of the range. &lt;strong&gt;Keys, limit&lt;/strong&gt; (&lt;code&gt;select(id) limit(100)&lt;/code&gt;) returns only the keys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skip + limit&lt;/strong&gt; (&lt;code&gt;select(*) start(5000) limit(100)&lt;/code&gt;) walks and discards 5,000 entries before returning 100. &lt;strong&gt;Keys, skip + limit&lt;/strong&gt; returns only the keys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full count&lt;/strong&gt; (&lt;code&gt;count()&lt;/code&gt;) visits every key in the range.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Against RocksDB, SurrealKV is 1.05× faster on the first 100 pairs, 2.72× faster on a keys-only scan of the first 100 entries, 2.71× faster on scans that skip 5,000 entries and 2.53× faster on full counts. SurrealKV leads every engine on the keys-only scan, at 2,313,942 scans a second.&lt;/p&gt;

&lt;p&gt;LMDB leads SurrealKV on the first 100 key-value pairs (1.33× faster), on scans that skip 5,000 entries (5.70× faster) and on full counts (2.24× faster).&lt;/p&gt;

&lt;h2&gt;
  
  
  How much memory does SurrealKV use?
&lt;/h2&gt;

&lt;p&gt;SurrealKV has the lowest resting memory of the seven engines measured, at 221 MiB, against 590 MiB for RocksDB. Resting and peak memory are the lowest and highest process memory sampled across the whole benchmark run, without synchronous durability.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engine&lt;/th&gt;
&lt;th&gt;Resting memory&lt;/th&gt;
&lt;th&gt;Peak memory&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SurrealKV&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;221 MiB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.79 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RocksDB&lt;/td&gt;
&lt;td&gt;590 MiB&lt;/td&gt;
&lt;td&gt;1.02 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SlateDB&lt;/td&gt;
&lt;td&gt;265 MiB&lt;/td&gt;
&lt;td&gt;2.73 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fjall&lt;/td&gt;
&lt;td&gt;627 MiB&lt;/td&gt;
&lt;td&gt;1.71 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ReDB&lt;/td&gt;
&lt;td&gt;257 MiB&lt;/td&gt;
&lt;td&gt;2.17 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LMDB&lt;/td&gt;
&lt;td&gt;776 MiB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;826 MiB&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;libmdbx&lt;/td&gt;
&lt;td&gt;40.98 GiB&lt;/td&gt;
&lt;td&gt;117.71 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;SurrealKV's peak memory of 1.79 GiB is higher than that of RocksDB (1.02 GiB) and LMDB (826 MiB), because parallel commits buffer active batches. The libmdbx figures are what the harness measured, and we have not investigated them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where is the design written down?
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://surrealdb.com/static/whitepapers/surrealkv.pdf" rel="noopener noreferrer"&gt;SurrealKV whitepaper&lt;/a&gt;, "A Versioned LSM Engine with Radix-Tree Memtables and a Commit Ring", explains how SurrealKV reaches these numbers, what each design decision costs and what the measurements do not cover.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can you run the benchmark yourself?
&lt;/h2&gt;

&lt;p&gt;Every figure comes from one command on one machine. Run it on your own hardware:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;CRUD_BENCH_CONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;config/memory.toml ./run.sh &lt;span class="nt"&gt;-d&lt;/span&gt; surrealkv &lt;span class="nt"&gt;--no-build&lt;/span&gt; &lt;span class="nt"&gt;--optimised&lt;/span&gt; &lt;span class="nt"&gt;--sync&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; 500000 &lt;span class="nt"&gt;-c&lt;/span&gt; 128 &lt;span class="nt"&gt;-t&lt;/span&gt; 48
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change the &lt;code&gt;-d&lt;/code&gt; flag to run a comparator, and remove &lt;code&gt;--sync&lt;/code&gt; to run without synchronous durability. If you find a fairer configuration for a comparator, open an issue or a pull request on the &lt;a href="https://github.com/surrealdb/crud-bench" rel="noopener noreferrer"&gt;crud-bench repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;SurrealKV is open source on &lt;a href="https://github.com/surrealdb/surrealkv" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. To use it in a Rust project, add the crate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo add surrealkv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Speed or durability? Yes. Stop choosing.&lt;/p&gt;

</description>
      <category>database</category>
      <category>news</category>
      <category>opensource</category>
      <category>storageengine</category>
    </item>
    <item>
      <title>Our commitment to open source: show the code, run the numbers</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Tue, 13 Oct 2026 09:03:27 +0000</pubDate>
      <link>https://dev.to/surrealdb/our-commitment-to-open-source-show-the-code-run-the-numbers-3oj7</link>
      <guid>https://dev.to/surrealdb/our-commitment-to-open-source-show-the-code-run-the-numbers-3oj7</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We commit to three things: show the code, run the numbers, and say what we did not measure. SurrealKV and SurrealMX are open source under Apache 2.0, SurrealDB is source available under the Business Source License 1.1, and every benchmark we publish comes with the command, the hardware and the method behind it.&lt;/p&gt;

&lt;p&gt;A database is a trust relationship. It holds your data, it decides what survives a crash, and it decides who can see what. Infrastructure that agents depend on, running unattended at a scale nobody can supervise, has to earn that trust in a way anyone can check. This post sets out how we intend to earn it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does SurrealDB publish its code?
&lt;/h2&gt;

&lt;p&gt;A claim about a database is only worth what you can check. There are three ways to check ours: read the code, run the benchmark, and read the paper that explains the design and its limits. We publish all three.&lt;/p&gt;

&lt;p&gt;That is why you can read the SurrealDB source, why the two new storage engines are open source, and why every benchmark we publish comes with the command to run it. When a database tells you it is fast, correct or safe, you should not have to take its word for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does source available mean?
&lt;/h2&gt;

&lt;p&gt;We use two terms and keep them apart.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Source available&lt;/strong&gt; means you can read the code and run it yourself, under a licence that restricts some uses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open source&lt;/strong&gt; means an Apache 2.0 or MIT licence with no such restriction.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SurrealDB is source available. It is released under the Business Source License 1.1, which is free for internal use and converts to Apache 2.0 after four years. SurrealDB Cloud and Enterprise Edition are commercial products. Everything this post calls open source is under Apache 2.0 or MIT.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is open source today?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project&lt;/th&gt;
&lt;th&gt;Licence&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/surrealdb/surrealkv" rel="noopener noreferrer"&gt;SurrealKV 1.0&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Apache 2.0&lt;/td&gt;
&lt;td&gt;A persistent storage engine: a log-structured merge-tree with snapshot-isolated transactions and optional versioned trees, built on a concurrent adaptive radix tree memtable and a commit ring. It will be the only persistent storage engine in SurrealDB 4.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/surrealdb/surrealmx" rel="noopener noreferrer"&gt;SurrealMX 1.0&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Apache 2.0&lt;/td&gt;
&lt;td&gt;An in-memory storage engine: multi-version concurrency control over a concurrent adaptive radix tree, with lock-free reads and optional persistence.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/surrealdb/crud-bench" rel="noopener noreferrer"&gt;crud-bench&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Apache 2.0&lt;/td&gt;
&lt;td&gt;The benchmark harness behind every performance number we publish.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Our SDKs and tools, and many of the libraries beneath SurrealDB, are also open source under Apache 2.0 or MIT. The full list is at &lt;a href="https://surrealdb.com/opensource" rel="noopener noreferrer"&gt;surrealdb.com/opensource&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Each storage engine has a whitepaper. It explains how the engine reaches its performance, what we measured, and what we did not. We will also publish accompanying technical or academic papers for a number of our product launches.&lt;/p&gt;

&lt;h2&gt;
  
  
  What stays open source?
&lt;/h2&gt;

&lt;p&gt;The storage engines, our SDKs and tools, and the libraries listed at &lt;a href="https://surrealdb.com/opensource" rel="noopener noreferrer"&gt;surrealdb.com/opensource&lt;/a&gt; stay open source, under Apache 2.0 or MIT.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can I run the benchmarks myself?
&lt;/h2&gt;

&lt;p&gt;Every performance number we publish comes from &lt;a href="https://github.com/surrealdb/crud-bench" rel="noopener noreferrer"&gt;crud-bench&lt;/a&gt;, on one machine: an AMD Ryzen Threadripper 9970X (32 cores, 64 threads) with 128 GB of RAM and a 4 TB NVMe SSD. The same harness and the same command run each comparator, so a number and the number it is compared with are measured the same way.&lt;/p&gt;

&lt;p&gt;We say what we compared. When an engine runs in memory, we say it runs in memory. When we compare against an engine on disk, we say it is on disk.&lt;/p&gt;

&lt;p&gt;SurrealKV runs with synchronous durability, against RocksDB, SlateDB (on disk, not object storage), Fjall, ReDB, LMDB and libmdbx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;CRUD_BENCH_CONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;config/memory.toml ./run.sh &lt;span class="nt"&gt;-d&lt;/span&gt; surrealkv &lt;span class="nt"&gt;--no-build&lt;/span&gt; &lt;span class="nt"&gt;--optimised&lt;/span&gt; &lt;span class="nt"&gt;--sync&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; 500000 &lt;span class="nt"&gt;-c&lt;/span&gt; 128 &lt;span class="nt"&gt;-t&lt;/span&gt; 48
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SurrealMX runs against LMDB and RocksDB, both in memory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;CRUD_BENCH_CONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;config/memory.toml ./run.sh &lt;span class="nt"&gt;-d&lt;/span&gt; surrealmx &lt;span class="nt"&gt;--no-build&lt;/span&gt; &lt;span class="nt"&gt;--optimised&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; 15000000 &lt;span class="nt"&gt;-c&lt;/span&gt; 128 &lt;span class="nt"&gt;-t&lt;/span&gt; 48
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change the &lt;code&gt;-d&lt;/code&gt; flag to run a comparator.&lt;/p&gt;

&lt;p&gt;Run it on your own hardware. If you find a fairer configuration for a comparator, or an engine we should have included, open an issue or a pull request on &lt;a href="https://github.com/surrealdb/crud-bench" rel="noopener noreferrer"&gt;crud-bench&lt;/a&gt;. A benchmark that only we can run is not a benchmark.&lt;/p&gt;

&lt;h2&gt;
  
  
  Whose work does SurrealDB build on?
&lt;/h2&gt;

&lt;p&gt;None of this started with us. SurrealKV belongs to the line of log-structured merge-trees that runs from Bigtable through LevelDB and RocksDB, and we compare it against them. SurrealMX builds on the adaptive radix tree and on the multi-version designs of Hekaton and Silo.&lt;/p&gt;

&lt;p&gt;Those ideas were published by people who let strangers read their work, and several of the engines we compare against are open source. We owe that openness a return. The whitepapers cite what we learned from.&lt;/p&gt;

&lt;h2&gt;
  
  
  What will you hold us to?
&lt;/h2&gt;

&lt;p&gt;Three things.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Show the code.&lt;/strong&gt; The engines and tools above stay open source.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run the numbers.&lt;/strong&gt; Every benchmark ships with its command, its hardware and its method.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Say what we did not measure.&lt;/strong&gt; Each whitepaper lists what its measurements leave out, and we will keep doing that.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hold us to them. If we fall short, tell us.&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking forward
&lt;/h2&gt;

&lt;p&gt;We want infrastructure that anyone can inspect and anyone can challenge. Agents change what a database has to do. They work in volume, they share state, they carry context from one session to the next, and they need to show their work. The launches from 12 to 16 October 2026 cover that stack from the bottom up: from the storage engine, to the database layer, to the collaborative primitives that enable agents to work at pace, and at scale. All of it sits on one database, SurrealDB, and every benchmark comes with the command to run it.&lt;/p&gt;

&lt;p&gt;That is the foundation. We will set out our full view of infrastructure for the agentic future in a separate post.&lt;/p&gt;

</description>
      <category>database</category>
      <category>opensource</category>
      <category>sourceavailable</category>
      <category>surrealdb</category>
    </item>
    <item>
      <title>Introducing SurrealMX: SurrealDB’s new in-memory storage engine</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Tue, 13 Oct 2026 08:18:24 +0000</pubDate>
      <link>https://dev.to/surrealdb/introducing-surrealmx-surrealdbs-new-in-memory-storage-engine-3m69</link>
      <guid>https://dev.to/surrealdb/introducing-surrealmx-surrealdbs-new-in-memory-storage-engine-3m69</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Today, we are introducing &lt;strong&gt;SurrealMX 1.0&lt;/strong&gt;, our new high-performance in-memory storage engine for SurrealDB.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/surrealdb/surrealmx" rel="noopener noreferrer"&gt;SurrealMX&lt;/a&gt; is an embedded, transactional key-value engine with lock-free reads, designed for workloads where latency and throughput matter most. By keeping the working dataset in memory and combining multi-version concurrency control with a highly concurrent architecture, SurrealMX can process millions of operations per second while maintaining transactional guarantees.&lt;/p&gt;

&lt;p&gt;It gives developers a new storage option for low-latency applications, high-concurrency workloads, caching, temporary data, and applications where the dataset can comfortably reside in memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why we built SurrealMX
&lt;/h2&gt;

&lt;p&gt;Not every workload needs the same storage model. For applications where durability and datasets larger than memory are the priority, disk-backed storage makes sense. But there is another class of workloads where the main requirement is simple: make reads and writes as fast as possible (e.g. real-time applications, caching layers, ephemeral state, simulations, agent workloads, testing environments, and applications serving large numbers of concurrent requests). SurrealMX is designed specifically for these workloads.&lt;/p&gt;

&lt;p&gt;Instead of optimising a disk-backed database for in-memory use, SurrealMX starts with memory as the primary storage medium. This lets us remove much of the overhead that comes with disk-oriented architectures and design the engine around fast concurrent access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Built for performance
&lt;/h2&gt;

&lt;p&gt;SurrealMX combines a concurrent adaptive radix tree with multi-version concurrency control and a lock-free circular commit ring. The result is high throughput across reads, writes, updates, deletes, and scans.&lt;/p&gt;

&lt;p&gt;In our latest bare-metal benchmarks, SurrealMX delivered:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engine&lt;/th&gt;
&lt;th&gt;Point reads (OPS)&lt;/th&gt;
&lt;th&gt;Creates (OPS)&lt;/th&gt;
&lt;th&gt;Updates (OPS)&lt;/th&gt;
&lt;th&gt;Deletes (OPS)&lt;/th&gt;
&lt;th&gt;Scans (OPS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SurrealMX&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;21,506,711&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1,887,149&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1,595,009&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1,814,037&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;18,031,692&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LMDB (in-memory)&lt;/td&gt;
&lt;td&gt;1,226,897&lt;/td&gt;
&lt;td&gt;232,805&lt;/td&gt;
&lt;td&gt;241,431&lt;/td&gt;
&lt;td&gt;177,198&lt;/td&gt;
&lt;td&gt;1,188,365&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RocksDB (in-memory)&lt;/td&gt;
&lt;td&gt;759,060&lt;/td&gt;
&lt;td&gt;616,649&lt;/td&gt;
&lt;td&gt;572,246&lt;/td&gt;
&lt;td&gt;705,773&lt;/td&gt;
&lt;td&gt;836,666&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That translates to more than &lt;strong&gt;21.5 million point reads per second&lt;/strong&gt;, nearly &lt;strong&gt;1.9 million creates per second&lt;/strong&gt;, and over &lt;strong&gt;18 million range scans per second&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Compared with RocksDB configured for in-memory workloads, SurrealMX achieved approximately:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;28× higher point-read throughput&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;3.1× higher create throughput&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;2.8× higher update throughput&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;2.6× higher delete throughput&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;22× higher range-scan throughput&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The benchmark was run on bare metal using an AMD Ryzen Threadripper 9970X with 128 GB DDR5 RAM, across &lt;strong&gt;15 million keys, 48 concurrent worker threads and 128 clients&lt;/strong&gt;. Each figure is the best of three runs of that benchmark, for every engine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Designed for concurrency
&lt;/h2&gt;

&lt;p&gt;Modern applications rarely execute one operation at a time. SurrealMX is designed around multiple concurrent readers and writers without requiring a global lock. Its lock-free circular commit ring provides constant-time atomic slot claiming, while a sharded active-reader registry reduces contention between CPU cores. Reads can inspect version chains without taking locks, allowing the engine to scale more effectively as concurrency increases.&lt;/p&gt;

&lt;p&gt;For point reads, SurrealMX can also bypass transaction-pool checkout and reader registration entirely, returning the latest committed value directly. This architecture is particularly useful for applications where many threads or clients are continuously accessing and changing the same in-memory dataset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transactions without giving up speed
&lt;/h2&gt;

&lt;p&gt;Being an in-memory database does not mean sacrificing transactional behaviour. SurrealMX supports full transactions, including rollbacks and savepoints, as well as both &lt;strong&gt;snapshot isolation and serializable snapshot isolation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Multi-version concurrency control allows transactions to operate against consistent snapshots while concurrent changes continue in parallel. For simpler workloads, direct operations such as &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;set&lt;/code&gt;, &lt;code&gt;put&lt;/code&gt;, &lt;code&gt;delete&lt;/code&gt; and &lt;code&gt;exists&lt;/code&gt; provide a lower-overhead path without requiring developers to manually manage transactions. That means applications can choose between convenience and more advanced transactional control while using the same engine underneath.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fast scans, without the allocation overhead
&lt;/h2&gt;

&lt;p&gt;In-memory analytical and retrieval workloads often involve more than point lookups. SurrealMX provides zero-allocation range scanning, allowing applications to inspect borrowed keys and values directly rather than repeatedly creating and copying objects. In our benchmarks, this helped SurrealMX exceed &lt;strong&gt;18 million range scans per second&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For workloads involving repeated retrieval over subsets of an in-memory dataset, reducing this allocation overhead can make a significant difference both to latency and CPU utilisation.&lt;/p&gt;

&lt;h2&gt;
  
  
  In-memory first, with optional persistence
&lt;/h2&gt;

&lt;p&gt;SurrealMX is fundamentally an in-memory engine, and its fastest configuration keeps data entirely in memory. In this mode, data disappears when the process terminates. This makes it particularly well suited to workloads such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Caching and temporary state&lt;/li&gt;
&lt;li&gt;Real-time application data&lt;/li&gt;
&lt;li&gt;Development and testing&lt;/li&gt;
&lt;li&gt;Simulations&lt;/li&gt;
&lt;li&gt;Reconstructable datasets&lt;/li&gt;
&lt;li&gt;Low-latency application state&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But some workloads need the speed of an in-memory database while still requiring recovery after a restart. For those cases, SurrealMX also supports optional persistence. Developers can configure append-only logging, periodic snapshots, asynchronous persistence, configurable &lt;code&gt;fsync&lt;/code&gt; behaviour, and LZ4 snapshot compression.&lt;/p&gt;

&lt;p&gt;This makes durability a spectrum rather than an all-or-nothing decision. Applications can optimise for maximum throughput, maximum durability, or somewhere in between.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reliability under concurrency
&lt;/h2&gt;

&lt;p&gt;Highly concurrent database engines are difficult to test using conventional unit and integration tests alone. SurrealMX uses deterministic simulation testing: seeded, reproducible runs compared against a sequential reference model, to validate its behaviour across many interleavings of open transactions.&lt;/p&gt;

&lt;p&gt;The engine has been tested across &lt;strong&gt;25 million simulated operations with zero divergences&lt;/strong&gt;. Its persistence layer also protects transactions using checksummed append-only log frames. If a crash interrupts a write, recovery can distinguish incomplete data at the end of the log from valid committed transactions, ensuring transactions are recovered atomically rather than partially applied.&lt;/p&gt;

&lt;h2&gt;
  
  
  Built for embedded and browser applications
&lt;/h2&gt;

&lt;p&gt;Like SurrealDB itself, SurrealMX is designed to operate in more than traditional server environments. It is an embedded Rust engine, meaning applications can run it directly inside their own process rather than communicating with a separate database server.&lt;/p&gt;

&lt;p&gt;SurrealMX also supports WebAssembly, opening the door to running an extremely fast transactional database directly inside browser-based applications. This makes it useful across everything from high-performance backend services to desktop applications and browser environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  SurrealKV and SurrealMX
&lt;/h2&gt;

&lt;p&gt;With SurrealKV and SurrealMX, SurrealDB now has storage engines designed for two different priorities. &lt;strong&gt;SurrealKV&lt;/strong&gt; is our durable storage engine, designed for high-performance persistent workloads where data lives on disk. &lt;strong&gt;SurrealMX&lt;/strong&gt; is our in-memory engine, designed for workloads where the entire dataset can remain in memory and minimum latency is the priority.&lt;/p&gt;

&lt;p&gt;Both are being built around the same principle: rather than treating storage as an external dependency, we can design the underlying engines around the workloads SurrealDB needs to support. That lets us optimise more of the stack ourselves, from the query layer all the way down to how data is stored and accessed. For more information, see our &lt;a href="https://surrealdb.com/docs/manage/self-hosted/deployment-models" rel="noopener noreferrer"&gt;Deployment guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A new option for low-latency SurrealDB workloads
&lt;/h2&gt;

&lt;p&gt;SurrealMX gives SurrealDB a storage engine designed specifically for the fastest end of the performance spectrum.&lt;/p&gt;

&lt;p&gt;With more than &lt;strong&gt;21 million reads per second&lt;/strong&gt;, millions of writes per second, lock-free reads, transactional guarantees, and configurable persistence, it provides a new foundation for applications where every microsecond counts.&lt;/p&gt;

&lt;p&gt;SurrealMX brings the full power of an in-memory transactional storage engine to SurrealDB - built for speed, concurrency, and the next generation of real-time applications.&lt;/p&gt;

&lt;p&gt;Go to the &lt;a href="https://github.com/surrealdb/surrealmx" rel="noopener noreferrer"&gt;SurrealMX GitHub repository&lt;/a&gt;, read the &lt;a href="https://surrealdb.com/static/whitepapers/surrealmx.pdf" rel="noopener noreferrer"&gt;whitepaper&lt;/a&gt;, or check out our &lt;a href="https://surrealdb.com/docs/manage/self-hosted/deployment-models" rel="noopener noreferrer"&gt;Deployment guide&lt;/a&gt; for more information.&lt;/p&gt;

</description>
      <category>storageengine</category>
      <category>inmemory</category>
      <category>news</category>
      <category>database</category>
    </item>
    <item>
      <title>SurrealDB Cloud is now available on Microsoft Azure</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Thu, 17 Sep 2026 15:13:29 +0000</pubDate>
      <link>https://dev.to/surrealdb/surrealdb-cloud-is-now-available-on-microsoft-azure-1ina</link>
      <guid>https://dev.to/surrealdb/surrealdb-cloud-is-now-available-on-microsoft-azure-1ina</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SurrealDB Cloud now runs on Microsoft Azure. Three Azure regions are live today - US East 2, Germany and Brazil - and the provider is now a choice you make alongside the region when you create an instance.&lt;/p&gt;

&lt;p&gt;Until now every managed SurrealDB instance ran on AWS. That was fine if AWS was already where your workloads lived. If your organisation had standardised on Azure, it wasn't: a managed database on another provider meant a second cloud to review, a second network to connect and a second contract to negotiate.&lt;/p&gt;

&lt;h2&gt;
  
  
  One less cloud to get approved
&lt;/h2&gt;

&lt;p&gt;Running on Azure puts the database inside the perimeter your security and procurement teams have already signed off. With Azure Private Link, instances are reachable over a private endpoint in your own virtual network, so traffic between your applications and your database never touches the public internet or crosses a provider boundary. That takes both the cross-cloud egress line item and the latency of that hop off the table.&lt;/p&gt;

&lt;p&gt;For regulated workloads it also answers the residency question in the terms auditors actually ask about. German and EU customer data stays stored and processed in Germany; Brazilian data stays in Brazil, with more regions coming soon.&lt;/p&gt;

&lt;p&gt;The controls are identical on both providers and in every region: SOC 2 Type 2, ISO 27001, GDPR, and encryption at rest and in transit. So are the mechanics. Every tier is available, from Free and development instances through to production and Scale, and instance types, versions, backups and the API all behave exactly as they do on AWS. Existing automation needs nothing more than the new region value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where SurrealDB Cloud runs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;On AWS:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;• US East (N. Virginia)&lt;br&gt;
• US East (Ohio)&lt;br&gt;
• US West (Oregon)&lt;br&gt;
• Europe (Ireland)&lt;br&gt;
• Asia Pacific (Mumbai)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On Azure:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;• US East 2 (Virginia)&lt;br&gt;
• Europe (Germany)&lt;br&gt;
• South America (Brazil)&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Create an instance in &lt;a href="https://studio.surrealdb.com/current/instances/deploy?_gl=1*1188y7r*FPAU*MTE2OTI3MjA3NS4xNzg5MTQzMzAz*_ga*Mzc3MDk1MzUwLjE3ODkxNDMzMDM.*_ga_J1NWM32T1V*czE3ODk2NTc3NTYkbzE3JGcxJHQxNzg5NjU3NzY3JGo0OSRsMCRoMTkxNjg4NTUzOA..*_fplc*Y2hYYnNsWDYwWHVncU9LTWpmR1NaJTJGcE9makFmaVRVMnNmTTZPcGdnJTJCUzV5ZHdJdyUyQkxUZVlRSnduQTVndHU5Z2tubWhRR2Q5eVMwNGdVRVVBdDlVbklsVHlkaFRJT2Y1OEpEdVFYMCUyRlZpQ0lRU2dIZHhSWiUyQjVZaU96WlNmUSUzRCUzRA.." rel="noopener noreferrer"&gt;SurrealDB Cloud&lt;/a&gt; and pick an Azure region from the list. The Free tier costs nothing, so you can put a real instance in your own Azure region before you take anything to a review board.&lt;/p&gt;

&lt;p&gt;If you are running SurrealDB in production and want high availability alongside in-region deployment, the &lt;a href="https://surrealdb.com/blog/introducing-scale-surrealdb-cloud-built-for-high-availability-and-scale" rel="noopener noreferrer"&gt;Scale tier&lt;/a&gt; gives you multi-node, multi-availability-zone clusters.&lt;/p&gt;

&lt;p&gt;A listing on the Azure Marketplace is coming soon, so you will be able to procure SurrealDB Cloud through the same channel as the rest of your Azure spend. In the meantime, if Azure is your standard and that is why you have been self-hosting until now, that trade-off is gone. &lt;a href="https://surrealdb.com/contact" rel="noopener noreferrer"&gt;Get in touch&lt;/a&gt; to talk through an enterprise deployment.&lt;/p&gt;

</description>
      <category>surrealdb</category>
      <category>cloud</category>
      <category>azure</category>
      <category>microsoft</category>
    </item>
    <item>
      <title>SurrealDB Cloud is now available in Frankfurt, Germany</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Mon, 07 Sep 2026 10:11:28 +0000</pubDate>
      <link>https://dev.to/surrealdb/surrealdb-cloud-is-now-available-in-frankfurt-germany-33lm</link>
      <guid>https://dev.to/surrealdb/surrealdb-cloud-is-now-available-in-frankfurt-germany-33lm</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/tobiemh" rel="noopener noreferrer"&gt;Tobie Morgan Hitchcock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SurrealDB Cloud can now be deployed in Frankfurt, Germany. The new region is live today - pick it from the region list when you create an instance.&lt;/p&gt;

&lt;p&gt;For teams across the DACH region and continental Europe, this is a second European option and, for most of them, the closer one. Until now the nearest place to run a managed SurrealDB instance was Ireland, on the far western edge of the continent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Latency and data residency for your workloads
&lt;/h2&gt;

&lt;p&gt;Running in Frankfurt puts the database closer to your users across continental Europe, next to the interconnect that most European traffic already passes through. It also keeps German and EU customer data stored and processed in Germany, satisfying data-residency requirements that previously ruled out a managed deployment. All this while maintaining the same SOC 2 Type 2 controls, ISO 27001, GDPR, encryption and network isolation options as every other region. Agents gain twice over: the region removes the distance, and SurrealDB removes the fan-out. Vector search, graph traversal, full-text search and document reads all resolve in one query against one store rather than separate calls to a vector database, a search engine and a primary database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where SurrealDB Cloud runs
&lt;/h2&gt;

&lt;p&gt;Frankfurt joins six other regions:&lt;/p&gt;

&lt;p&gt;• US East (N. Virginia)&lt;br&gt;
• US East (Ohio)&lt;br&gt;
• US West (Oregon)&lt;br&gt;
• Europe (Ireland)&lt;br&gt;
• Europe (Frankfurt)&lt;br&gt;
• Asia Pacific (Mumbai)&lt;br&gt;
• South America (São Paulo)&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Create an instance in &lt;a href="https://studio.surrealdb.com/current/instances/deploy?_gl=1*13wbmse*FPAU*OTA4NzQ0MTAxLjE3ODgzNTQzMDM.*_ga*MTU2ODc2ODY1OS4xNzg4MzU0MzAz*_ga_J1NWM32T1V*czE3ODg3NzIyNTgkbzE1JGcxJHQxNzg4Nzc1NjA3JGo1MyRsMCRoNTYwNTMzMjcz*_fplc*MUglMkJld1JLJTJCWnlxSU5RZFJBYlNKaFdCRmJCSUNFVjNaSk5samQ4aEpUa3RGWVFTdHFVZmhEamNJYmdPMzVQMmNQZllHZDZvZmtpaiUyQnhZSU5MZ1NkZTFyUlg1ZXNDZVVrTXkwbHBBVFJYa0h1QWtlVkh6aHNWbXNKbFgwS3R3JTNEJTNE" rel="noopener noreferrer"&gt;SurrealDB Cloud&lt;/a&gt; and select Europe (Germany) as the region. Everything else - tiers, instance types, versions, backups - works exactly as it does elsewhere, so existing automation needs nothing more than the new region value.&lt;/p&gt;

&lt;p&gt;If you are running SurrealDB in production and want high availability alongside in-region deployment, the &lt;a href="https://surrealdb.com/blog/introducing-scale-surrealdb-cloud-built-for-high-availability-and-scale" rel="noopener noreferrer"&gt;Scale tier&lt;/a&gt; gives you multi-node, multi-availability-zone clusters.&lt;/p&gt;

</description>
      <category>news</category>
      <category>surrealdbcloud</category>
      <category>database</category>
      <category>cloud</category>
    </item>
    <item>
      <title>SurrealDB Cloud is now available in São Paulo, Brazil</title>
      <dc:creator>Mark Gyles</dc:creator>
      <pubDate>Mon, 07 Sep 2026 09:51:34 +0000</pubDate>
      <link>https://dev.to/surrealdb/surrealdb-cloud-is-now-available-in-sao-paulo-brazil-1o89</link>
      <guid>https://dev.to/surrealdb/surrealdb-cloud-is-now-available-in-sao-paulo-brazil-1o89</guid>
      <description>&lt;p&gt;Author: &lt;a href="https://x.com/IgnacioPaz87" rel="noopener noreferrer"&gt;Ignacio Paz&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SurrealDB Cloud can now be deployed in São Paulo, Brazil. The new region is live today - pick it from the region list when you create an instance.&lt;/p&gt;

&lt;p&gt;For teams building in Brazil and across Latin America, this closes the last big gap in the deployment story: until now the nearest place to run a managed SurrealDB instance was North America, and every query paid for the trip.&lt;/p&gt;

&lt;h2&gt;
  
  
  Latency and data residency for your workloads
&lt;/h2&gt;

&lt;p&gt;Running in São Paulo puts the database closer to your customers for our South American users. It also keeps Brazilian customer data stored and processed in Brazil, satisfying data-residency requirements that previously ruled out a managed deployment. All this while maintaining the same SOC 2 Type 2 controls, ISO 27001, GDPR, encryption and network isolation options as every other region. Agents gain twice over: the region removes the distance, and SurrealDB removes the fan-out. Vector search, graph traversal, full-text search and document reads all resolve in one query against one store rather than separate calls to a vector database, a search engine and a primary database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where SurrealDB Cloud runs
&lt;/h2&gt;

&lt;p&gt;São Paulo joins five other regions:&lt;/p&gt;

&lt;p&gt;• US East (N. Virginia)&lt;br&gt;
• US East (Ohio)&lt;br&gt;
• US West (Oregon)&lt;br&gt;
• Europe (Ireland)&lt;br&gt;
• Asia Pacific (Mumbai)&lt;br&gt;
• South America (São Paulo)&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Create an instance in &lt;a href="https://studio.surrealdb.com/current/instances/deploy?_gl=1*cfkuhl*FPAU*OTA4NzQ0MTAxLjE3ODgzNTQzMDM.*_ga*MTU2ODc2ODY1OS4xNzg4MzU0MzAz*_ga_J1NWM32T1V*czE3ODg3NzIyNTgkbzE1JGcxJHQxNzg4Nzc0Mjg2JGo2MCRsMCRoNTYwNTMzMjcz*_fplc*MUglMkJld1JLJTJCWnlxSU5RZFJBYlNKaFdCRmJCSUNFVjNaSk5samQ4aEpUa3RGWVFTdHFVZmhEamNJYmdPMzVQMmNQZllHZDZvZmtpaiUyQnhZSU5MZ1NkZTFyUlg1ZXNDZVVrTXkwbHBBVFJYa0h1QWtlVkh6aHNWbXNKbFgwS3R3JTNEJTNE" rel="noopener noreferrer"&gt;SurrealDB Cloud&lt;/a&gt; and select &lt;strong&gt;South America (Brazil)&lt;/strong&gt; as the region. Everything else - tiers, instance types, versions, backups - works exactly as it does elsewhere, so existing automation needs nothing more than the new region value.&lt;/p&gt;

&lt;p&gt;If you are running SurrealDB in production and want high availability alongside in-region deployment, the &lt;a href="https://surrealdb.com/blog/introducing-scale-surrealdb-cloud-built-for-high-availability-and-scale" rel="noopener noreferrer"&gt;Scale tier&lt;/a&gt; gives you multi-node, multi-availability-zone clusters. The &lt;a href="https://surrealdb.com/docs/manage/cloud" rel="noopener noreferrer"&gt;Cloud documentation&lt;/a&gt; covers the full set of options.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://studio.surrealdb.com/current/instances/deploy?_gl=1*13c3trd*FPAU*OTA4NzQ0MTAxLjE3ODgzNTQzMDM.*_ga*MTU2ODc2ODY1OS4xNzg4MzU0MzAz*_ga_J1NWM32T1V*czE3ODg3NzIyNTgkbzE1JGcxJHQxNzg4Nzc0Mjg2JGo2MCRsMCRoNTYwNTMzMjcz*_fplc*MUglMkJld1JLJTJCWnlxSU5RZFJBYlNKaFdCRmJCSUNFVjNaSk5samQ4aEpUa3RGWVFTdHFVZmhEamNJYmdPMzVQMmNQZllHZDZvZmtpaiUyQnhZSU5MZ1NkZTFyUlg1ZXNDZVVrTXkwbHBBVFJYa0h1QWtlVkh6aHNWbXNKbFgwS3R3JTNEJTNE" rel="noopener noreferrer"&gt;Deploy in São Paulo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>surrealdbcloud</category>
      <category>database</category>
      <category>cloud</category>
      <category>news</category>
    </item>
  </channel>
</rss>
