Skip to main content
Integrate Mem0 with OpenAI Agents SDK, a lightweight framework for building multi-agent workflows. This integration enables agents to access persistent memory across conversations, enhancing context retention and personalization.

Overview

  1. Store and retrieve memories from Mem0 within OpenAI agents
  2. Multi-agent workflows with shared memory
  3. Retrieve relevant memories for past conversations
  4. Personalized responses based on user history

Prerequisites

Before setting up Mem0 with OpenAI Agents SDK, ensure you have:
  1. Installed the required packages:
  1. Valid API keys:

Basic Integration Example

The following example demonstrates how to create an OpenAI agent with Mem0 memory integration:

Multi-Agent Workflow with Handoffs

Create multiple specialized agents with proper handoffs and shared memory:

Quick Start Chat Interface

Simple interactive chat with memory:

Key Features

1. Automatic Memory Integration

  • Tool-Based Memory: Agents use function tools to search and save memories
  • Conversation Storage: All interactions are automatically stored
  • Context Retrieval: Agents can access relevant past conversations

2. Multi-Agent Memory Sharing

  • Shared Context: Multiple agents access the same memory store
  • Specialized Agents: Create domain-specific agents with shared memory
  • Seamless Handoffs: Agents maintain context across handoffs

3. Flexible Memory Operations

  • Retrieve Capabilities: Retrieve relevant memories from previous conversations
  • User Segmentation: Organize memories by user ID
  • Memory Management: Built-in tools for saving and retrieving information

Configuration Options

Customize memory behavior:

OpenAI Tool Calls Cookbook

Learn how to integrate Mem0 with OpenAI function calling

Agents SDK Tool Cookbook

Build agents with OpenAI SDK tools
Enjoying Mem0? Star us on GitHub — it takes two seconds and helps more developers discover open-source memory.