LabHub

Blog

AI Agent Memory & Long-Term Context 2026 — Mem0 / Zep / Letta / Cognee / Graphiti / Anthropic Memory Deep-Dive

한국어English日本語

Prologue — A 1M Window Did Not Solve Memory

In 2024 we believed "once context windows hit 1M tokens, the memory problem disappears." In 2026 we know that was a lie.

That is why one of the hottest infrastructure categories in 2026 AI engineering is agent memory. Mem0 came out of YC, Zep raised a Series A, and Letta (formerly MemGPT) staked out the "agent OS" position. Anthropic shipped its Memory API in 2025 preview, and OpenAI baked Memory into ChatGPT as a default.

This article walks the full map. We break down the memory hierarchy, examine each major library and API, compare the storage backends, cover the Korean and Japanese movements, and end with explicit recommendations for who should pick what.


Chapter 1 · The 2026 Agent Memory Map — Three Models: Vector / Graph / Episodic

By 2026, agent memory has largely converged on three models.

┌─────────────────────────────────────────────────────────────────┐
│                  The Three Agent Memory Models                  │
│                                                                 │
│  ┌──────────────┐   ┌──────────────┐   ┌──────────────────┐    │
│  │ Vector       │   │ Graph        │   │ Episodic         │    │
│  │ Memory       │   │ Memory       │   │ Memory           │    │
│  │              │   │              │   │                  │    │
│  │ Embed+search │   │ Entities+    │   │ Sequences of     │    │
│  │ Similarity   │   │ relations    │   │ events           │    │
│  │              │   │ Reasoning    │   │ Time + cause     │    │
│  │              │   │              │   │                  │    │
│  │ Representative│  │ Representative│  │ Representative   │    │
│  │ - Mem0       │   │ - Cognee     │   │ - Letta          │    │
│  │ - Verba      │   │ - Graphiti   │   │ - Generative     │    │
│  │ - OpenAI Mem │   │ - Zep(graph) │   │   Agents         │    │
│  │              │   │              │   │ - MemoryBank     │    │
│  └──────────────┘   └──────────────┘   └──────────────────┘    │
│                                                                 │
│        (real-world products are almost always hybrid)           │
└─────────────────────────────────────────────────────────────────┘

Each model has clear strengths and weaknesses.

ModelStrengthsWeaknessesGood fit
VectorFast retrieval, simple mental model, rich infraWeak at relational reasoning, no "why"Chatbot FAQ, document RAG, user preferences
GraphMulti-hop reasoning, explicit facts, updatableExtraction cost, schema-design burdenCRM, codebases, org charts
EpisodicTime + causality, flow of eventsHeavy, complex recall algorithmsCharacter agents, long-running companions, simulation

In practice, almost every shipped product mixes two or more. Zep is vector + graph + temporal, Letta wraps episodic + semantic + procedural like an operating system, and Mem0 is vector-first with an optional graph mode.


Chapter 2 · Memory Taxonomy — Short-term / Working / Long-term

Before comparing libraries, fix the vocabulary. The hierarchy almost every memory system agrees on in 2026:

┌────────────────────────────────────────────────────┐
│                                                    │
│  Short-term Memory                                 │
│   = the LLM context window itself                  │
│   = every message visible this turn                │
│   = gone when the session ends                     │
│                                                    │
├────────────────────────────────────────────────────┤
│                                                    │
│  Working Memory                                    │
│   = the agent's "scratchpad"                       │
│   = extractions/summaries/plans for current task   │
│   = context + the active pages from external store │
│                                                    │
├────────────────────────────────────────────────────┤
│                                                    │
│  Long-term Memory — 3 flavors                      │
│                                                    │
│   ┌──────────────────────────────────────────┐    │
│   │ Semantic   — "knowledge". Facts, prefs    │    │
│   │   e.g. "the user lives in Korea"         │    │
│   │   e.g. "project X is written in Rust"    │    │
│   └──────────────────────────────────────────┘    │
│                                                    │
│   ┌──────────────────────────────────────────┐    │
│   │ Episodic   — "events". Time + causality  │    │
│   │   e.g. "last Tuesday tried A and failed" │    │
│   │   e.g. "tests passed after refactor of B"│    │
│   └──────────────────────────────────────────┘    │
│                                                    │
│   ┌──────────────────────────────────────────┐    │
│   │ Procedural — "how". Procedures, skills    │    │
│   │   e.g. "how PRs open in this codebase"   │    │
│   │   e.g. "this user's debugging style"     │    │
│   └──────────────────────────────────────────┘    │
│                                                    │
└────────────────────────────────────────────────────┘

