Mem0

Universal memory layer that gives AI agents and assistants long-term, personalized recall

Library
PyPI
v2.0.18
63,561stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
92/100Excellent
Development Activity100
Maintenance100
Community76
Maturity52
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture85
Code Quality82
Innovation88
Learning Curve80

Mem0 (“mem-zero”) is an open-source memory layer for AI agents and assistants. It extracts, stores, and retrieves salient facts about users, sessions, and agents so that LLM applications can remember preferences and context across conversations instead of starting from scratch every turn.

It plugs into your existing LLM and vector-store stack through a simple add/search API, supports multi-level memory (user, session, agent), and offers both a self-hosted open-source SDK and an optional fully managed platform.

What You Get

  • A simple add/search/get_all memory API for storing and retrieving facts
  • Multi-level memory across user, session, and agent scopes
  • Pluggable LLM, embedding, and vector-store backends (OpenAI, Qdrant, Chroma, Pinecone, and many more)
  • Both a self-hosted open-source SDK and an optional managed hosted platform
  • Async and sync clients plus a REST server for language-agnostic access

Common Use Cases

  • Personalizing customer-support and assistant chatbots with remembered preferences
  • Giving autonomous agents durable long-term memory of past actions and facts
  • Reducing prompt token costs by retrieving only relevant context instead of full history
  • Building AI companions that adapt to individual users over time

Under The Hood

Architecture - Mem0 centers on a Memory class (mem0/memory/) that orchestrates an LLM for fact extraction, an embedding model, and a vector store for retrieval, with a parallel hosted MemoryClient (mem0/client/main.py) that talks to the managed REST API. The add pipeline extracts salient facts from a message via the LLM, embeds them, and upserts them into the configured vector store; search embeds the query and fuses semantic, keyword, and entity signals to return only relevant memories.

Tech Stack - Written in Python (>=3.10) and built with hatchling. Core dependencies include pydantic, openai, httpx, qdrant-client, sqlalchemy, and posthog, with a large matrix of optional extras for alternative vector stores (Chroma, Pinecone, Weaviate, Milvus, pgvector) and LLM providers (Groq, Together, LiteLLM).

Code Quality - The codebase is modular, splitting llms, embeddings, vector_stores, configs, and memory into clear provider-abstraction packages, and ships a substantial test suite (~98 test modules under tests/) covering client, memory, LLM, and vector-store behavior. Configuration is driven through pydantic models, giving type-checked, swappable backends.

API Design - The public surface is deliberately small and ergonomic: add, search, get_all, update, and delete, mirrored across sync and async clients, so getting started requires only a few lines. Provider selection is config-driven rather than code-heavy, keeping application code stable as backends change.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search