Open Source · Apache-2.0

LLM-powered long-term
memory engine

Rust core with Python, TypeScript & Rust bindings.
Extracts facts from conversations, deduplicates, and stores them in vector databases with full audit history.

pip install mem7
npm install @mem7ai/mem7
cargo add mem7

Quick Start

Get up and running in minutes. Pick your language to get started.

quickstart.py
from mem7 import Memory
from mem7.config import MemoryConfig, LlmConfig, EmbeddingConfig

config = MemoryConfig(
    llm=LlmConfig(
        base_url="http://localhost:11434/v1",
        api_key="ollama",
        model="qwen2.5:7b",
    ),
    embedding=EmbeddingConfig(
        base_url="http://localhost:11434/v1",
        api_key="ollama",
        model="mxbai-embed-large",
        dims=1024,
    ),
)

m = Memory(config=config)

# Add a memory from conversation
m.add("I love playing tennis and my coach is Sarah.", user_id="alice")

# Semantic search
results = m.search("What sports does Alice play?", user_id="alice")

# Get all memories for a user
memories = m.get_all(user_id="alice")
quickstart.ts
import { MemoryEngine } from "@mem7ai/mem7";

const engine = await MemoryEngine.create(JSON.stringify({
  llm: {
    base_url: "http://localhost:11434/v1",
    api_key: "ollama",
    model: "qwen2.5:7b",
  },
  embedding: {
    base_url: "http://localhost:11434/v1",
    api_key: "ollama",
    model: "mxbai-embed-large",
    dims: 1024,
  },
}));

// Add a memory from conversation
await engine.add(
  [{ role: "user", content: "I love playing tennis and my coach is Sarah." }],
  "alice"
);

// Semantic search
const results = await engine.search("What sports does Alice play?", "alice");

// Get all memories for a user
const memories = await engine.getAll("alice");
main.rs
use mem7::prelude::*;

#[tokio::main]
async fn main() -> Result<()> {
    let config = MemoryConfig {
        llm: LlmConfig {
            base_url: "http://localhost:11434/v1".into(),
            api_key: "ollama".into(),
            model: "qwen2.5:7b".into(),
            ..Default::default()
        },
        embedding: EmbeddingConfig {
            base_url: "http://localhost:11434/v1".into(),
            api_key: "ollama".into(),
            model: "mxbai-embed-large".into(),
            dims: 1024,
            ..Default::default()
        },
        ..Default::default()
    };

    let engine = MemoryEngine::new(config).await?;

    // Add a memory
    engine.add(messages, "alice", None, None).await?;

    // Semantic search
    let results = engine.search("What sports?", "alice", None, None, 5).await?;

    Ok(())
}

Architecture

High-performance Rust core with zero-cost language bindings.

Python / TypeScript / Rust PyO3 · napi-rs · native
Rust Core tokio async runtime
mem7-llm
mem7-embedding
mem7-vector
mem7-history
mem7-dedup
mem7-store

Rust Performance

Async Rust core with tokio runtime. Native speed for embedding, deduplication, and vector operations.

Multi-Language

First-class Python, TypeScript, and Rust APIs. Zero-overhead bindings via PyO3 and napi-rs.

Pluggable Providers

Swap LLMs, embeddings, and vector stores via config. One OpenAI-compatible client covers most providers.

Audit Trail

Every ADD, UPDATE, and DELETE is recorded in a SQLite audit log with full history per memory.

Multi-User

Memories are isolated per user_id. Each user has their own memory space with no cross-contamination.

Smart Deduplication

LLM-driven deduplication decides whether to add, update, or skip based on existing memories.

Supported Providers

One OpenAI-compatible client covers most LLM and embedding providers out of the box.

LLMs

OpenAI
Ollama
vLLM
Groq
Together
DeepSeek
xAI (Grok)
LM Studio
Azure OpenAI
Anthropicplanned
Geminiplanned
Vertex AIplanned
AWS Bedrockplanned

Any OpenAI-compatible API works

Embeddings

OpenAI
Ollama
Together
LM Studio
Azure OpenAI
Hugging Faceplanned
Geminiplanned
Vertex AIplanned
AWS Bedrockplanned

Any OpenAI-compatible API works

Vector Stores

In-memory (FlatIndex)
Upstash Vector
Qdrantplanned
Chromaplanned
pgvectorplanned
Milvusplanned
Pineconeplanned
Redisplanned
Weaviateplanned
Elasticsearchplanned
FAISSplanned
MongoDBplanned

Language Bindings

Use mem7 from your preferred language.