Mem0 Migration

How to migrate from Mem0 to Zep

Zep is a memory layer for AI agents that unifies chat and business data into a dynamic temporal knowledge graph for each user. It tracks entities, relationships, and facts as they evolve, enabling you to build prompts with only the most relevant information—reducing hallucinations, improving recall, and lowering LLM costs.

Zep provides high-level APIs like memory.get and deep search with graph.search, supports custom entity/edge types, fact ratings, hybrid search, and granular graph updates. Mem0, by comparison, offers basic add/get/search APIs and an optional graph, but lacks built-in data unification, ontology customization, temporal fact management, fact ratings, and fine-grained graph control.

Got lots of data to migrate? Contact us for a discount and increased API limits.

Zep’s memory model in one minute

Unified customer record

  • Messages sent via memory.add go straight into the user’s knowledge graph; business objects (JSON, docs, e-mails, CRM rows) flow in through graph.add. Zep automatically deduplicates entities and keeps every fact’s valid and invalid dates so you always see the latest truth.

Domain-depth ontology

Temporal facts & ratings

  • Every edge stores when a fact was created, became valid, was invalidated, and (optionally) expired; fact_ratings let you auto-label facts (e.g., “high-confidence KYC data”) and filter on retrieval.

How Zep differs from Mem0

CapabilityZepMem0
Business-data ingestionNative via graph.add (JSON or text); business facts merge with user graphNo direct ingestion API; business data must be rewritten as “memories” or loaded into external graph store
Knowledge-graph storageBuilt-in temporal graph; zero infra for developersOptional “Graph Memory” layer that requires Neo4j/Memgraph and extra config
Custom ontologyFirst-class entity/edge type systemNot exposed; relies on generic nodes/relationships
Fact life-cycle (valid/invalid)Automatic and queryableNot documented / not supported
Fact ratings & filteringYes (fact_ratings API)Not available
SearchHybrid vector + graph search with multiple rerankersVector search with filters; basic Cypher queries if graph layer enabled
Graph CRUDFull node/edge CRUD & bulk episode ingestAdd/Delete memories; no low-level edge ops
Memory context stringAuto-generated, temporal, prompt-readyYou assemble snippets manually from search output
LLM integrationReturns ready-made memory.context; easily integrates with agentic toolsReturns raw strings you must format

SDK support

Zep offers Python, TypeScript, and Go SDKs. See Installation Instructions for more details.

Migrating your code

Basic flows

What you do in Mem0Do this in Zep
client.add(messages, user_id=ID) → stores conversation snippetszep.memory.add(session_id, messages=[...]) – keeps chat sequence and updates graph
client.add("json...", user_id=ID) (not really supported)zep.graph.add(user_id, data=<JSON>) – drop raw business records right in
client.search(query, user_id=ID) – vector+filter searchEasy path: zep.memory.get(session_id) returns the memory.context + recent messages
Deep path: zep.graph.search(user_id, query, reranker="rrf")
client.get_all(user_id=ID) – list memorieszep.graph.search(user_id, '') or iterate graph.get_nodes/edges for full dump
client.update(memory_id, ...) / deletezep.graph.edge.delete(uuid_="edge_uuid") or zep.graph.episode.delete(uuid_="episode_uuid") for granular edits. Facts may not be updated directly; new data automatically invalidates old.

Practical tips

  • Session mapping: Map Mem0’s user_id → Zep user_id, and create session_id per conversation thread.
  • Business objects: Convert external records to JSON or text and feed them through graph.add; Zep will handle entity linking automatically.
  • Prompting: Replace your custom “summary builder” with the memory.context string; it already embeds temporal ranges and entity summaries.
  • Quality filters: Use Fact Ratings and apply min_fact_rating when calling memory.get to exclude low-confidence facts instead of manual post-processing.
  • Search tuning: Start with the default rrf reranker; switch to mmr, node_distance, cross_encoder, or episode_mentions when you need speed or precision tweaks.

Side-by-side SDK cheat-sheet

OperationMem0 Method (Python)Zep Method (Python)Notes
Add chat messagesm.add(messages, user_id=...)zep.memory.add(session_id, messages)Zep expects ordered AI + user msgs per turn
Add business recordn/a (work-around)zep.graph.add(user_id, data)Direct ingestion of JSON/text
Retrieve contextm.search(query,... )zep.memory.get(session_id)Zep auto-selects facts; no prompt assembly
Semantic / hybrid searchm.search(query, ...)zep.graph.search(..., reranker=...)Multiple rerankers, node/edge scopes
List memoriesm.get_all(user_id)zep.graph.search(user_id, '')Empty query lists entire graph
Update factm.update(id, ...)Not directly supported - add new data to supersedeFacts are temporal; new data invalidates old
Delete factm.delete(id)zep.graph.edge.delete(uuid_="edge_uuid")Episode deletion removes associated edges
Rate / filter factsnot supportedmin_fact_rating param on memory.get

Where to dig deeper

For any questions, ping the Zep Discord or contact your account manager. Happy migrating!