Memori Documentation

Memori is agent-native memory infrastructure. A LLM-agnostic layer that turns agent execution and conversation into structured, persistent state for...

17,147 stars Python Python 108 files ยท ~120,107 tokens #agent#agent-memory#agenticai#ai#ai-memory#claude-code#enterprise#hermes
RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy Memori on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name memori -p 5432:5432 --restart always postgres:16
Configured Services & Ports
โš™๏ธ dev
image: build locally
โš™๏ธ postgres
image: postgres:16
๐Ÿ”Œ Ports: 5432:5432
โš™๏ธ mongodb
image: mongo:7.0
๐Ÿ”Œ Ports: 27017:27017
โš™๏ธ mongo-express
image: mongo-express:1.0.0
๐Ÿ”Œ Ports: 8081:8081
โš™๏ธ mysql
image: mysql:8
๐Ÿ”Œ Ports: 3307:3306
โš™๏ธ oceanbase
image: quay.io/oceanbase/seekdb:latest
๐Ÿ”Œ Ports: 2882:2881
โš™๏ธ oracle
image: container-registry.oracle.com/database/free:latest-lite
๐Ÿ”Œ Ports: 1521:1521
docker-compose.yml
yaml (docker-compose.yml)
services:
  dev:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/app
      - /app/.venv
      - /app/__pycache__
      - ./google-credentials.json:/app/google-credentials.json:ro
    working_dir: /app
    stdin_open: true
    tty: true
    env_file:
      - .env
    environment:
      - PYTHONUNBUFFERED=1
      - DATABASE_URL=postgresql://memori:memori@postgres:5432/memori_test
      - MONGODB_URL=mongodb://memori:memori@mongodb:27017/memori_test?authSource=admin
      - MYSQL_DATABASE_URL=mysql+pymysql://memori:memori@mysql:3306/memori_test
      - OCEANBASE_DATABASE_URL=mysql+oceanbase://root:@oceanbase:2881/memori_test?charset=utf8mb4
      - ORACLE_DATABASE_URL=oracle+oracledb://system:memori@oracle:1521/?service_name=FREEPDB1
      - GOOGLE_APPLICATION_CREDENTIALS=/app/google-credentials.json
    command: /bin/bash
    depends_on:
      postgres:
        condition: service_healthy
      mongodb:
        condition: service_healthy
      mysql:
        condition: service_healthy
      oceanbase:
        condition: service_started
      oracle:
        condition: service_healthy
    networks:
      - memori-network

  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: memori
      POSTGRES_PASSWORD: memori
      POSTGRES_DB: memori_test
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U memori"]
      interval: 5s
      timeout: 5s
      retries: 5
    networks:
      - memori-network

  mongodb:
    image: mongo:7.0
    environment:
      MONGO_INITDB_ROOT_USERNAME: memori
      MONGO_INITDB_ROOT_PASSWORD: memori
      MONGO_INITDB_DATABASE: memori_test
    ports:
      - "27017:27017"
    volumes:
      - mongodb_data:/data/db
    healthcheck:
      test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
      interval: 5s
      timeout: 5s
      retries: 5
    networks:
      - memori-network

  mongo-express:
    image: mongo-express:1.0.0
    restart: unless-stopped
    ports:
      - "8081:8081"
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: memori
      ME_CONFIG_MONGODB_ADMINPASSWORD: memori
      ME_CONFIG_MONGODB_URL: mongodb://memori:memori@mongodb:27017/
      ME_CONFIG_BASICAUTH_USERNAME: admin
      ME_CONFIG_BASICAUTH_PASSWORD: pass
    depends_on:
      - mongodb
    networks:
      - memori-network

  mysql:
    image: mysql:8
    environment:
      MYSQL_ROOT_PASSWORD: memori
      MYSQL_DATABASE: memori_test
      MYSQL_USER: memori
      MYSQL_PASSWORD: memori
    ports:
      - "3307:3306"
    volumes:
      - mysql_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "memori", "-pmemori"]
      interval: 5s
      timeout: 5s
      retries: 5
    networks:
      - memori-network

  oceanbase:
    image: quay.io/oceanbase/seekdb:latest
    ports:
      - "2882:2881"
    networks:
      - memori-network

  oracle:
    image: container-registry.oracle.com/database/free:latest-lite
    environment:
      ORACLE_PWD: memori
      ORACLE_CHARACTERSET: AL32UTF8
    ports:
      - "1521:1521"
    volumes:
      - oracle_data:/opt/oracle/oradata
    shm_size: 2gb
    healthcheck:
      test: ["CMD-SHELL", "echo 'SELECT 1 FROM DUAL;' | sqlplus -s system/memori@FREEPDB1 || exit 1"]
      interval: 15s
      timeout: 10s
      retries: 20
      start_period: 90s
    networks:
      - memori-network

