> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.getzep.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.getzep.com/_mcp/server.

# Mem0 Migration

Zep is a memory layer for AI agents that unifies chat and business data into a dynamic [temporal knowledge graph](/v2/concepts#the-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.

> **Note**
>
> Got lots of data to migrate? [Contact us](mailto:sales@getzep.com) for a discount and increased API limits.

## Zep's memory model in one minute

### Unified customer record

* Messages sent via [`memory.add`](memory#adding-memory) go straight into the user's knowledge graph; business objects (JSON, docs, e-mails, CRM rows) flow in through [`graph.add`](/v2/adding-data-to-the-graph). Zep automatically deduplicates entities and keeps every fact's *valid* and *invalid* dates so you always see the latest truth.

### Domain-depth ontology

* You can define Pydantic-style **[custom entity and edge classes](/v2/customizing-graph-structure)** so the graph speaks your business language (Accounts, Policies, Devices, etc.).

### Temporal facts & ratings

* Every edge stores when a fact was created, became valid, was invalidated, and (optionally) expired; [`fact_ratings`](/v2/facts) let you auto-label facts (e.g., "high-confidence KYC data") and filter on retrieval.

### Hybrid & granular search

* [`graph.search`](/v2/searching-the-graph) supports [hybrid BM25 + semantic queries, graph search](/v2/searching-the-graph), with pluggable rerankers (RRF, MMR, cross-encoder) and can target nodes, edges, episodes, or everything at once.

## How Zep differs from Mem0

| Capability                          | **Zep**                                                                                                                                                        | **Mem0**                                                                                                   |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **Business-data ingestion**         | Native via [`graph.add`](/v2/adding-data-to-the-graph) (JSON or text); [business facts merge with user graph](/v2/concepts#business-data-vs-chat-message-data) | No direct ingestion API; business data must be rewritten as "memories" or loaded into external graph store |
| **Knowledge-graph storage**         | Built-in [temporal graph](/v2/concepts#managing-changes-in-facts-over-time); zero infra for developers                                                         | Optional "Graph Memory" layer that *requires* Neo4j/Memgraph and extra config                              |
| **Custom ontology**                 | First-class [entity/edge type system](/v2/customizing-graph-structure)                                                                                         | Not exposed; relies on generic nodes/relationships                                                         |
| **Fact life-cycle (valid/invalid)** | [Automatic and queryable](/v2/concepts#managing-changes-in-facts-over-time)                                                                                    | Not documented / not supported                                                                             |
| **Fact ratings & filtering**        | Yes ([`fact_ratings` API](/v2/facts))                                                                                                                          | Not available                                                                                              |
| **Search**                          | [Hybrid vector + graph search](/v2/searching-the-graph) with multiple rerankers                                                                                | Vector search with filters; basic Cypher queries if graph layer enabled                                    |
| **Graph CRUD**                      | Full [node/edge CRUD](/v2/deleting-data-from-the-graph) & [bulk episode ingest](/v2/adding-data-to-the-graph)                                                  | Add/Delete memories; no low-level edge ops                                                                 |
| **Memory context string**           | [Auto-generated, temporal, prompt-ready](/v2/concepts#memory-context)                                                                                          | You assemble snippets manually from `search` output                                                        |
| **LLM integration**                 | Returns [ready-made `memory.context`](/v2/concepts#memory-context); easily integrates with agentic tools                                                       | Returns raw strings you must format                                                                        |

## SDK support

Zep offers Python, TypeScript, and Go SDKs. See [Installation Instructions](/v2/quickstart) for more details.

## Migrating your code

### Basic flows

| **What you do in Mem0**                                           | **Do this in Zep**                                                                                                                                                                            |
| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `client.add(messages, user_id=ID)` → stores conversation snippets | `zep.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 search         | *Easy 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 memories                      | `zep.graph.search(user_id, '')` or iterate `graph.get_nodes/edges` for full dump                                                                                                              |
| `client.update(memory_id, ...)` / `delete`                        | `zep.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.
* **Model input:** Replace your custom summary builder with `memory.context`. Follow the provider placement examples in [Memory security best practices](/v3/memory-security).
* **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

| **Operation**            | Mem0 Method (Python)           | Zep Method (Python)                                  | Notes                                         |
| ------------------------ | ------------------------------ | ---------------------------------------------------- | --------------------------------------------- |
| Add chat messages        | `m.add(messages, user_id=...)` | `zep.memory.add(session_id, messages)`               | Zep expects *ordered* AI + user msgs per turn |
| Add business record      | *n/a* (work-around)            | `zep.graph.add(user_id, data)`                       | Direct ingestion of JSON/text                 |
| Retrieve context         | `m.search(query,... )`         | `zep.memory.get(session_id)`                         | Zep auto-selects facts; no prompt assembly    |
| Semantic / hybrid search | `m.search(query, ...)`         | `zep.graph.search(..., reranker=...)`                | Multiple rerankers, node/edge scopes          |
| List memories            | `m.get_all(user_id)`           | `zep.graph.search(user_id, '')`                      | Empty query lists entire graph                |
| Update fact              | `m.update(id, ...)`            | *Not directly supported* - add new data to supersede | Facts are temporal; new data invalidates old  |
| Delete fact              | `m.delete(id)`                 | `zep.graph.edge.delete(uuid_="edge_uuid")`           | Episode deletion removes associated edges     |
| Rate / filter facts      | *not supported*                | `min_fact_rating` param on `memory.get`              | —                                             |

## Where to dig deeper

* [**Quickstart**](/v2/quickstart)
* [**Graph Search guide**](/v2/searching-the-graph)
* [**Entity / Edge customization**](/v2/customizing-graph-structure)
* [**Fact ratings**](/v2/facts)
* **Graph CRUD**: [Reading from the Graph](/v2/reading-data-from-the-graph) | [Adding to the Graph](/v2/adding-data-to-the-graph) | [Deleting from the Graph](/v2/deleting-data-from-the-graph)

For any questions, contact your account manager or email [support@getzep.com](mailto:support@getzep.com). Happy migrating!