Mem0 (formerly Embedchain) is an open-source intelligent memory layer designed to provide personalized, persistent long-term memory for AI agents, assistants, and applications. It continuously extracts, refines, and deduplicates user preferences, session history, and agent state across conversations, enabling models to adapt dynamically to individual users over time.
graph TD
Interaction[User Conversation / Message] --> Mem0[Mem0 Engine]
Mem0 --> Extractor[Fact & Preference Extraction]
Extractor --> Deduplication[Deduplication & Conflict Resolution]
Deduplication --> Store[(Memory Store<br/>User / Agent / Session Levels)]
Store --> Search[Semantic & Filtered Search]
Search --> PromptInjection[Prompt Context Augmentation]
Mem0 can be installed via pip install mem0ai:
from mem0 import Memory
# 1. Initialize local memory instance
config = {
"vector_store": {
"provider": "qdrant",
"config": {"path": "/tmp/qdrant"}
}
}
memory = Memory.from_config(config)
# 2. Add memories from conversation turns
memory.add(
"I prefer working with Python and async/await over synchronous code.",
user_id="user_123",
metadata={"category": "coding_preferences"}
)
# 3. Retrieve relevant memories during a new conversation
relevant = memory.search(
"How should I structure the backend service?",
user_id="user_123"
)
for entry in relevant:
print(f"Recalled: {entry['memory']}")
Mem0 supports a pluggable vector database architecture:
pgvector), Redis, OpenSearch.