Key Features
- Multi-level memory: User preferences, session context, agent state
- Adaptive learning: Continuously improves from interactions
- Cross-platform SDKs: Python (
pip install mem0ai) and Node.js (npm install mem0ai) - Self-hosted or managed: Full control locally, or use the hosted platform
- LLM-agnostic: Works with OpenAI, Anthropic, and other providers
Full Example: Chat with Memory
from openai import OpenAI
from mem0 import Memory
openai_client = OpenAI()
memory = Memory()
def chat_with_memories(message: str, user_id: str = "default_user") -> str:
# Retrieve relevant memories
relevant = memory.search(query=message, user_id=user_id, limit=3)
memories_str = "\
".join(f"- {m['memory']}" for m in relevant["results"])
# Build prompt with memory context
system = f"You are a helpful AI. Use these memories:\
{memories_str}"
messages = [
{"role": "system", "content": system},
{"role": "user", "content": message}
]
# Generate response
response = openai_client.chat.completions.create(
model="gpt-4.1-nano-2025-04-14",
messages=messages
)
reply = response.choices[0].message.content
# Save new memories from conversation
messages.append({"role": "assistant", "content": reply})
memory.add(messages, user_id=user_id)
return reply
# Usage
chat_with_memories("I'm a Python developer who loves FastAPI")
chat_with_memories("What framework should I use for my next API?")
# → Mem0 remembers you prefer FastAPIUse Cases
- AI Assistants: Consistent, personalized conversations across sessions
- Customer Support: Remember past tickets, preferences, account history
- Healthcare: Track patient preferences and interaction history
- Productivity: Personal AI that knows your workflows and tools
- Gaming: NPCs that remember player choices and adapt
Integrations
- ChatGPT browser extension (adds memory to ChatGPT, Perplexity, Claude)
- LangGraph for building memory-enhanced agents
- CrewAI for multi-agent systems with shared memory
FAQ
Q: What is Mem0? A: Add persistent memory to AI agents and assistants. Remembers user preferences, context, and past interactions across sessions.
Q: How do I install Mem0? A: Check the Quick Use section above for step-by-step installation instructions. Most assets can be set up in under 2 minutes.