This taxonomy is borrowed from cognitive science (Tulving 1972, Squire 1992). When the 2023 Stanford Generative Agents paper applied it to LLM agents, it became the de facto industry standard.

Why the hierarchy matters:

Keep this hierarchy in mind and the libraries' specialties light up.


Mem0 graduated YC in 2024 and rapidly became the de facto standard. A clean SDK, sensible defaults, and the "memory in 5 minutes" pitch landed exactly where the market lived.

Core model

Mem0's mental model is simple:

  1. Use an LLM to extract valuable facts from conversation.
  2. Embed the facts into a vector store (an LLM merges duplicates).
  3. For new messages, recall related facts via similarity search.
  4. Inject the recalled facts into context and call the model.
from mem0 import Memory

m = Memory()

# Auto-extract facts from a user message
m.add("My name is Youngju and I use Postgres", user_id="user-42")

# Recall next turn
results = m.search("What DB do I use?", user_id="user-42")
# -> [{"memory": "User uses Postgres", "score": 0.91, ...}]

Internally Mem0 makes two LLM calls:

The "extraction call" cost is both Mem0's biggest drawback and its biggest strength. It costs more, but you get a low-noise memory store.

Graph mode and multi-agent

In mid-2025 Mem0 shipped Graph Memory GA. It stores entities and relations alongside vectors using Neo4j as the backend. Useful when you need to reason over user — project — tool relationships.

Mem0 also supports multi-actor memory — separating memories not only by user_id but by agent_id and run_id. In a multi-agent system, each agent gets its own memory.

Where Mem0 fits


Chapter 4 · Zep — Hybrid Graph + Vector (Series A)

Zep raised a Series A in 2024 and claimed the enterprise memory category. Its differentiator is a graph + vector + temporal hybrid.

The core component — Graphiti

Zep's engine is Graphiti, an open-source knowledge-graph framework. Graphiti's job:

from zep_python.client import Zep
from zep_python.types import Message

client = Zep(api_key="...")
client.user.add(user_id="user-42", first_name="Youngju")

# Add a message — Zep auto-integrates it into the KG
client.memory.add(
    session_id="sess-1",
    messages=[Message(role="user", content="I moved from Acme to Bravo")],
)

# Recall — graph facts + related messages
mem = client.memory.get(session_id="sess-1")
# -> facts: ["User works at Bravo (previously: Acme)"]

Why temporal reasoning matters

The weakness of traditional vector memory: even when new facts arrive, the old facts survive. "User works at Acme" and "User works at Bravo" both come back from a search and confuse the model.

Zep/Graphiti solve this with a bi-temporal model. Every fact records both when the event happened and when it entered the DB. Recall naturally filters to "facts valid right now."

Where Zep fits


Chapter 5 · Letta (formerly MemGPT) — The Agent OS Approach

Letta (formerly MemGPT) started at UC Berkeley and rebranded as a company in 2024. It is shaped differently from the other libraries — not a memory library but a memory-centric agent runtime.

The core idea — Memory as OS

Letta's metaphor is the virtual memory of an operating system.

A Letta agent always has the following context:

The agent edits its own memory through tools.

from letta_client import Letta

client = Letta(base_url="http://localhost:8283")
agent = client.agents.create(
    name="my-agent",
    memory_blocks=[
        {"label": "human", "value": "User is an ML engineer living in Korea"},
        {"label": "persona", "value": "Helpful AI colleague"},
    ],
)

# Chat. The agent updates core memory at its own discretion.
client.agents.messages.create(
    agent_id=agent.id,
    messages=[{"role": "user", "content": "I just moved to Bravo"}],
)
# -> The agent calls core_memory_replace and updates the "human" block

What sets Letta apart

Where Letta fits


Chapter 6 · Cognee — Automatic Knowledge Graph Generation

Cognee is an open-source project that appeared in 2024, focused on "data to KG, automatically." It is less a memory library and more a KG builder for agents.

Pipeline — ECL (Extract, Cognify, Load)

ECL mimics ETL:

  1. Extract — pull in documents, conversations, or code.
  2. Cognify — an LLM extracts entities, relations, and ontology. An abstraction called DataPoint lives here.
  3. Load — write to a graph DB (Neo4j, Kuzu, NetworkX) and a vector DB (LanceDB, Qdrant, ...).
import cognee

await cognee.add("Project X is written in Rust and depends on Y")
await cognee.cognify()

results = await cognee.search(
    query_type="GRAPH_COMPLETION",
    query_text="What language is Project X written in?",
)
# -> "Rust"

How it differs from other libraries

Where Cognee fits


Chapter 7 · Anthropic Memory API (2025 Preview)

Anthropic shipped its Memory API in 2025 preview. Its central stance: memory should be server-side state.

Model

import anthropic

client = anthropic.Anthropic()

resp = client.messages.create(
    model="claude-sonnet-4-7",
    conversation_id="conv-42",   # server-side state identifier
    memory={"enabled": True, "scope": "user-42"},
    messages=[{"role": "user", "content": "Tell me again about that book I mentioned yesterday"}],
)
# Anthropic references the past of conv-42 to compose the reply

Why this is a big shift

Where Anthropic Memory fits


Chapter 8 · OpenAI Memory — The Consumer ChatGPT Feature

OpenAI Memory is a different category. It is not a developer SDK but a feature inside consumer ChatGPT.

How it works

What it means for developers

OpenAI Memory does not exist in the API. So:

In this category OpenAI's role is market educator. They taught the mainstream what "AI memory" is, and that fueled the growth of the next category (Mem0, Zep, Letta).


Chapter 9 · Graphiti — Zep's KG Framework (Open Source)

Graphiti is the KG framework Zep open-sourced in 2024. It powers the Zep product but is usable standalone.

Core design

Graphiti's tagline: "Temporal Knowledge Graphs for AI Agents."

from graphiti_core import Graphiti
from datetime import datetime

g = Graphiti("neo4j://localhost:7687", "neo4j", "password")
await g.build_indices_and_constraints()

await g.add_episode(
    name="meeting-2026-05-15",
    episode_body="Youngju moved to Bravo. Title: Staff Engineer.",
    source_description="meeting notes",
    reference_time=datetime.now(),
)

results = await g.search("where does Youngju work?")
# -> [{"fact": "Youngju works at Bravo", "valid_at": "2026-05-15"}]

How it differs from other KG frameworks

Graphiti's differentiator is that time + conflict resolution are first-class citizens.

Where Graphiti fits


Chapter 10 · Verba (Weaviate) / Cody Memories (Sourcegraph) / MemPress

These three are specialized memory systems for narrow domains.

Verba (Weaviate)

Cody Memories (Sourcegraph)

MemPress


Chapter 11 · Generative Agents (Stanford 2023) — The Academic Inspiration

Almost every commercial memory system owes a design debt to the 2023 Stanford paper "Generative Agents: Interactive Simulacra of Human Behavior."

The experiment

The memory architecture

The paper proposes three components:

  1. Memory Stream — every observation is recorded in natural language (episodic).
  2. Reflection — periodically, an LLM reads the memory and produces higher-order reasoning ("I do not have many friends"). The reflection goes back into memory.
  3. Planning — a daily plan is built from memory and reflections.

Recall is a weighted sum of importance + recency + relevance:

score = a*importance + b*recency + g*similarity

This formula is still the canonical recall algorithm in almost every memory system.

The legacy of Generative Agents

A rare case of a single academic paper writing the design language of an entire product category.


Chapter 12 · Storage Backends — pgvector / Qdrant / Neo4j / Memgraph / Kuzu

Memory libraries eventually have to write data somewhere. The backends that show up most in 2026:

Vector backends

BackendCharacteristicsGood fit
Postgres + pgvectorLow operational burden, full SQL, transactionsTeams already on Postgres, memory + metadata joins
QdrantRust-fast, strong filtering, self-host friendly100M+ vectors, complex payload filters
PineconeManaged, fast to adopt, solid SLAWhen you do not want to run infra
WeaviateMultimodal, GraphQL, modularNon-text modalities, custom transform pipelines
LanceDBEmbedded, Arrow-based, local-friendlyNotebook and edge agents
ChromaLocal-friendly, simple DXPrototypes, demos

Graph backends

BackendCharacteristicsGood fit
Neo4jKG standard, rich CypherEnterprise, large KGs
MemgraphC++ fast, Neo4j-compatibleReal-time KG, streaming
KuzuEmbedded, OLAP columnar graphAnalytical KGs, notebooks
NetworkXPure Python in-memoryPrototypes, small graphs
AWS NeptuneManaged, GremlinAWS ecosystem

A 2026 practical guide


Chapter 13 · Korea / Japan — Upstage, NAVER HCX, Sakana, PFN

Korea

Japan


Chapter 14 · Who Should Pick What

Recommendations by scenario, compressed into one table.

ScenarioFirst pickSecond pickAvoid
Quick user-preference memory (chatbot, FAQ)Mem0OpenAI Assistants threadsBuilding a KG
Enterprise, fact consistency (CRM, sales)ZepGraphiti directly + Neo4jPure vector + auto-forget
Multi-agent, persistent personaLettaMem0 multi-actor modeStateless API + simple client memory
Code-assistant memoryCody Memories (SaaS) or DIY + Mem0Cognee (for codebase KG)Generic chat memory as-is
Domain KG builds (pharma, legal)CogneeGraphitiTrying to solve it with vectors only
Internal-doc RAG + memoryVerbaMem0 + custom RAGRAG without memory
Claude-centric product, fast launchAnthropic Memory APIMem0 + ClaudeHand-rolled context management
Long-running simulation, character agentsLetta + Generative Agents ideasMemPress (compression)Just enlarging the window
Research, experimentsGenerative Agents codebase + customLlamaIndex Memory + custom KGSaaS memory (black box)
Memory grew so large it is now slowMemPress (summary tree)Zep (built-in summaries)Naive TTL expiry

Decision tree

Start
  ├─ Does "why / when / what changed" matter in memory?
  │     YES -> graph/temporal memory needed -> Zep or Cognee+Graphiti
  │     NO  -> next
  ├─ Is the agent always on, with its own persona?
  │     YES -> Letta
  │     NO  -> next
  ├─ Is Claude the only model, and is simplicity paramount?
  │     YES -> Anthropic Memory API
  │     NO  -> next
  ├─ Do you just need to remember "user preferences + facts"?
  │     YES -> Mem0
  │     NO  -> go back up and redefine the requirement
  └─ Will memory grow to hundreds of thousands of entries?
        YES -> add MemPress as a compression layer

Epilogue — Memory Is the Next Decision Point in 2026 AI Infra

In 2023 and 2024 the infra debate was about vector DBs. In 2025 it was about agent frameworks. In 2026 the debate is about memory architecture.

Three big takeaways:

  1. Pure vector memory is only step one. Once time, conflicts, and relations enter the picture, you need graph or episodic memory.
  2. Memory outlives the model. Models change every six months, but user memory must last for years. Data portability is decisive — do not lock memory inside a SaaS black box.
  3. Memory is hard to evaluate. Benchmark standards are immature. Building your own recall eval set (question to expected fact) is the safest bet.

"An agent's intelligence is decided by the model, but its usefulness is decided by its memory."

The same model with a different memory system becomes a completely different assistant. So treat the memory choice as an infrastructure decision — as weighty as the model choice itself.


References

Comments

No comments yet.

Sign in to leave a comment