AgentsOpen SourceFreeActiveMachine-verified· beginner · ~10 min setup

Mem0: A Personalization Layer Your Assistant Remembers With

Add user, session, and agent-level memory to an assistant so it remembers preferences across conversations.

by Shilpa Mitra· verified today· v1.0.0

Run this workflow

CI-verified, 2/2 fixtures passing.

Build this with your agent

One copy-paste hands Claude Code, Codex, or Cursor the full recipe, steps included, nothing to fetch.

Intended Use

Adding cross-conversation memory to a chatbot or assistant: Mem0 extracts facts from a chat and retrieves the relevant ones next turn. CI installs the SDK and verifies the Memory class imports cleanly. Extraction and retrieval (add/search) run an LLM plus an embedder, OpenAI by default, so they're fenced and need your key.

Not for

  • Fully offline use, Mem0's default extract/retrieve path calls a hosted model
  • Expecting CI to verify add() and search(), those are the model-driven steps

The Stack

Tested Against

mem0ai@latestpython@3.12

Side effects & data flow

Network
PyPI, install only (model calls only in the fenced step)
Writes
./.venv/
Credentials
LLM API key, for the fenced add/search steps only

Prerequisites

  • Python 3.10+
  • pip
  • An LLM API key for the add/search steps (OpenAI by default)

Steps

  1. 1

    Install the SDK and verify it imports

    pip install mem0ai, then confirm the Memory class is importable. That's the deterministic spine: the dependency tree resolves and the SDK loads. CI runs exactly this, no key.

    python3 -m venv .venv
    .venv/bin/pip install -q mem0ai
    .venv/bin/python - <<'EOF'
    from mem0 import Memory
    
    assert callable(Memory), "Memory is not a class/callable"
    print("mem0 imports OK: Memory class available")
    EOF
  2. 2

    Add and search memories (the model step, not checked by CI)

    memory.add("Prefers vim keybindings and dark mode", user_id="alice") then memory.search(query=..., filters=...). Both extract/retrieve with an LLM and an embedder (OpenAI by default), so set your key first; CI never claims this part.

Eval, 2 fixtures

Last passed: verified today
  • importscontainstimeout 900s · max $0

    Expected: mem0 imports OK: Memory class available

  • clean-exitexit_codetimeout 900s · max $0

    Expected: 0

Results

YC-backed, one of the most popular open-source memory repos.

Did this work for you?

Our CI checks the setup runs. You tell us if the whole thing worked. Tell us straight.

Liked this workflow?

Get new verified workflows in WebAfterAI, three issues a week (Tue, Thu, Sat).