Overview
Graphiti provides a powerful abstraction layer for building knowledge graphs that:- Track temporal changes: Understand how entities and relationships evolve over time
- Support multi-tenancy: Isolated memory spaces for different users or agents
- Enable hybrid search: Combine semantic search with graph traversal
- Scale efficiently: Built on top of FalkorDB’s high-performance graph engine
Why Graphiti + FalkorDB?
FalkorDB’s Added Value
- Multi-tenant, multi-agent memory: Isolated graph instances for different users or agents, each with their own persistent memory
- High performance: Fast graph operations and efficient memory usage
- Cloud and on-premises ready: Works with FalkorDB Cloud or your own deployment
- Easy integration: Seamless connection with Graphiti for scalable, production-ready knowledge graphs
Use Cases
- AI memory for multi-agent systems: Provide persistent, context-rich memory for each agent
- Enterprise knowledge management: Aggregate and search across documents, conversations, and structured data
- Conversational AI: Track facts, entities, and relationships over time for more accurate responses
- E-commerce: Manage inventory, personalize recommendations, and track customer interactions over time
- Research and analytics: Temporal and semantic search across large, heterogeneous datasets
Getting Started
Prerequisites
- Python 3.10 or higher
- FalkorDB instance (Cloud or self-hosted)
- OpenAI API key (for embeddings and LLM features)
Installation
Install Graphiti with FalkorDB support:Quick Start Example
Here’s a complete example to get you started with Graphiti and FalkorDB:Understanding the Code
- Initialize Graphiti: Connect to your FalkorDB instance with the connection URI
- Build Indices: Create necessary graph indices and constraints (one-time setup)
- Add Episodes: Store information as “episodes” - chunks of text or structured data with temporal context
- Search: Query the graph using natural language or specific parameters
- Close: Clean up connections when done
Advanced Features
Hybrid Search
Graphiti supports multiple search types:Temporal Queries
Query the graph at specific points in time:Multi-Tenant Architecture
Create isolated graphs for different users or agents:Configuration Options
Connection Parameters
Custom LLM Configuration
Best Practices
- Batch Episodes: When loading large amounts of data, batch your episodes for better performance
- Set Reference Times: Always provide reference times for temporal tracking
- Use Descriptive Names: Give episodes meaningful names for easier retrieval
- Index Strategy: Build indices once during setup, not on every run
- Connection Pooling: Reuse Graphiti instances when possible instead of creating new connections
Troubleshooting
Connection Issues
If you can’t connect to FalkorDB:- Verify your connection string format:
falkor://host:port - Check if FalkorDB is running:
redis-cli ping - Ensure credentials are correct for authenticated instances
Performance Optimization
- Use batching for bulk operations
- Monitor memory usage with
GRAPH.MEMORY USAGEcommand - Consider graph partitioning for very large knowledge bases
Resources
- 📚 Graphiti Documentation
- 🎥 Workshop: How to Build a Knowledge Graph ft. Graphiti
- 📓 Blog: Get Started with Graphiti
- 💻 Graphiti GitHub Repository
- 📝 Google Colab Example
- 🔗 FalkorDB Configuration Guide
Next Steps
- Explore Cognee for alternative memory management approaches
- Learn about GenAI Tools for graph reasoning and LLM integrations
Frequently Asked Questions
What does 'temporally-aware' mean in the context of Graphiti?
What does 'temporally-aware' mean in the context of Graphiti?
Temporally-aware means Graphiti tracks how entities and relationships change over time. Each episode includes a reference time, allowing you to query the state of knowledge at any point in history and understand the evolution of relationships.
How do I connect Graphiti to FalkorDB?
How do I connect Graphiti to FalkorDB?
Use the
falkor:// URI scheme when initializing Graphiti: Graphiti(uri='falkor://localhost:6379'). For FalkorDB Cloud, include credentials: falkor://your-instance.falkordb.cloud:6379 with username and password parameters.What is an 'episode' in Graphiti?
What is an 'episode' in Graphiti?
An episode is a unit of information stored in the knowledge graph - it can be text, a message, or structured data with temporal context. Graphiti processes episodes to extract entities and relationships, building the graph incrementally over time.
How does multi-tenancy work in Graphiti with FalkorDB?
How does multi-tenancy work in Graphiti with FalkorDB?
Create isolated graphs for different users or agents by specifying a unique
graph_name parameter: Graphiti(uri='falkor://localhost:6379', graph_name='user1_memory'). Each graph is completely isolated, leveraging FalkorDB’s native multi-graph support.Do I need to call build_indices_and_constraints every time I run my application?
Do I need to call build_indices_and_constraints every time I run my application?
No. Call
await graphiti.build_indices_and_constraints() once during initial setup to create necessary graph indices and constraints. Subsequent runs of your application can skip this step.