Overview
The mem0-falkordb plugin provides:- Graph-structured memory: Store relationships between entities, not just flat facts
- Per-user graph isolation: Each user gets their own isolated FalkorDB graph
- Context-aware retrieval: Semantic search with vector embeddings
- Memory evolution: Support for updates and conflict resolution
- Runtime patching: No modifications to Mem0 source code required
Why Mem0 + FalkorDB?
FalkorDB’s Added Value
- Native multi-graph support: Isolated memory spaces for different users or agents
- 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 - High performance: Fast graph operations and efficient memory usage
- Cloud and on-premises ready: Works with FalkorDB Cloud or your own deployment
Use Cases
- Multi-agent systems: Persistent memory for each agent with graph-based relationships
- Conversational AI: Track facts, entities, and relationships across conversations
- Personalized assistants: Build context-aware AI that remembers user preferences and history
- Customer support: Provide context-rich responses based on customer interaction history
- Knowledge management: Aggregate and navigate complex information networks
Getting Started
Prerequisites
- Python 3.10 or higher
- FalkorDB instance (Cloud or self-hosted)
- OpenAI API key (or other supported LLM provider)
Installation
Install both Mem0 and the FalkorDB plugin:Quick Start Example
Here’s a complete example to get you started:Understanding the Code
- Register the plugin: Call
register()to patch FalkorDB into Mem0’s factory system - Configure Mem0: Set FalkorDB as the graph store provider with connection details
- Add memories: Store information with user_id for automatic graph isolation
- Search: Query memories using natural language
Running FalkorDB
Using Docker
Using FalkorDB Cloud
Sign up for a free account at app.falkordb.cloud and use the connection details in your config:Configuration Options
Graph Store Configuration
Per-User Graph Isolation
Each user automatically gets their own isolated FalkorDB graph (e.g.,mem0_alice, mem0_bob). This 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 - Scalability: Leverage FalkorDB’s native multi-graph support
Advanced Features
Working with Multiple Users
Getting All Memories
Updating Memories
Deleting Memories
Memory History
Demo
The mem0-falkordb repository includes a comprehensive demo showcasing:- Graph-structured memory with relationships
- Per-user graph isolation
- Context-aware retrieval
- Memory evolution and updates
- Visual graph inspection
Best Practices
- Call register() once: Always call
register()before creating a Mem0Memoryinstance - Use user_id consistently: Always provide user_id for proper graph isolation
- Configure LLM: Ensure your LLM provider is properly configured for entity extraction
- Monitor graph size: Use
GRAPH.MEMORY USAGEcommand to track memory usage - Clean up: Use
delete_all()to remove user graphs when no longer needed - Connection pooling: Reuse Memory instances when possible
Troubleshooting
Installation Issues
If you have trouble installing:- Ensure you have Python 3.10 or higher
- Install Mem0 and mem0-falkordb separately
- Try installing in a fresh virtual environment
Connection Issues
If you can’t connect to FalkorDB:- Verify FalkorDB is running:
redis-cli -h localhost -p 6379 ping - Check your connection details (host, port, credentials)
- Ensure FalkorDB is accessible on the specified host and port
Memory Not Being Stored
- Make sure to call
register()before creating the Memory instance - Verify your LLM API key is set correctly
- Check that the user_id is provided when adding memories
- Ensure FalkorDB has enough memory available
Search Returns No Results
- Verify memories were added successfully with
get_all() - Check that you’re using the correct user_id
- Ensure your embeddings configuration is correct
- Try more specific or different search queries
Resources
Next Steps
- Explore Graphiti for temporal knowledge graph capabilities
- Learn about Cognee for alternative memory management approaches
- Review GenAI Tools for graph reasoning and LLM integrations
Frequently Asked Questions
How does mem0-falkordb differ from the default Mem0 graph store?
How does mem0-falkordb differ from the default Mem0 graph store?
The mem0-falkordb plugin provides per-user graph isolation using FalkorDB’s native multi-graph support. Each user gets their own separate graph (e.g.,
mem0_alice, mem0_bob), eliminating the need for user_id filtering in queries and enabling simpler, faster operations.Do I need to modify Mem0 source code to use FalkorDB?
Do I need to modify Mem0 source code to use FalkorDB?
No. The mem0-falkordb plugin uses runtime patching to register FalkorDB as a graph store provider. Simply call
register() before creating a Mem0 Memory instance and configure provider: 'falkordb' in your config.What happens when I call delete_all for a user?
What happens when I call delete_all for a user?
When you call
delete_all(user_id='alice'), it simply drops the entire user graph (e.g., mem0_alice). This is much faster and cleaner than deleting individual records because each user has their own isolated graph.Can I use FalkorDB Cloud with Mem0?
Can I use FalkorDB Cloud with Mem0?
Yes. Update your config with your FalkorDB Cloud connection details including
host, port, username, and password. Sign up at app.falkordb.cloud for a free account.Why am I getting no results from memory search?
Why am I getting no results from memory search?
Common causes include: not calling
register() before creating the Memory instance, incorrect or missing user_id parameter, invalid LLM API key for entity extraction, or misconfigured embeddings. Verify memories exist with get_all(user_id='...').