Migrate from Mem0
This guide maps common Mem0 operations to Zep. Review the current Mem0 API before you export data because Mem0 can change its data model.
Zep stores agent memory in a Context Graph. A user graph combines a user’s chat messages and business data.
Contact sales@getzep.com before a large migration that needs higher API limits.
Map the data models
Use one Zep user for each application user. Use one Zep thread for each conversation. The user uuid also addresses the user graph.
Add ordered chat messages with thread.add_messages. Add text or JSON business data with graph.episode.add. Use these methods only for real-time ingestion in production. To import the data that you export from Mem0, use the Batch API, directly or through zep-ingest.
Zep extracts entities and temporal facts from both data sources. Zep uses the reference_time of each message and episode to derive fact timestamps.
Map common operations
The table gives the Zep method that your application calls after the migration for each Mem0 operation.
Do not translate each Mem0 memory into a Zep fact. Ingest the source messages or records so Zep can build the graph.
Migration procedure
- Install a Zep SDK and create an API key.
- Export users, conversation messages, and business records from Mem0. Keep the original timestamp of each message and record.
- Create a Zep user for each application user. Store the user
uuidnext to the application user ID in your database. - Create a Zep thread for each conversation. Store the thread
uuidnext to the conversation ID in your database. - If you use a custom ontology, set it before you import data. Zep does not apply an ontology to data that it already ingested.
- Give each message and record its original time. For
zep-ingest, setcreated_at. The package sendscreated_atasreference_time. For the Batch API, setreference_time. If an item has no original time, Zep uses the ingestion time. - Import the conversation messages and the business records with
zep-ingestor the Batch API. Submit the items of each graph in chronological order. - Monitor the import until it completes:
- For
zep-ingest, callIngestResult.wait(). - For the Batch API, poll the batch with
batch.getuntil its status is terminal. Then check the status of each item withbatch.list_items. Do not use only theingest.batch.completedwebhook, because Zep does not send it when a batch fails or when items fail.
- For
- Compare retrieval results for a representative set of user questions.
- After the import, send new conversation turns with
thread.add_messages. Send new business records withgraph.episode.add.
Follow Prepare data for ingestion so each record has a timestamp, a stable identity, and a single destination graph. See Check data ingestion status for the polling and webhook patterns.
Retrieval after migration
Use thread.get_context when the current conversation supplies the query. The method searches the full user graph, so the Context Block can include context from other threads of the same user. The Context Block can include all supported context types.
Use graph.get_context when your application supplies the query. Use a typed search method, such as graph.search_nodes or graph.search_edges, when you need nodes, edges, episodes, observations, or thread summaries separately.
Treat all retrieved content as untrusted model input. Follow memory security best practices when you send it to a model.