repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: "Migrate from Open Source to Platform" |
| #3 | description: "Migrate your Mem0 Open Source implementation to Mem0 Platform for managed infrastructure and advanced features." |
| #4 | icon: "cloud-arrow-up" |
| #5 | versionFrom: "Open Source" |
| #6 | versionTo: "Platform" |
| #7 | --- |
| #8 | |
| #9 | # Migrate from Open Source to Platform |
| #10 | |
| #11 | Move your Mem0 implementation to managed infrastructure with enterprise features. |
| #12 | |
| #13 | | Scope | Effort | Downtime | |
| #14 | | --------------------- | -------------- | ---------------------------- | |
| #15 | | Infrastructure & Code | Low (~30 mins) | None (Parallel run possible) | |
| #16 | |
| #17 | <Info> |
| #18 | **Why migrate to Platform?** |
| #19 | |
| #20 | - **Time to Market**: Set up in 5 minutes vs 30+ minutes for OSS configuration |
| #21 | - **Enterprise Ready**: SOC2 Type II compliance, GDPR support, audit logs |
| #22 | - **Advanced Features**: Webhooks, memory export, analytics dashboard, custom categories |
| #23 | - **Multi-tenancy**: Organizations, projects, and team management out of the box |
| #24 | - **Zero Infrastructure**: No vector database, LLM provider, or maintenance overhead |
| #25 | - **Enhanced Search**: Reranking, keyword expansion, and advanced filters |
| #26 | - **Production Grade**: Auto-scaling, high availability, dedicated support |
| #27 | </Info> |
| #28 | |
| #29 | ## Plan |
| #30 | |
| #31 | 1. **Sign up**: Create an account on [Mem0 Platform](https://app.mem0.ai). |
| #32 | 2. **Get API Key**: Navigate to **Settings > API Keys** and generate a new key. |
| #33 | 3. **Review Usage**: Identify where you instantiate `Memory` and where you call `search` or `get_all`. |
| #34 | |
| #35 | ## Migrate |
| #36 | |
| #37 | ### 1. Install or Update SDK |
| #38 | |
| #39 | Ensure you have the latest version of the SDK, which supports both OSS and Platform clients. |
| #40 | |
| #41 | ```bash |
| #42 | pip install mem0ai --upgrade |
| #43 | ``` |
| #44 | |
| #45 | ### 2. Update Initialization |
| #46 | |
| #47 | Switch from the local `Memory` class to the managed `MemoryClient`. |
| #48 | |
| #49 | ```python Open Source (Old) |
| #50 | from mem0 import Memory |
| #51 | |
| #52 | config = { |
| #53 | "vector_store": { |
| #54 | "provider": "qdrant", |
| #55 | "config": {"host": "localhost", "port": 6333} |
| #56 | }, |
| #57 | "llm": { |
| #58 | "provider": "openai", |
| #59 | "config": {"model": "gpt-4"} |
| #60 | } |
| #61 | } |
| #62 | |
| #63 | m = Memory.from_config(config) |
| #64 | ``` |
| #65 | |
| #66 | ```python Platform (New) |
| #67 | from mem0 import MemoryClient |
| #68 | import os |
| #69 | |
| #70 | # Set MEM0_API_KEY in environment or pass explicitly |
| #71 | client = MemoryClient(api_key="m0-...") |
| #72 | ``` |
| #73 | |
| #74 | <Info icon="check"> |
| #75 | Run `client.get_all(filters={"user_id": "test_connection"})` to verify your API key works. It should return an empty list or valid results. |
| #76 | </Info> |
| #77 | |
| #78 | ### 3. Update Retrieval Calls (Critical) |
| #79 | |
| #80 | <Warning> |
| #81 | **Critical Change**: Platform uses v2 endpoints that require filtering parameters to be nested inside a `filters` dictionary. |
| #82 | </Warning> |
| #83 | |
| #84 | | Method | Open Source | Platform | |
| #85 | | ------ | ----------- | -------- | |
| #86 | | `search()` | `m.search(query, user_id="alex")` | `client.search(query, filters={"user_id": "alex"})` | |
| #87 | | `get_all()` | `m.get_all(user_id="alex")` | `client.get_all(filters={"user_id": "alex"})` | |
| #88 | | `add()` | `m.add(memory, user_id="alex")` | `client.add(memory, user_id="alex")` | |
| #89 | | `delete()` | `m.delete(memory_id)` | `client.delete(memory_id)` | |
| #90 | | `delete_all()` | `m.delete_all(user_id="alex")` | `client.delete_all(user_id="alex")` | |
| #91 | |
| #92 | Note: `add()` and `delete()` methods remain unchanged. The `update()` method is not available in Platform - use delete + add pattern instead. |
| #93 | |
| #94 | <AccordionGroup> |
| #95 | <Accordion title="Search Memories"> |
| #96 | <CodeGroup> |
| #97 | ```python Open Source (Old) |
| #98 | # Basic search with user filter |
| #99 | results = m.search("user's preferences", user_id="alex") |
| #100 | |
| #101 | # Search with multiple filters |
| #102 | results = m.search("meeting notes", user_id="alex", agent_id="assistant") |
| #103 | ``` |
| #104 | |
| #105 | ```python Platform (New) |
| #106 | # Basic search with user filter in filters dict |
| #107 | results = client.search("user's preferences", filters={"user_id": "alex"}) |
| #108 | |
| #109 | # Search with multiple filters |
| #110 | results = client.search("meeting notes", filters={ |
| #111 | "AND": [ |
| #112 | {"user_id": "alex"}, |
| #113 | {"agent_id": "assistant"} |
| #114 | ] |
| #115 | }) |
| #116 | ``` |
| #117 | </CodeGroup> |
| #118 | </Accordion> |
| #119 | |
| #120 | <Accordion title="Get All Memories"> |
| #121 | <CodeGroup> |
| #122 | ```python Open Source (Old) |
| #123 | # Get all memories for a user |
| #124 | memories = m.get_all(user_id="alex", limit=10) |
| #125 | |
| #126 | # Get memories with pagination |
| #127 | memories = m.get_all(user_id="alex", limit=5, offset=10) |
| #128 | ``` |
| #129 | |
| #130 | ```python Platform (New) |
| #131 | # Get all memories for a user |
| #132 | memories = client.get_all(filters={"user_id": "alex"}, limit=10) |
| #133 | |
| #134 | # Get memories with pagination |
| #135 | memories = client.get_all(filters={"user_id": "alex"}, limit=5, offset=10) |
| #136 | ``` |
| #137 | </CodeGroup> |
| #138 | </Accordion> |
| #139 | |
| #140 | <Accordion title="Add Memories"> |
| #141 | <CodeGroup> |
| #142 | ```python Open Source (Old) |
| #143 | # Add a simple memory |
| #144 | m.add("Loves coffee", user_id="alex") |
| #145 | |
| #146 | # Add memory with metadata |
| #147 | m.add("Completed marathon", user_id="alex", metadata={"category": "achievement"}) |
| #148 | ``` |
| #149 | |
| #150 | ```python Platform (New) |
| #151 | # Add a simple memory (no change) |
| #152 | client.add("Loves coffee", user_id="alex") |
| #153 | |
| #154 | # Add memory with metadata (no change) |
| #155 | client.add("Completed marathon", user_id="alex", metadata={"category": "achievement"}) |
| #156 | ``` |
| #157 | </CodeGroup> |
| #158 | </Accordion> |
| #159 | |
| #160 | <Accordion title="Delete Memories"> |
| #161 | <CodeGroup> |
| #162 | ```python Open Source (Old) |
| #163 | # Delete specific memory |
| #164 | m.delete(memory_id="mem_123") |
| #165 | |
| #166 | # Delete all memories for user |
| #167 | m.delete_all(user_id="alex") |
| #168 | ``` |
| #169 | |
| #170 | ```python Platform (New) |
| #171 | # Delete specific memory (no change) |
| #172 | client.delete(memory_id="mem_123") |
| #173 | |
| #174 | # Delete all memories for user (no change) |
| #175 | client.delete_all(user_id="alex") |
| #176 | ``` |
| #177 | </CodeGroup> |
| #178 | </Accordion> |
| #179 | |
| #180 | <Accordion title="Update Memory"> |
| #181 | <CodeGroup> |
| #182 | ```python Open Source (Old) |
| #183 | # Update memory content |
| #184 | m.update(memory_id="mem_123", new_memory="Updated content") |
| #185 | ``` |
| #186 | |
| #187 | ```python Platform (New) |
| #188 | # Update memory (not available in Platform) |
| #189 | # Use delete + add pattern instead |
| #190 | client.delete(memory_id="mem_123") |
| #191 | client.add("Updated content", user_id="alex") |
| #192 | ``` |
| #193 | </CodeGroup> |
| #194 | </Accordion> |
| #195 | </AccordionGroup> |
| #196 | |
| #197 | ## Platform-Exclusive Features |
| #198 | |
| #199 | The Platform introduces powerful capabilities not available in OSS: |
| #200 | |
| #201 | <AccordionGroup> |
| #202 | <Accordion title="Organizations & Multi-tenancy"> |
| #203 | <Info> |
| #204 | **Why it matters**: Manage multiple teams and projects with hierarchical access control. |
| #205 | </Info> |
| #206 | ```python |
| #207 | # Create an organization |
| #208 | org = client.organizations.create(name="Acme Corp") |
| #209 | |
| #210 | # Create projects within the organization |
| #211 | project = client.projects.create( |
| #212 | name="Customer Support Bot", |
| #213 | org_id=org.id |
| #214 | ) |
| #215 | |
| #216 | # Add team members |
| #217 | client.organizations.add_member( |
| #218 | org_id=org.id, |
| #219 | email="team@acme.com", |
| #220 | role="admin" |
| #221 | ) |
| #222 | ``` |
| #223 | </Accordion> |
| #224 | |
| #225 | <Accordion title="Webhooks for Real-time Events"> |
| #226 | <Info> |
| #227 | **Why it matters**: Instantly react to memory changes in your application. Build features like notifications, audit logs, or sync with external systems. |
| #228 | </Info> |
| #229 | ```python |
| #230 | # Create webhook for memory events |
| #231 | webhook = client.webhooks.create( |
| #232 | project_id="proj_123", |
| #233 | name="Memory Events", |
| #234 | url="https://your-app.com/webhooks/mem0", |
| #235 | events=["memory_add", "memory_delete"] |
| #236 | ) |
| #237 | |
| #238 | # Webhook payload example: |
| #239 | # { |
| #240 | # "event": "memory_add", |
| #241 | # "memory_id": "mem_456", |
| #242 | # "user_id": "user_789", |
| #243 | # "memory": "User prefers dark mode", |
| #244 | # "timestamp": "2024-01-15T10:30:00Z" |
| #245 | # } |
| #246 | ``` |
| #247 | </Accordion> |
| #248 | |
| #249 | <Accordion title="Memory Export"> |
| #250 | <Info> |
| #251 | **Why it matters**: Export your data for compliance, analytics, or migration with custom schemas and filters. |
| #252 | </Info> |
| #253 | ```python |
| #254 | # Export memories with custom schema |
| #255 | export_job = client.memories.export( |
| #256 | filters={ |
| #257 | "AND": [ |
| #258 | {"user_id": "user_123"}, |
| #259 | {"created_at": {"gte": "2024-01-01"}} |
| #260 | ] |
| #261 | }, |
| #262 | output_format="json", |
| #263 | schema={ |
| #264 | "memory": str, |
| #265 | "categories": list[str], |
| #266 | "timestamp": str |
| #267 | } |
| #268 | ) |
| #269 | |
| #270 | # Download when ready |
| #271 | if client.memories.get_export(export_job.id).status == "completed": |
| #272 | data = client.memories.download_export(export_job.id) |
| #273 | ``` |
| #274 | </Accordion> |
| #275 | |
| #276 | <Accordion title="Enhanced Search"> |
| #277 | <Info> |
| #278 | **Why it matters**: Get better search results with AI-powered reranking and keyword expansion. |
| #279 | </Info> |
| #280 | ```python |
| #281 | # Search with reranking for better results |
| #282 | results = client.search( |
| #283 | "user preferences", |
| #284 | filters={"user_id": "alex"}, |
| #285 | rerank=True, # Platform exclusive |
| #286 | limit=5 |
| #287 | ) |
| #288 | |
| #289 | # Search with keyword expansion |
| #290 | results = client.search( |
| #291 | "coffee order", |
| #292 | filters={"user_id": "alex"}, |
| #293 | keywords=["latte", "espresso", "cappuccino"], |
| #294 | expand_keywords=True |
| #295 | ) |
| #296 | ``` |
| #297 | </Accordion> |
| #298 | |
| #299 | <Accordion title="Custom Categories"> |
| #300 | <Info> |
| #301 | **Why it matters**: Use domain-specific categories instead of generic ones for better organization. |
| #302 | </Info> |
| #303 | ```python |
| #304 | # Set custom categories for your project |
| #305 | client.projects.update_categories( |
| #306 | project_id="proj_123", |
| #307 | categories=[ |
| #308 | "Customer Preferences", |
| #309 | "Product Feedback", |
| #310 | "Support Issues", |
| #311 | "Feature Requests" |
| #312 | ] |
| #313 | ) |
| #314 | |
| #315 | # Memories will use these categories |
| #316 | client.add( |
| #317 | "User wants dark mode in dashboard", |
| #318 | user_id="alex", |
| #319 | categories=["Customer Preferences"] |
| #320 | ) |
| #321 | ``` |
| #322 | </Accordion> |
| #323 | |
| #324 | <Accordion title="Events API for Analytics"> |
| #325 | <Info> |
| #326 | **Why it matters**: Track all memory operations for audit trails, usage analytics, and debugging. |
| #327 | </Info> |
| #328 | ```python |
| #329 | # Get audit trail of all memory operations |
| #330 | events = client.events.list( |
| #331 | filters={ |
| #332 | "AND": [ |
| #333 | {"user_id": "alex"}, |
| #334 | {"event_type": "memory_add"}, |
| #335 | {"timestamp": {"gte": "2024-01-01"}} |
| #336 | ] |
| #337 | }, |
| #338 | limit=100 |
| #339 | ) |
| #340 | |
| #341 | # Monitor usage patterns |
| #342 | for event in events: |
| #343 | print(f"{event.timestamp}: {event.event_type} - {event.memory_id}") |
| #344 | ``` |
| #345 | </Accordion> |
| #346 | </AccordionGroup> |
| #347 | |
| #348 | ## Summary of Changes |
| #349 | |
| #350 | | Feature | Open Source | Platform | Action Required | |
| #351 | | ------- | ----------- | -------- | --------------- | |
| #352 | | **Initialization** | `Memory.from_config(config)` | `MemoryClient(api_key)` | Replace config object with API key | |
| #353 | | **Search Method** | `m.search(query, user_id="x")` | `client.search(query, filters={"user_id": "x"})` | Move filtering params into `filters` dict | |
| #354 | | **Get All Method** | `m.get_all(user_id="x")` | `client.get_all(filters={"user_id": "x"})` | Move filtering params into `filters` dict | |
| #355 | | **Add Method** | `m.add(memory, user_id="x")` | `client.add(memory, user_id="x")` | No change | |
| #356 | | **Delete Method** | `m.delete(memory_id)` | `client.delete(memory_id)` | No change | |
| #357 | | **Delete All** | `m.delete_all(user_id="x")` | `client.delete_all(user_id="x")` | No change | |
| #358 | | **Update Method** | `m.update(memory_id, new_memory)` | Use delete + add pattern | Replace with delete then add | |
| #359 | | **Config** | Local vector store + LLM config | Managed cloud infrastructure | Remove local config setup | |
| #360 | |
| #361 | ## Rollback plan |
| #362 | |
| #363 | If you encounter issues, you can revert immediately by switching your import back. |
| #364 | |
| #365 | 1. **Revert Code**: Change `MemoryClient` back to `Memory`. |
| #366 | 2. **Restore Config**: Uncomment your local vector store and LLM configuration. |
| #367 | 3. **Verify**: Ensure your local vector database is still running and accessible. |
| #368 | |
| #369 | ## Next Steps |
| #370 | |
| #371 | - [Platform Dashboard](https://app.mem0.ai) - Monitor usage and manage settings. |
| #372 | - [Webhooks Setup](/platform/features/webhooks) - Configure real-time event notifications. |
| #373 | - [Organizations & Projects](/platform/features/organizations-projects) - Set up multi-tenancy for your team. |
| #374 | |
| #375 | <CardGroup cols={2}> |
| #376 | <Card |
| #377 | title="Platform Features" |
| #378 | description="Explore capabilities exclusive to the Platform." |
| #379 | icon="sparkles" |
| #380 | href="/platform/overview" |
| #381 | /> |
| #382 | <Card |
| #383 | title="API Reference" |
| #384 | description="Deep dive into the Platform API endpoints." |
| #385 | icon="code" |
| #386 | href="/api-reference/memory/add-memories" |
| #387 | /> |
| #388 | </CardGroup> |
| #389 |