The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
docs(cookbooks): fix v3 filters, response shapes & dead snippet in cookbooks (#5841)
Kartikb44ce4dcc30e
diff --git a/docs/cookbooks/frameworks/llamaindex-multiagent.mdx b/docs/cookbooks/frameworks/llamaindex-multiagent.mdxindex 92ab6d945..fd9f73ff7 100644--- a/docs/cookbooks/frameworks/llamaindex-multiagent.mdx+++ b/docs/cookbooks/frameworks/llamaindex-multiagent.mdx@@ -211,8 +211,8 @@ class MultiAgentLearningSystem:try:# Search memory for learning patternsmemories = self.memory.search(- user_id=self.student_id,- query="learning machine learning"+ query="learning machine learning",+ filters={"user_id": self.student_id})if memories and memories.get('results'):diff --git a/docs/cookbooks/integrations/healthcare-google-adk.mdx b/docs/cookbooks/integrations/healthcare-google-adk.mdxindex a352e506b..528aa3d19 100644--- a/docs/cookbooks/integrations/healthcare-google-adk.mdx+++ b/docs/cookbooks/integrations/healthcare-google-adk.mdx@@ -50,7 +50,7 @@ load_dotenv()USER_ID = "Alex"# Initialize Mem0 client-mem0 = MemoryClient()+mem0_client = MemoryClient()```## Define Memory Tools@@ -76,7 +76,7 @@ def retrieve_patient_info(query: str) -> dict:# Search Mem0results = mem0_client.search(query,- user_id=USER_ID,+ filters={"user_id": USER_ID},top_k=5,threshold=0.7 # Higher threshold for more relevant results)diff --git a/docs/cookbooks/integrations/openai-tool-calls.mdx b/docs/cookbooks/integrations/openai-tool-calls.mdxindex 4e437cda3..1b492d643 100644--- a/docs/cookbooks/integrations/openai-tool-calls.mdx+++ b/docs/cookbooks/integrations/openai-tool-calls.mdx@@ -53,34 +53,12 @@ async function addUserPreferences() {await addUserPreferences();```-```json Output (Memories)- [- {- "id": "ff9f3367-9e83-415d-b9c5-dc8befd9a4b4",- "data": { "memory": "Loves BMW, Audi, and Porsche" },- "event": "ADD"- },- {- "id": "04172ce6-3d7b-45a3-b4a1-ee9798593cb4",- "data": { "memory": "Hates Mercedes" },- "event": "ADD"- },- {- "id": "db363a5d-d258-4953-9e4c-777c120de34d",- "data": { "memory": "Loves red cars and maroon cars" },- "event": "ADD"- },- {- "id": "5519aaad-a2ac-4c0d-81d7-0d55c6ecdba8",- "data": { "memory": "Has a budget of 120K to 150K USD" },- "event": "ADD"- },- {- "id": "523b7693-7344-4563-922f-5db08edc8634",- "data": { "memory": "Likes Audi the most" },- "event": "ADD"- }-]+```json Output+{+ "message": "Memory processing has been queued for background execution",+ "status": "PENDING",+ "event_id": "9f8c2b1a-4e7d-4c3a-9b21-1a2b3c4d5e6f"+}```</CodeGroup>## Retrieving Memories@@ -88,7 +66,7 @@ await addUserPreferences();Search for relevant memories based on the current user input:```javascript-const relevantMemories = await mem0Client.search(userInput, { userId: USER_ID });+const relevantMemories = await mem0Client.search(userInput, { filters: { user_id: USER_ID } });```## Structured Responses with Zod@@ -194,7 +172,7 @@ async function main(memory = false) {// Search for relevant memorieslet relevantMemories = []if (memory) {- relevantMemories = await mem0Client.search(input, { userId: USER_ID });+ relevantMemories = await mem0Client.search(input, { filters: { user_id: USER_ID } });}const response = await openAIClient.responses.create({diff --git a/docs/cookbooks/integrations/tavily-search.mdx b/docs/cookbooks/integrations/tavily-search.mdxindex b0b861add..4bfc9200d 100644--- a/docs/cookbooks/integrations/tavily-search.mdx+++ b/docs/cookbooks/integrations/tavily-search.mdx@@ -4,8 +4,6 @@ description: "Blend Tavily's realtime results with personal context stored in Me----<Snippet file="security-compliance.mdx" />-Imagine asking a search assistant for "coffee shops nearby" and instead of generic results, it shows remote-work-friendly cafes with great WiFi in your city because it remembers you mentioned working remotely before. Or when you search for "lunchbox ideas for kids" it knows you have a 7-year-old daughter and recommends peanut-free options that align with her allergy.That's what we are going to build today, a Personalized Search Assistant powered by Mem0 for memory and [Tavily](https://tavily.com) for real-time search.diff --git a/docs/cookbooks/operations/content-writing.mdx b/docs/cookbooks/operations/content-writing.mdxindex 741cc77ca..fde7a24cb 100644--- a/docs/cookbooks/operations/content-writing.mdx+++ b/docs/cookbooks/operations/content-writing.mdx@@ -217,8 +217,7 @@ def apply_writing_style(original_content):results = memory.search(query="What are my writing style preferences?",- user_id=USER_ID,- run_id=RUN_ID,+ filters={"user_id": USER_ID, "run_id": RUN_ID},)if not results:diff --git a/docs/cookbooks/operations/email-automation.mdx b/docs/cookbooks/operations/email-automation.mdxindex 849ebb59f..69fa854ad 100644--- a/docs/cookbooks/operations/email-automation.mdx+++ b/docs/cookbooks/operations/email-automation.mdx@@ -314,18 +314,16 @@ class EmailProcessor:user_id (str): User identifiersender (str, optional): Filter by sender email address"""- # In OSS, user_id is an explicit parameter (not inside filters)if not sender:results = self.memory.search(query=query,- user_id=user_id,- filters={"memory_category": "email"},+ filters={"user_id": user_id, "memory_category": "email"},)else:results = self.memory.search(query=query,- user_id=user_id,filters={+ "user_id": user_id,"AND": [{"memory_category": "email"},{"sender": sender},@@ -343,10 +341,9 @@ class EmailProcessor:subject (str): Email subject to matchuser_id (str): User identifier"""- # In OSS, user_id is an explicit parameterthread = self.memory.get_all(- user_id=user_id,filters={+ "user_id": user_id,"AND": [{"memory_category": "email"},{"subject": {"icontains": subject}},diff --git a/docs/cookbooks/operations/support-inbox.mdx b/docs/cookbooks/operations/support-inbox.mdxindex 549848046..08db89f22 100644--- a/docs/cookbooks/operations/support-inbox.mdx+++ b/docs/cookbooks/operations/support-inbox.mdx@@ -57,7 +57,7 @@ class CustomerSupportAIAgent:"""# Start a streaming chat completion request to the AIstream = self.client.chat.completions.create(- model="gpt-4",+ model="gpt-5-mini",stream=True,messages=[{"role": "system", "content": "You are a customer support AI agent."},