LangMem vs Mem0 2026: Storage, Updates, Setup, Pricing

LangMem vs Mem0 2026: Storage, Updates, Setup, Pricing

Say you build a LangGraph support agent and add LangMem. It saves "Ana prefers email over phone" with create_manage_memory_tool. You restart the process for a deploy, and Ana's preference is gone.

That isn't a LangMem bug. The LangMem docs example uses InMemoryStore, which "keeps memories in process memory—they'll be lost on restart." It's the first thing to check when you compare LangMem vs Mem0: where each one keeps memory, how it updates, and what it needs to run.

Here's the short answer. LangMem is an MIT-licensed Python library that adds memory tools to LangGraph agents and keeps memory in a LangGraph store. Mem0 is an Apache 2.0 library with a hosted Platform, and it extracts memories with an LLM into a vector store. Both store facts and find them by search. That's where I part ways with both: memory is not search. Hindsight keeps what happened and learns from outcomes.

I build Hindsight, so I'm not neutral. Every fact about LangMem and Mem0 below comes from their own docs, repository or pricing page, read in November 2026. This page gives you one table, the update path of each product, setup code from each doc, pricing and license, what the benchmark numbers say, and how to choose. If you want the wider field first, read agent memory systems compared. If you want the basics, start with AI agent memory.

Want to see retain, recall and reflect run on your own data? Run the Hindsight quickstart and you'll have a local server in a few minutes.

LangMem vs Mem0 at a Glance

LangMem is a library for LangGraph agents. Mem0 is a library plus a hosted API. I put Hindsight in the third column, because you came here to compare the first two and you should see what a third design looks like.

LangMemMem0Hindsight
LicenseMITApache 2.0MIT
Installpip install -U langmempip install mem0ai or npm install mem0aipip install hindsight-client, server with pip install hindsight-api
What it isLibrary for LangGraph agentsLibrary plus hosted PlatformMemory system on Postgres: open source, Hindsight Cloud, Hindsight Enterprise
Memory typesSemantic, episodic, proceduralMemories extracted by an LLM when you call addWorld facts and experience facts, plus observations
Default storageLangGraph BaseStore; the docs example uses InMemoryStoreLocal Qdrant at /tmp/qdrant, SQLite history at ~/.mem0/history.dbPostgreSQL
When memory updatesHot path tools, or a background managerOn each add callretain returns at once, consolidation runs in the background
Hosted optionNone in the LangMem docsMem0 PlatformHindsight Cloud
GraphNo graph layer described in the docsGraph memory is listed on the Custom tierEntity, time, meaning and causal links
MCP serverNone on the LangMem docs homeHosted at https://mcp.mem0.ai/mcp, 11 toolsBuilt-in MCP server

Two rows matter most. The first is where memory lives. A LangGraph store, a local Qdrant and a Postgres database each fail in a different way, and you run the one you pick. The second is when memory updates. LangMem lets you choose between the hot path and a background manager. Mem0 updates when your code calls add. Hindsight returns from retain at once and consolidates later, so the agent doesn't wait for the memory work.

How LangMem Stores and Updates Memory

LangMem's conceptual guide names three memory types. Semantic memory holds facts and knowledge, kept as a profile or a collection. Episodic memory "preserves successful interactions as learning examples". Procedural memory "encodes how an agent should behave and respond".

LangMem keeps procedural memory as prompt rules or a collection.

Memories sit in namespaces, and a namespace can be hierarchical: organization, user, application. LangMem integrates with LangGraph's BaseStore interface. You retrieve by key, by semantic search or by metadata filter. Back to Ana: her preference sits under a namespace, and the search tool finds it by meaning, so a question about how she wants to be contacted can reach it. A hierarchical namespace lets you scope the search to one user inside one application.

There are two update modes. In the hot path, the agent calls memory tools during the conversation. Updates are immediate, and they add latency. In the background, a memory manager extracts, consolidates and updates memories between interactions. It adds no response latency, and updates arrive later. You pick the trade per agent: pay in latency for a memory that is there on the next turn, or pay in delay for a faster reply.

create_manage_memory_tool and create_search_memory_tool

These two tools are the hot path. This is the setup from the LangMem docs:

from langgraph.prebuilt import create_react_agent
from langgraph.store.memory import InMemoryStore
from langmem import create_manage_memory_tool, create_search_memory_tool

store = InMemoryStore(index={"dims": 1536, "embed": "openai:text-embedding-3-small"})

agent = create_react_agent(
    "anthropic:claude-3-5-sonnet-latest",
    tools=[
        create_manage_memory_tool(namespace=("memories",)),
        create_search_memory_tool(namespace=("memories",)),
    ],
    store=store,
)

