Skip to main content

mem0

mem0 is an open-source memory layer that adds persistent memory to any LLM application via four primitives: add, search, update, delete. Memories are extracted from raw input via an LLM extraction pass and stored as structured atomic facts with embeddings. It supports multi-level scoping with `user_id`, `agent_id`, and `run_id` for clean separation of user/agent/session memory. An optional graph memory mode (Neo4j-backed) stores entities and relations instead of just embeddings. Available self-hosted or via the Mem0 platform. It is designed to bolt onto existing apps rather than rearchitect the agent loop.

Example

A multi-tenant SaaS chat app calls `memory.add(messages, user_id="alice")` after each user turn — mem0 runs an extraction pass and stores any new facts as atomic memories scoped to Alice. On Alice's next session, the app calls `memory.search(query, user_id="alice")` before generation, retrieves the relevant facts, and injects them into the prompt. The same pipeline runs independently for every other user.

Put this into practice

Build polished, copy-ready prompts in under 60 seconds with SurePrompts.

Try SurePrompts