Skip to main content

Migrate from Mem0

Keep your Mem0 calls, switch one import, and bring your memories with you.

4 min readUpdated November 2026

Switch one import

Method names, keyword arguments and return shapes follow Mem0 2.x. Pass a SQLite path, a store or a database URL, as for Memory.

app.pypython
# from mem0 import Memory
from llmslim.memory.compat import Mem0Memory as Memory

memory = Memory("memory.db")
memory.add([{"role": "user", "content": "I moved to Pune last month."}], user_id="asha")

hits = memory.search("Where does Asha live?", filters={"user_id": "asha"})
for hit in hits["results"]:
    print(hit["score"], hit["memory"])
print(hits["context"])  # the selected turns, ready for a prompt

What it does differently

The differences are deliberate, and they fail loudly rather than silently:

  • Nothing is extracted. add stores turns verbatim; every returned event is ADD.
  • search selects the turns that answer the question within a token budget (an LLMSlim extension, default 2,000), returns them ranked by a lexical overlap score, and also returns the prompt-ready text under "context". rerank=True uses LLMSlim's optional cross-encoder (llmslim[semantic]); threshold and explain are ignored.
  • Filters match user_id, agent_id and run_id exactly, and at least one is required. Any other filter key raises ValueError instead of being ignored. Scope ids go inside filters, as Mem0 2.x requires.
  • expiration_date and reference_date aren't supported and raise.
  • get_all returns the newest top_k (default 20) of a scope; history returns a turn's current state only, since there is no extraction history; reset raises, rather than deleting every user's memory.
  • from_config ignores LLM, embedder and vector-store settings; a {"store": path} entry selects a SQLite file.

Bring your memories

0.12 has no importer: add your memories with memory.add, one per call, under their user_id. 1.0 adds llmslim import mem0, which reads a Mem0 export directly: see the 1.0 preview.

When you're ready, use Memory itself

Mem0Memory wraps llmslim.memory.Memory, which has the rest: per-call budgets and time windows, sections for standing requests, preferences and conflicts, and the stores. See the Python quickstart.

Questions

Does it call an LLM when I add memories?

No. add stores each turn word for word and makes no model call, so infer, prompt and memory_type are accepted and ignored.

Does it cover Mem0's hosted client?

No. Mem0Memory follows the interface of Mem0's Memory class, the open-source library, in its 2.x shape.