FalkorDB graph store plugin for Mem0. Adds FalkorDB as a graph memory backend without modifying any Mem0 source code.
pip install mem0-falkordbYou also need Mem0 installed separately:
pip install mem0aifrom mem0_falkordb import register
register()
from mem0 import Memory
config = {
"graph_store": {
"provider": "falkordb",
"config": {
"host": "localhost",
"port": 6379,
"database": "mem0",
},
},
# Add your LLM and embedder config as usual
"llm": {
"provider": "openai",
"config": {"model": "gpt-4o-mini"},
},
}
m = Memory.from_config(config)
m.add("I love pizza", user_id="alice")
results = m.search("what does alice like?", user_id="alice")
See the demo/ directory for a comprehensive multi-user demonstration showcasing:
- Graph-structured memory — relationships between entities, not just flat facts
- Per-user graph isolation — each user gets their own FalkorDB graph
- Context-aware retrieval — semantic search with vector embeddings
- Memory evolution — updates and conflict resolution
- Visual inspection — see the actual graph structure
docker run --rm -p 6379:6379 falkordb/falkordb:latest
cd demo
uv sync
export OPENAI_API_KEY='your-key-here'
uv run python demo.pySee demo/README.md for complete instructions.
| Parameter | Type | Default | Description |
|---|---|---|---|
host |
str | localhost |
FalkorDB server host |
port |
int | 6379 |
FalkorDB server port |
database |
str | mem0 |
Graph name prefix (each user gets {database}_{user_id}) |
username |
str | None |
Authentication username (optional) |
password |
str | None |
Authentication password (optional) |
base_label |
bool | True |
Use __Entity__ base label |
Each user automatically gets their own isolated FalkorDB graph (e.g. mem0_alice, mem0_bob). This leverages FalkorDB's native multi-graph support and provides:
- Natural data isolation — no user_id filtering needed in Cypher queries
- Simpler, faster queries — no WHERE clauses on user_id
- Easy cleanup —
delete_allsimply drops the user's graph
Using Docker:
docker run --rm -p 6379:6379 falkordb/falkordbThis plugin uses Python's runtime patching to register FalkorDB into Mem0's existing factory system:
GraphStoreFactory.provider_to_classgets a new"falkordb"entryGraphStoreConfigis patched to acceptFalkorDBConfig- A
MemoryGraphclass translates Mem0's graph operations to FalkorDB-compatible Cypher
| Neo4j | FalkorDB |
|---|---|
elementId(n) |
id(n) |
vector.similarity.cosine() |
db.idx.vector.queryNodes() procedure |
db.create.setNodeVectorProperty() |
SET n.embedding = vecf32($vec) |
CALL { ... UNION ... } subqueries |
Separate outgoing + incoming queries |
git clone <repo>
cd mem0-falkordb
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest