Agent Memory You Can Self-Host

📘 Tutorials 2026-11-20 7 min read

Every agent-memory tutorial you find assumes the same install command, and half of them were written against APIs that have since been renamed or moved to a different package registry.

📜 Table of Contents

Three open-source projects cover most of what people mean by "agent memory", and they disagree about almost everything: what gets stored, where it lives, and what you have to run beside them. The fastest way to choose is to look at the install artifact.

mem0GraphitiLetta
installpip install mem0aipip install graphiti-corenpm install -g @letta-ai/letta-code
version on 2026-11-202.2.10.31.20.34.66
artifact size0.35 MB wheel0.40 MB wheel33.6 MB unpacked, 21 dependencies
direct core dependencies8821
runtime floorPython >=3.10, <4.0Python >=3.10, <4Node ^22.23.4 / ^24.22.1 / ^26.12.1, or Bun >=1.3.2
store you must runa vector store, Qdrant by default in the clientNeo4j 5.26, FalkorDB 1.1.2, or Neptune + OpenSearchits own agent state server
GitHub stars69,24132,9443,875 (letta-code); 25,491 on the archived V1 repo
licenseApache-2.0Apache-2.0Apache-2.0

Those numbers come from the PyPI JSON API, the npm registry and the GitHub API on 20 November 2026. The middle row is the one that decides your weekend: a 0.4 MB wheel that needs a graph database is a different project from a 0.4 MB wheel that needs a vector index.

mem0: facts about a user, retrieved by similarity

mem0 turns a conversation into extracted facts and stores them as vectors, optionally mirrored into a graph. The Python package is small because the heavy parts are optional: the eight core dependencies in 2.2.1 are httpx, openai, posthog, protobuf, pydantic, pytz, qdrant-client and sqlalchemy. Qdrant is the vector store it reaches for first, and the official image is 82 MB.

# vector store
docker run -d -p 6333:6333 -v qdrant:/qdrant/storage qdrant/qdrant:v1.15.0

pip install mem0ai==2.2.1
from mem0 import Memory

m = Memory()                      # reads config from env or MemoryConfig
m.add("I moved to Lisbon in March and I hate phone calls",
      user_id="alice")

hits = m.search("where does alice live",
                filters={"user_id": "alice"},
                top_k=5)

Two API details bite people copying older tutorials. search() in 2.x takes filters={"user_id": ...}, not a bare user_id argument, and its default top_k is 20, which is more context than most prompts want. The add() signature also carries infer: bool = True, and that default is why a "memory" call is not free.

With infer=True, the library calls the model to decide which facts in the message are worth keeping and how they update what is already stored. The 2.2.1 source has one llm.generate_response call in _add_to_vector_store. Pass infer=False and you are writing the string as-is, which is cheap and dumb; leave it on and every message you remember costs a model round trip on top of the embedding.

Graphiti: facts with dates on them

Graphiti models memory as a temporal knowledge graph: entities, relationships, and the window during which each edge was true. That is the shape you want when the question is "which vendor were we using in Q1" rather than "what does this user like". The cost is a graph database. The project's README lists Neo4j 5.26, FalkorDB 1.1.2, or Amazon Neptune plus OpenSearch as the supported backends, and the core package depends on neo4j>=5.26.0 directly.

docker run -p 6379:6379 -p 3000:3000 -it --rm falkordb/falkordb:latest   # 177 MB
pip install graphiti-core
from datetime import datetime, timezone
from graphiti_core import Graphiti

g = Graphiti("bolt://localhost:7687", "neo4j", "password")

await g.add_episode(
    name="vendor review",
    episode_body="We moved off vendor A in June because of the outage",
    source_description="ops meeting notes",
    reference_time=datetime(2026, 11, 18, tzinfo=timezone.utc),
)
results = await g.search("when did we leave vendor A", num_results=5)

reference_time is a required argument, not a convenience. Episodes are ordered and edges are invalidated by it, so a batch imported with the wrong timestamp produces a timeline that contradicts itself. Feed it the time the event happened, not the time you imported it.

Letta: the install command moved registries

This is the trap worth knowing before you start. pip install letta still resolves, to version 0.34.12, and that package is the retired V1 server. The project's own README now points to letta-ai/letta-code as the current source and says the old repository's code lives on an archive branch. Installation is npm:

npm install -g @letta-ai/letta-code

letta          # interactive terminal UI
letta server   # app server for local or self-hosted agents

The npm package declares Node ^22.23.4 || ^24.22.1 || ^26.12.1 (or Bun ≥1.3.2) and ships 33.6 MB unpacked with 21 dependencies, which is a terminal UI plus a runtime rather than a library. Letta's model is different from the other two: the agent owns memory blocks and decides when to edit them, instead of a separate extraction step writing facts into an index. If your agent needs to manage its own context window, that is the feature; if you want retrieval over user facts, it is overhead.

Choosing

if the job ispickbecause
remember a user's preferences across chatsmem0 + Qdrantcheapest path to retrieval, 82 MB image, facts as vectors
answer "what changed and when"Graphitiedges carry validity windows; a vector index cannot express that
an agent that edits its own contextLettamemory blocks live inside the agent loop, by design
one box, no extra servicesmem0 with a local storethe other two require a database process of their own

Infrastructure to budget for, in image sizes: Qdrant 82 MB, FalkorDB 177 MB, PostgreSQL 17 at 167 MB if your vector store is pgvector. On a 2 vCPU box, running any two of these beside the app that uses them is where small VPS plans start swapping.

The part nobody prices

All three write through a model, not just through a database. mem0 does one extraction call per add() with infer=True; Graphiti runs entity and edge extraction over every episode; Letta's agent loop spends tokens deciding what to keep. A memory layer that costs one model call per message doubles the model spend of a chat app, and no benchmark table tells you that.

Cheap way to find out before committing: write 50 real messages through the candidate with infer=True, count the tokens the provider bills for that write path, and multiply by your message volume. Compare that against the price of the retrieval side, which is usually a fraction of it.

FAQ

Do I need a graph database for mem0? No. The graph path is optional; the default is a vector store, and Qdrant is what the core dependencies assume.

Can Graphiti run on FalkorDB instead of Neo4j? Yes. The README lists FalkorDB 1.1.2 as a supported backend with its own extras and a one-line Docker command.

Is the PyPI letta package dead? It is the retired V1 server kept for reproducibility. New work goes through the npm package, per the project README.

Which one is fastest? No number here, because latency depends on your model and your store, and vendor benchmark charts are not a substitute for measuring your own path. The artifact sizes above tell you how much software sits between the call and the answer; they say nothing about milliseconds.

Versions, wheel sizes and dependency counts were read on 20 November 2026 from the PyPI JSON API (mem0ai 2.2.1, graphiti-core 0.31.2, letta 0.34.12), the npm registry (@letta-ai/letta-code 0.34.66), the GitHub API and the Docker Hub API. Signatures were read from mem0/memory/main.py and graphiti_core/graphiti.py on their main branches.

Related: how agent memory benchmarks compare, embedding choices behind these stores, a mem0 walkthrough.

Related Articles
2026-07-22
Mac Studio for AI 2026: Apple Silicon
2026-08-14
AI Diagram Generator From Code 2026: Auto-Document Your Architecture
2026-07-26
Self-Hosted AI Hardware Guide 2026: Choosing a Machine for Local LLMs
2026-07-22
Stable Diffusion Tutorial for Beginners 2026
2026-07-26
AI Pair Programming vs Vibe Coding: Key Differences
2026-07-22
Udio AI Music Tutorial 2026

Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.

💬 Comments (0)

No comments yet. Be the first!

Login to comment