Skip to main content
Mem0 offers two powerful ways to leverage our technology: our managed platform and our open source solution. Check out our Playground to see Mem0 in action.

Mem0 Platform (Managed Solution)

Our fully managed platform provides a hassle-free way to integrate Mem0’s capabilities into your AI agents and assistants. Sign up for Mem0 platform here. The Mem0 SDK supports both Python and JavaScript, with full TypeScript support as well. Follow the steps below to get started with Mem0 Platform:
  1. Install Mem0
  2. Add Memories
  3. Retrieve Memories

1. Install Mem0

pip install mem0ai
  1. Sign in to Mem0 Platform
  2. Copy your API Key from the dashboard Get API Key from Mem0 Platform

2. Add Memories

import os
from mem0 import MemoryClient

os.environ["MEM0_API_KEY"] = "your-api-key"

client = MemoryClient()
messages = [
    {"role": "user", "content": "Thinking of making a sandwich. What do you recommend?"},
    {"role": "assistant", "content": "How about adding some cheese for extra flavor?"},
    {"role": "user", "content": "Actually, I don't like cheese."},
    {"role": "assistant", "content": "I'll remember that you don't like cheese for future recommendations."}
]
client.add(messages, user_id="alex")

3. Retrieve Memories

# Example showing location and preference-aware recommendations
query = "I'm craving some pizza. Any recommendations?"
filters = {
    "AND": [
        {
            "user_id": "alex"
        }
    ]
}
client.search(query, version="v2", filters=filters)
filters = {
   "AND": [
      {
         "user_id": "alex"
      }
   ]
}

all_memories = client.get_all(version="v2", filters=filters, page=1, page_size=50)

Mem0 Platform

Learn more about Mem0 platform

Mem0 Open Source

Our open-source version is available for those who prefer full control and customization. You can self-host Mem0 on your infrastructure and integrate it with your AI agents and assistants. Checkout our GitHub repository Follow the steps below to get started with Mem0 Open Source:
  1. Install Mem0 Open Source
  2. Add Memories
  3. Retrieve Memories

1. Install Mem0 Open Source

pip install mem0ai

2. Add Memories

from mem0 import Memory
m = Memory()
# For a user
messages = [
    {
        "role": "user",
        "content": "I like to drink coffee in the morning and go for a walk"
    }
]
result = m.add(messages, user_id="alice", metadata={"category": "preferences"})

3. Retrieve Memories

related_memories = m.search("Should I drink coffee or tea?", user_id="alice")
I