Skip to main content

Long-term memory for AI Agents

Project description

Mem0 - The Memory Layer for Personalized AI

mem0ai%2Fmem0 | Trendshift Launch YC: Mem0 - Open Source Memory Layer for AI Apps

Learn more · Join Discord · Demo

Mem0 Discord Mem0 PyPI - Downloads GitHub commit activity Package version Npm package Y Combinator S24

Introduction

Mem0 (pronounced as "mem-zero") enhances AI assistants and agents with an intelligent memory layer, enabling personalized AI interactions. Mem0 remembers user preferences, adapts to individual needs, and continuously improves over time, making it ideal for customer support chatbots, AI assistants, and autonomous systems.

Features & Use Cases

Core Capabilities:

  • Multi-Level Memory: User, Session, and AI Agent memory retention with adaptive personalization
  • Developer-Friendly: Simple API integration, cross-platform consistency, and hassle-free managed service

Applications:

  • AI Assistants: Seamless conversations with context and personalization
  • Learning & Support: Tailored content recommendations and context-aware customer assistance
  • Healthcare & Companions: Patient history tracking and deeper relationship building
  • Productivity & Gaming: Streamlined workflows and adaptive environments based on user behavior

Get Started

Get started quickly with Mem0 Platform - our fully managed solution that provides automatic updates, advanced analytics, enterprise security, and dedicated support. Create a free account to begin.

For complete control, you can self-host Mem0 using our open-source package. See the Quickstart guide below to set up your own instance.

Quickstart Guide

Install the Mem0 package via pip:

pip install mem0ai

Install the Mem0 package via npm:

npm install mem0ai

Basic Usage

Mem0 requires an LLM to function, with gpt-4o-mini from OpenAI as the default. However, it supports a variety of LLMs; for details, refer to our Supported LLMs documentation.

First step is to instantiate the memory:

from openai import OpenAI
from mem0 import Memory

openai_client = OpenAI()
memory = Memory()

def chat_with_memories(message: str, user_id: str = "default_user") -> str:
    # Retrieve relevant memories
    relevant_memories = memory.search(query=message, user_id=user_id, limit=3)
    memories_str = "\n".join(f"- {entry['memory']}" for entry in relevant_memories["results"])
    
    # Generate Assistant response
    system_prompt = f"You are a helpful AI. Answer the question based on query and memories.\nUser Memories:\n{memories_str}"
    messages = [{"role": "system", "content": system_prompt}, {"role": "user", "content": message}]
    response = openai_client.chat.completions.create(model="gpt-4o-mini", messages=messages)
    assistant_response = response.choices[0].message.content

    # Create new memories from the conversation
    messages.append({"role": "assistant", "content": assistant_response})
    memory.add(messages, user_id=user_id)

    return assistant_response

def main():
    print("Chat with AI (type 'exit' to quit)")
    while True:
        user_input = input("You: ").strip()
        if user_input.lower() == 'exit':
            print("Goodbye!")
            break
        print(f"AI: {chat_with_memories(user_input)}")

if __name__ == "__main__":
    main()

See the example for Node.js.

For more advanced usage and API documentation, visit our documentation.

[!TIP] For a hassle-free experience, try our hosted platform with automatic updates and enterprise features.

Demos

  • Mem0 - ChatGPT with Memory: A personalized AI chat app powered by Mem0 that remembers your preferences, facts, and memories.

Mem0 - ChatGPT with Memory

Try live demo



  • AI Companion: Experience personalized conversations with an AI that remembers your preferences and past interactions

AI Companion Demo



  • Enhance your AI interactions by storing memories across ChatGPT, Perplexity, and Claude using our browser extension. Get chrome extension.

Chrome Extension Demo



  • Customer support bot using Langgraph and Mem0. Get the complete code from here

Langgraph: Customer Bot



  • Use Mem0 with CrewAI to get personalized results. Full example here

CrewAI Demo

Documentation

For detailed usage instructions and API reference, visit our documentation. You'll find:

  • Complete API reference
  • Integration guides
  • Advanced configuration options
  • Best practices and examples
  • More details about:

Support

Join our community for support and discussions. If you have any questions, feel free to reach out to us using one of the following methods:

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ola_mem0ai-0.1.94.tar.gz (92.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ola_mem0ai-0.1.94-py3-none-any.whl (142.4 kB view details)

Uploaded Python 3

File details

Details for the file ola_mem0ai-0.1.94.tar.gz.

File metadata

  • Download URL: ola_mem0ai-0.1.94.tar.gz
  • Upload date:
  • Size: 92.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.10

File hashes

Hashes for ola_mem0ai-0.1.94.tar.gz
Algorithm Hash digest
SHA256 f35233603f6bea6baa05490839c467d80a14d4a65486731ee6abb32ffe0c8913
MD5 f73de21d36cbabc0a359aada07f414e7
BLAKE2b-256 be9a7f8fbd49be3bd0391cf43c4c5cc7aa82282856c97af1bd4aeb469e3ffad6

See more details on using hashes here.

File details

Details for the file ola_mem0ai-0.1.94-py3-none-any.whl.

File metadata

  • Download URL: ola_mem0ai-0.1.94-py3-none-any.whl
  • Upload date:
  • Size: 142.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.10

File hashes

Hashes for ola_mem0ai-0.1.94-py3-none-any.whl
Algorithm Hash digest
SHA256 0e35e4772f2fb75f0124a6824d0cbd5cbf4bd5e793ca028d5707c6842f88ff03
MD5 a198ddb32150d72c5cdc185b683e702f
BLAKE2b-256 4440a25158da1b50ac141f3f6d45769b58bd1791c4f6477c4ca38e5c660af1ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page