Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mem0.ai/llms.txt

Use this file to discover all available pages before exploring further.

Migrate from Open Source to Platform

Move your Mem0 implementation to managed infrastructure with enterprise features.
ScopeEffortDowntime
Infrastructure & CodeLow (~30 mins)None (Parallel run possible)
Using Mem0 Open Source with hosted Qdrant? You can migrate your existing memories to Mem0 Platform with a one-line script below.
Why migrate to Platform?
  • Time to Market: Set up in 5 minutes vs 30+ minutes for OSS configuration
  • Enterprise Ready: Audit logs, workspace governance, and dedicated support
  • Advanced Features: Webhooks, memory export, analytics dashboard, custom categories
  • Multi-tenancy: Organizations, projects, and team management out of the box
  • Zero Infrastructure: No vector database, LLM provider, or maintenance overhead
  • Enhanced Search: Reranking, keyword expansion, and advanced filters
  • Production Grade: Auto-scaling, high availability, dedicated support

Plan

  1. Sign up: Create an account on Mem0 Platform.
  2. Get API Key: Navigate to Settings > API Keys and generate a new key.
  3. Review Usage: Identify where you instantiate Memory and where you call search or get_all.

Migrate

1. Import Memories Into Platform

If your Mem0 Open Source setup uses hosted Qdrant as the vector store, you can import your existing memories to Mem0 Platform with one command:
curl -fsSL https://raw.githubusercontent.com/mem0ai/mem0/main/scripts/oss-to-platform-migrate.sh | bash
This migration script currently supports hosted Qdrant only. Support for local Qdrant, pgvector, and other vector stores is coming soon.
If you are using a different vector store and want to migrate to Platform, please contact Mem0 support and we’ll send you a custom migration script for your setup.

2. Install or Update SDK

Ensure you have the latest version of the SDK, which supports both OSS and Platform clients.
pip install mem0ai --upgrade

3. Update Initialization

Switch from the local Memory class to the managed MemoryClient.
Open Source (Old)
from mem0 import Memory

config = {
    "vector_store": {
        "provider": "qdrant",
        "config": {"host": "localhost", "port": 6333}
    },
    "llm": {
        "provider": "openai",
        "config": {"model": "gpt-4"}
    }
}

m = Memory.from_config(config)
Platform (New)
from mem0 import MemoryClient
import os

# Set MEM0_API_KEY in environment or pass explicitly
client = MemoryClient(api_key="m0-...")
Run client.get_all(filters={"user_id": "test_connection"}) to verify your API key works. It should return an empty list or valid results.

4. Update Retrieval Calls (Critical)

Critical Change: Platform uses v2 endpoints that require filtering parameters to be nested inside a filters dictionary.
The limit parameter has been removed in favor of top_k across all SDKs. Update any code using limit= to use top_k= instead.
MethodOpen SourcePlatform
search()m.search(query, user_id="alex")client.search(query, filters={"user_id": "alex"})
get_all()m.get_all(user_id="alex")client.get_all(filters={"user_id": "alex"})
add()m.add(memory, user_id="alex")client.add(memory, user_id="alex")
delete()m.delete(memory_id)client.delete(memory_id)
delete_all()m.delete_all(user_id="alex")client.delete_all(user_id="alex")
Note: add() and delete() methods remain unchanged. The update() method is not available in Platform - use delete + add pattern instead.
# Basic search with user filter
results = m.search("user's preferences", user_id="alex")

# Search with multiple filters
results = m.search("meeting notes", user_id="alex", agent_id="assistant")
# Get all memories for a user
memories = m.get_all(user_id="alex", top_k=10)

# Get memories with pagination
memories = m.get_all(user_id="alex", top_k=5, offset=10)
# Add a simple memory
m.add("Loves coffee", user_id="alex")

# Add memory with metadata
m.add("Completed marathon", user_id="alex", metadata={"category": "achievement"})
# Delete specific memory
m.delete(memory_id="mem_123")

# Delete all memories for user
m.delete_all(user_id="alex")
# Update memory content
m.update(memory_id="mem_123", new_memory="Updated content")

Platform-Exclusive Features

The Platform introduces powerful capabilities not available in OSS:
Why it matters: Manage multiple teams and projects with hierarchical access control.
# Create an organization
org = client.organizations.create(name="Acme Corp")

# Create projects within the organization
project = client.projects.create(
    name="Customer Support Bot",
    org_id=org.id
)

# Add team members
client.organizations.add_member(
    org_id=org.id,
    email="team@acme.com",
    role="admin"
)
Why it matters: Instantly react to memory changes in your application. Build features like notifications, audit logs, or sync with external systems.
# Create webhook for memory events
webhook = client.webhooks.create(
    project_id="proj_123",
    name="Memory Events",
    url="https://your-app.com/webhooks/mem0",
    events=["memory_add", "memory_delete"]
)

# Webhook payload example:
# {
#   "event": "memory_add",
#   "memory_id": "mem_456",
#   "user_id": "user_789",
#   "memory": "User prefers dark mode",
#   "timestamp": "2024-01-15T10:30:00Z"
# }
Why it matters: Export your data for compliance, analytics, or migration with custom schemas and filters.
# Export memories with custom schema
export_job = client.memories.export(
    filters={
        "AND": [
            {"user_id": "user_123"},
            {"created_at": {"gte": "2024-01-01"}}
        ]
    },
    output_format="json",
    schema={
        "memory": str,
        "categories": list[str],
        "timestamp": str
    }
)

# Download when ready
if client.memories.get_export(export_job.id).status == "completed":
    data = client.memories.download_export(export_job.id)
Why it matters: Use domain-specific categories instead of generic ones for better organization.
# Set custom categories for your project
client.projects.update_categories(
    project_id="proj_123",
    categories=[
        "Customer Preferences",
        "Product Feedback",
        "Support Issues",
        "Feature Requests"
    ]
)

# Memories will use these categories
client.add(
    "User wants dark mode in dashboard",
    user_id="alex",
    categories=["Customer Preferences"]
)
Why it matters: Track all memory operations for audit trails, usage analytics, and debugging.
# Get audit trail of all memory operations
events = client.events.list(
    filters={
        "AND": [
            {"user_id": "alex"},
            {"event_type": "memory_add"},
            {"timestamp": {"gte": "2024-01-01"}}
        ]
    },
    top_k=100
)

# Monitor usage patterns
for event in events:
    print(f"{event.timestamp}: {event.event_type} - {event.memory_id}")

Summary of Changes

FeatureOpen SourcePlatformAction Required
InitializationMemory.from_config(config)MemoryClient(api_key)Replace config object with API key
Search Methodm.search(query, user_id="x")client.search(query, filters={"user_id": "x"})Move filtering params into filters dict
Get All Methodm.get_all(user_id="x")client.get_all(filters={"user_id": "x"})Move filtering params into filters dict
Add Methodm.add(memory, user_id="x")client.add(memory, user_id="x")No change
Delete Methodm.delete(memory_id)client.delete(memory_id)No change
Delete Allm.delete_all(user_id="x")client.delete_all(user_id="x")No change
Update Methodm.update(memory_id, new_memory)Use delete + add patternReplace with delete then add
ConfigLocal vector store + LLM configManaged cloud infrastructureRemove local config setup

Rollback plan

If you encounter issues, you can revert immediately by switching your import back.
  1. Revert Code: Change MemoryClient back to Memory.
  2. Restore Config: Uncomment your local vector store and LLM configuration.
  3. Verify: Ensure your local vector database is still running and accessible.

Next Steps

Platform Features

API Reference