The core functions "do not depend on any particular database or storage system" in the docs' wording, but the stateful layer depends on LangGraph's long-term memory store. For production the docs say: "use the AsyncPostgresStore or a similar DB-backed store to persist memories across server restarts."

The LangMem repository is MIT licensed and had 1.8k stars in November 2026. If you're weighing LangChain's other memory options, I cover them in LangChain memory alternatives.

How Mem0 Stores and Updates Memory

Mem0 ships two products. Mem0 Open Source runs, in the docs' words, "as a library or a Docker stack, with your data on your infrastructure." Mem0 Platform is a hosted API with a dashboard, and it needs a Platform API key. The docs index calls the Platform "the recommended path".

The open source defaults, from the Mem0 open source docs: a local Qdrant at /tmp/qdrant, OpenAI gpt-5-mini as the LLM, OpenAI text-embedding-3-small as the embedder, and SQLite history at ~/.mem0/history.db. The reranker is off until you configure one. The default LLM needs OPENAI_API_KEY.

So a Mem0 open source install keeps two stores of its own: a Qdrant vector store that answers search, and a SQLite file that records the history of each memory. The Platform route changes who runs them. Mem0 runs them, and your agent calls the hosted API with a Platform API key.

The Platform adds features the docs index lists as Platform-only: entity filters v2, custom categories, webhooks and advanced retrieval. The pricing page lists graph memory on the Custom tier.

Mem0's MCP server is hosted at https://mcp.mem0.ai/mcp. It exposes 11 tools and needs a Mem0 account, so your memories live on Mem0's service when you use it. Mem0 has an open issue, #7467, about add_memory with infer=false on the Cloud API and MCP.

One Mem0 fact is plain: it ships both a Python and a TypeScript package, mem0ai on pip and on npm. If you're comparing Mem0 with other options, see Mem0 alternatives and Mem0 vs Supermemory.

Diagram of LangMem vs Mem0 memory updates: LangMem writes through hot path tools or a background manager into a LangGraph store, Mem0 extracts memories with an LLM into a vector store, and Hindsight retains facts, consolidates observations and reflects on them before the next action

Read the diagram left to right. The two grey lanes end at search. The blue lane ends at the next action. That difference is the reason I wrote this page.

LangMem vs Mem0 Setup: What Each Needs to Run

Both libraries install with pip. Both need a key for an LLM provider before they form a memory. Here are the steps from each doc.

LangMem

  1. Run pip install -U langmem.
  2. Set the API key for your LLM provider.
  3. Create a store. The docs example uses InMemoryStore.
  4. Create the two memory tools and the agent, as in the snippet above.
  5. For production, swap in a database-backed store such as AsyncPostgresStore.

Mem0 Open Source

  1. Run pip install mem0ai.
  2. Set OPENAI_API_KEY, which the defaults need.
  3. Create Memory(), then call add and search. The Mem0 Python quickstart gives this code:
from mem0 import Memory

m = Memory()

messages = [
    {"role": "user", "content": "Hi, I'm Alex. I love basketball and gaming."},
    {"role": "assistant", "content": "Hey Alex! I'll remember your interests."}
]
m.add(messages, user_id="alex")

results = m.search("What do you know about me?", filters={"user_id": "alex"})
print(results)

Each setup has one mistake that's easy to make. With LangMem, it's keeping InMemoryStore in production, which is the restart problem from the opening. With Mem0, it's running the open source library with no LLM key, because the defaults call OpenAI.

Picture Marco, who tries the Mem0 open source library on a laptop with no OpenAI key. The defaults call OpenAI gpt-5-mini and text-embedding-3-small, so Marco must set OPENAI_API_KEY, or configure another provider, before his first add. With the key set, the quickstart code runs as written. Both libraries ask for an LLM key before they form a memory.

Hindsight's setup has the same shape: install the client, run the server with an LLM key, then call retain. The difference is the database. Hindsight runs on Postgres, the same database a LangMem production setup already points to. View Hindsight on GitHub and read the code before you commit to any of the three.

LangMem vs Mem0 Pricing and License

LangMem is MIT licensed. The LangMem docs describe no hosted LangMem service and no LangMem price. Your cost is the LLM provider and the store you choose. LangGraph's long-term memory store comes by default in LangGraph Platform deployments.

Mem0's library is Apache 2.0. The Mem0 pricing page lists two plans as of November 2026:

PlanPriceWhat the page states
Free$0First 30 days: 10,000 adds and 1,000 retrievals a month, with model calls on Mem0. After that, with your own LLM key: 50,000 adds and 10,000 retrievals a month. Unlimited end users
CustomNo public priceLimits set to your volume. Adds graph memory, user profiles, Dream (memory consolidation), analytics, SSO, audit logs, SLA and on-prem deployment