volumes:
  postgres_data:
  mongodb_data:
  mysql_data:
  oracle_data:

networks:
  memori-network:
    driver: bridge

Memori Benchmarks โ€” LoCoMo Evaluation

Read the benchmark overview or download the paper.

This directory contains two Jupyter notebooks that evaluate Memori's Advanced Augmentation retrieval pipeline against the LoCoMo long-conversation benchmark.

The goal is to measure how well Memori's memory layer can answer questions about past conversations, compared to a naive "dump the entire chat history" baseline.

What the notebooks do

Notebook Purpose
01_load_indexes.ipynb Downloads augmented memories, embeds them with EmbeddingGemma-300M, and builds a FAISS search index per conversation.
02_run_benchmark.ipynb Loads the LoCoMo benchmark questions, retrieves relevant memories via hybrid search (FAISS + BM25), generates answers with an LLM, judges correctness, and reports accuracy metrics.

Run 01 first to build the indexes (skip if indexes_gemma/ already exists), then run 02 to evaluate.

Prerequisites

  • Python 3.10+ (see pyproject.toml for full dependency list).
  • A Hugging Face account with access to the gated embedding model (see below).
  • An OpenAI API key (only needed for notebook 02).

Quick start

1. Install dependencies

From this directory, using uv:

bash
cd benchmarks
uv sync                       # core dependencies
uv sync --extra notebook      # adds JupyterLab + widgets (optional)

Or with pip:

bash
pip install -e ".[notebook]"

Make sure to select the resulting environment as your Jupyter kernel.

2. Set up environment variables

Copy the example file and fill in your tokens:

bash
cp .env.example .env
Variable Required by Description
HF_TOKEN 01 and 02 Hugging Face read token for the gated embedding model.
OPENAI_API_KEY 02 only OpenAI API key for answer generation and judging.

Both notebooks call load_dotenv() to pick these up automatically.

3. Authorize the embedding model on Hugging Face

The embedding model (google/embeddinggemma-300m) is gated โ€” you must accept its license before downloading:

  1. Create a Hugging Face account if you don't have one.
  2. Visit the model page, sign in, and agree to the terms.
  3. Generate a Read token at Settings > Access Tokens.
  4. Add it to .env as HF_TOKEN=hf_..., or run huggingface-cli login in the same environment.

The first run downloads the model (~1.2 GB), which may take a few minutes.

4. Run the notebooks

Open each notebook in Jupyter and run all cells top to bottom:

  1. 01_load_indexes.ipynb โ€” builds indexes_gemma/ from augmented memories.
  2. 02_run_benchmark.ipynb โ€” runs the full evaluation pipeline.

Notebook details

`01_load_indexes.ipynb`

  • Input: advanced_augmented_memories.json (downloaded automatically if missing).
  • Output: indexes_gemma/<conv_id>/ directories, each containing faiss.index and metadata.json.
  • Re-run this notebook whenever the memory data or embedding model changes.

`02_run_benchmark.ipynb`

  • Requires the indexes_gemma/ directory from notebook 01.
  • Run the configuration cell first, then sections 1 through 8 in order.
  • Benchmark data is fetched from a URL by default (locomo10.json). Set LOCOMO_LOCAL_PATH in the config cell to use a local copy.
  • Key config (all in the first code cell): INDEX_DIR (default ./indexes_gemma), RESULTS_DIR (default ./results_gemma), OPENAI_MODEL (default gpt-4.1-mini).

Troubleshooting

Problem Solution
401 / 403 when loading the embedding model Make sure you accepted the license on the model page and that HF_TOKEN is set (or you ran huggingface-cli login).
FileNotFoundError for indexes Run notebook 01 first, or check that INDEX_DIR in notebook 02 points to the right directory.
OPENAI_API_KEY errors in notebook 02 Set the key in your .env file.
Very slow first run This is normal โ€” the model download and FAISS index build are one-time costs. CPU is supported but slower than GPU.

Verify your environment

Quick check that tokens are configured (doesn't print secrets):

python
import os
from dotenv import load_dotenv

load_dotenv()
hf = bool(os.getenv("HF_TOKEN", "").strip())
openai = bool(os.getenv("OPENAI_API_KEY", "").strip())
print(f"HF_TOKEN set: {hf}  |  OPENAI_API_KEY set: {openai}")