Memori: The Memory Layer That Turns LLM Calls Into Durable Agent State

A zero-config interceptor, SQL-native storage, and entity-process attribution give AI agents something most still lack: a real memory system that survives sessions without bloating the prompt.

10 min read • View on GitHub • More from MemoriLabs

A wrapped LLM client passes through a mechanical relay. One branch pulls structured memory from filing drawers, while another writes updated state back after the response. The image explains that Memori sits inside the request path rather than beside it.
Memori intercepts the call, recalls what matters, then writes back the result as structured state.
Key Takeaways

Memori is most interesting when you stop thinking about it as a memory store. It is a request-path layer that watches an LLM call, retrieves the right state, injects it, then writes back what changed. That is a different mental model from dumping chat history into a vector database and hoping retrieval saves you.

The memory layer hiding inside your LLM client

The first surprise is practical. Memori does not ask you to rebuild around a new agent framework. You register an existing client, and the interceptor handles the rest. In the repo, that means wrappers around providers like OpenAI, Anthropic, LangChain, and similar clients, so memory becomes a property of the call rather than a new application architecture.

Memori is agent-native memory infrastructure. A SQL-native, LLM-agnostic layer that turns agent execution and conversation into structured, persistent state for production systems.

One LLM call becomes a loop: recall on the way in, writeback on the way out.

The important shift is that memory is not bolted on after generation. It is part of the invocation lifecycle. Memori observes the call, selects relevant memories, augments the prompt, and then updates storage in the background. That makes it feel closer to a transaction log for agents than a chat archive.

Why memory from action is the real differentiator

Three identity badges sit on a desk, labeled entity, process, and session. Each badge is tied by a separate thread to a different drawer in a filing cabinet. The image explains that Memori keeps user identity, workflow identity, and temporary session state apart.
Memori does not use one memory bucket. It routes state by entity, process, and session.

Memori’s philosophy is blunt: agents do not just say things, they do things. The repo’s memory model reflects that. It tracks entities, processes, events, facts, preferences, relationships, rules, and skills, which makes the resulting state feel operational rather than conversational.

import memori

client = openai.OpenAI()
mem = memori.Memori()
mem.attribution(entity_id="user_123", process_id="support_agent")
mem.llm.register(client)

response = client.chat.completions.create(
    model="gpt-4.1",
    messages=[{"role": "user", "content": "What did we decide last time?"}]
)

That tiny wrapper hides the bigger idea. The system separates who the memory belongs to from which workflow produced it. That is what keeps one customer’s preferences from leaking into another customer’s session, and one agent role from contaminating another.

Entity, process, session: the identity model that keeps memory from bleeding

LayerWhat it representsWhy it matters
EntityThe person or accountKeeps user-specific memory stable across workflows
ProcessThe agent role or workflowLets one system hold distinct memory for different jobs
SessionThe temporary interaction windowCaptures short-lived context without promoting it to durable state

This is the part many memory systems flatten. Memori makes identity first-class. That matters in production because a support agent, a research agent, and a sales agent do not need the same history, even when they share infrastructure.

How Memori actually stores and recalls memory

Under the hood, the flow is straightforward enough to trust and opinionated enough to matter. A request enters the wrapper, Memori selects relevant memory, augments the prompt, and the response returns through the same path. Streaming support is important here, because token-by-token output is where a lot of memory systems get clumsy. Memori has to merge chunks cleanly before it can capture the final result.

Request -> Interceptor -> Recall -> Augment prompt -> LLM response
                                  \-> Stream merge -> Background writeback -> SQL storage
ApproachStrengthTradeoff
MemoriStructured state with interceptionMore opinionated than flat retrieval
Vector-first memorySimple semantic search over past textCan miss workflow and identity boundaries
Big context windowEasy to understandCosts more and still wastes tokens
Framework-native memoryConvenient inside one ecosystemOften too limited for production state

Memori is not trying to win by stuffing more history into the prompt. It is trying to remember less, better.

Why the benchmark matters more than the star count

SystemWhat it optimizes forWhat the benchmark story suggests
MemoriStructured memory and token efficiencyStrong accuracy without a full-context burden
ZepLong-term retrievalUseful, but more retrieval-centered
Mem0Agent memory convenienceCompetitive, but not as state-first
LangMemEcosystem fitBetter as a helper than a storage layer

The benchmark result matters because it supports the design thesis. If a system can hit strong recall while using a small fraction of the full context footprint, that is a signal that structured state can beat brute-force prompting. The argument is not that bigger windows are bad. It is that they are the wrong default for durable agent memory.

Cloud mode or BYODB: the trust story for teams

Memori’s deployment story is split in two. Cloud mode gives you a managed path. BYODB gives you control over the database layer, which is the option teams want when privacy, compliance, or procurement slows everything down. That choice is not a side note. It is part of the product’s enterprise pitch.

ModeBest forMain concern
CloudFast setup and managed opsData handling lives outside your own stack
BYODBTeams that need sovereigntyYou own the database and operational surface

That dual path makes the architecture easier to adopt. A team can start with the managed service, then move the memory store into its own SQL infrastructure once the integration proves itself.

Where Memori fits in the memory stack

ProjectPrimary emphasisHow Memori differs
MemoriStructured, SQL-native agent stateHooks into existing clients and separates identity from workflow
Mem0General agent memoryLess centered on call interception and SQL-native state
ZepLong-term memory storeMore retrieval-oriented than process-aware
LangMemFramework utilitiesUseful inside the ecosystem, but narrower in scope
Native framework memorySimple session memoryUsually too shallow for durable production state

So the cleanest way to place Memori is this: it is not just memory retrieval, and it is not just persistence. It is an operational state layer for agents that have to survive across sessions without losing their thread.

The tradeoff Memori is making

The cost of the approach is real. Structured memory is more opinionated than flat search, which means you have to accept its model of identity and state. Interception is elegant, but it also lives in a sensitive part of the request path. That is the right place for serious agent infrastructure, and the wrong place for casual chat logging.

If all you want is a simple archive of conversations, Memori is probably more machinery than you need. If you are building production agents that need durable, queryable, token-efficient state, the design starts to look less like a feature and more like the missing layer.