Skip to main content
Important ChangeThe async_mode parameter defaults to true for all memory additions, changing the default API behavior to asynchronous processing.

Overview

The Memory Addition API processes all memory additions asynchronously by default. This change improves performance and scalability by queuing memory operations in the background, allowing your application to continue without waiting for memory processing to complete.

What’s Changing

The parameter async_mode will default to true instead of false. This means memory additions will be processed asynchronously by default - queued for background execution instead of waiting for processing to complete.

Behavior Comparison

Old Default Behavior (async_mode = false)

When async_mode was set to false, the API returned fully processed memory objects immediately:
{
  "results": [
    {
      "id": "de0ee948-af6a-436c-835c-efb6705207de",
      "event": "ADD",
      "memory": "User Order #1234 was for a 'Nova 2000'",
      "structured_attributes": {
        "day": 13,
        "hour": 16,
        "year": 2025,
        "month": 10,
        "minute": 59,
        "quarter": 4,
        "is_weekend": false,
        "day_of_week": "monday",
        "day_of_year": 286,
        "week_of_year": 42
      }
    }
  ]
}

New Default Behavior (async_mode = true)

With async_mode defaulting to true, memory processing is queued in the background and the API returns immediately:
{
  "results": [
    {
      "message": "Memory processing has been queued for background execution",
      "status": "PENDING",
      "event_id": "d7b5282a-0031-4cc2-98ba-5a02d8531e17"
    }
  ]
}

Migration Guide

If You Need Synchronous Processing

If your integration relies on receiving the processed memory object immediately, you can explicitly set async_mode to false in your requests:
from mem0 import MemoryClient

client = MemoryClient(api_key="your-api-key")

# Explicitly set async_mode=False to preserve synchronous behavior
messages = [
    {"role": "user", "content": "I ordered a Nova 2000"}
]

result = client.add(
    messages,
    user_id="user-123",
    async_mode=False  # This ensures synchronous processing
)

If You Want to Adopt Asynchronous Processing

If you want to benefit from the improved performance of asynchronous processing:
  1. Remove any explicit async_mode=False parameters from your code
  2. Use webhooks to receive notifications when memory processing completes
Learn more about Webhooks for real-time notifications about memory events.

Benefits of Asynchronous Processing

Switching to asynchronous processing provides several advantages:
  • Faster API Response Times: Your application doesn’t wait for memory processing
  • Better Scalability: Handle more memory additions concurrently
  • Improved User Experience: Reduced latency in your application
  • Resource Efficiency: Background processing optimizes server resources

Important Notes

  • The default behavior is now async_mode=true for asynchronous processing
  • Explicitly set async_mode=false if you need synchronous behavior
  • Use webhooks to receive notifications when memories are processed

Monitoring Memory Processing

When using asynchronous mode, use webhooks to receive notifications about memory events:

Configure Webhooks

Learn how to set up webhooks for memory processing events
You can also retrieve all processed memories at any time:
# Retrieve all memories for a user
memories = client.get_all(user_id="user-123")

Need Help?

If you have questions about this change or need assistance updating your integration:
I