Usage past the limits is billed, with a monthly cap you set. Third-party sites list other Mem0 tiers, but Mem0's own page shows only these two, so I print only these two.

Hindsight is MIT licensed open source on Postgres. Hindsight Cloud is the managed service. Hindsight Enterprise runs in a private cloud, BYOC or on premises. The licenses are short facts, and I'm not giving legal advice, so read each license file yourself.

What the Benchmark Numbers Say About LangMem and Mem0

The LangMem docs and repository publish no benchmark score, and Mem0 publishes none that names LangMem. So no LangMem vs Mem0 benchmark exists on the same test.

Mem0 states 92.5 on LoCoMo and 94.4 on LongMemEval on its research page. The page labels the LoCoMo figure "Mem0 Score" and names no judge model or answer model. So I keep those figures out of every table here. A score with no named judge is a claim, not a measurement.

Hindsight's figure has its metric. Hindsight v0.4.19 scored 94.6% on LongMemEval-S in single-query mode on the Agent Memory Benchmark, as of November 2026. That's answer accuracy, scored by an LLM judge. The paper, arXiv 2512.12818, gives the method. You'll find the current results on the Hindsight benchmarks page.

Mem0's own comparison post says Hindsight is "not publicly benchmarked". Hindsight published the paper and the Agent Memory Benchmark result, and both are linked above.

My rule: compare a number with another number only when the metric and the judge match. When a page won't name them, treat the number as a claim.

LangMem, Mem0 or Hindsight: How to Choose

LangMem fits a team that builds on LangGraph and wants memory tools inside that code.

Mem0 fits a team that wants a hosted memory API and an MCP endpoint, with a library it can also self-host.

Hindsight fits an agent that must learn from outcomes, in any framework. You call it through its SDK or API, so it doesn't tie you to one agent framework. It runs on Postgres, and Hindsight Cloud runs it for you.

Picture Lena's coding agent. With LangMem or Mem0 it remembers "deploys run through deploy.sh". It doesn't keep that Tuesday's deploy failed on a missing migration, so on Thursday it runs the same command. With Hindsight, retain keeps the failed deploy as an experience fact. Consolidation forms an observation from it in the background. reflect brings that observation into the next decision. Memory that learns changes the next action, not only the next answer.

The retain docs describe how each fact is classified as "experience" or "world", linked to entities, time, meaning and cause. This is the quickstart code:

from hindsight_client import Hindsight

client = Hindsight(base_url="http://localhost:8888")

client.retain(bank_id="my-bank", content="Alice works at Google as a software engineer")
client.recall(bank_id="my-bank", query="What does Alice do?")
client.reflect(bank_id="my-bank", query="Tell me about Alice")

Start the server with hindsight-api after you set your LLM key, as the quickstart shows. The Hindsight MCP server lets an assistant store and retrieve memories directly. For the full contrast, read Hindsight vs Mem0 and Hindsight vs LangChain memory.

Frequently Asked Questions

What is the difference between LangMem and Mem0?

LangMem adds memory tools to a LangGraph agent and keeps memory in a LangGraph store. Mem0 runs as a library with its own default stores, or as a hosted Platform. LangMem updates through hot path tools or a background manager. Mem0 updates when your code calls add.

Does LangMem work without LangGraph?

Partly. The core functions don't depend on a database or storage system. The stateful layer, with built-in persistence, depends on LangGraph's long-term memory store. If you don't use LangGraph, you wire the core functions to your own storage.

Does LangMem have a hosted version?

The docs list no hosted LangMem service. LangGraph Platform deployments include the LangGraph long-term memory store by default, which LangMem's stateful layer uses. So you host LangMem yourself, inside your own LangGraph deployment.

Do LangMem or Mem0 have graph memory?

Mem0 lists graph memory on the Custom tier of its pricing page, which has no public price. The LangMem docs describe no graph layer. Hindsight links each fact to entities, time, meaning and cause at retain time, as the retain docs describe.

Which memory tools does a LangMem agent call?

A LangMem agent calls two memory tools: create_manage_memory_tool and create_search_memory_tool. Both run in the hot path, so updates are immediate and add latency. You pass each one a namespace, such as ("memories",), and the agent gets a store when you create it.

Conclusion

LangMem vs Mem0 comes down to where memory lives, how it updates and what each one needs to run. Both find facts by search. I think the next gain comes from memory that changes what the agent does after it fails.

Here's what to do:

  1. Put a database-backed store under LangMem before production.
  2. Set the LLM and the embedder before the first Mem0 add.
  3. Pick a memory system by what it must do after the agent fails, not only by what it stores.

Then run the Hindsight quickstart, retain one real session, and call reflect. The open source version is MIT and runs on Postgres, so you can start on your laptop and move to Cloud later. When you're ready for the managed route, create a Hindsight Cloud account and point your agent at it today.