Installation
Install Graphiti with Kuzu support:Configuration
Database Location
Kuzu can run in-memory or persist to disk:Concurrency Control
Control the number of concurrent queries:Driver Implementation
The KuzuDriver (graphiti_core/driver/kuzu_driver.py:135) provides:
- Embedded Architecture: Runs in-process, no separate server needed
- Schema Enforcement: Explicit schema defined at startup
- Fast Analytics: Optimized for analytical graph queries
- DuckDB Integration: Built on DuckDB’s columnar storage
Connection Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
db | str | ":memory:" | Database path or :memory: for in-memory |
max_concurrent_queries | int | 1 | Maximum number of concurrent queries |
Schema Definition
Kuzu requires an explicit schema. Graphiti defines the following node and relationship types:Node Tables
- Episodic: Episode nodes with content and metadata
- Entity: Entity nodes with embeddings and summaries
- Community: Community nodes for entity groupings
- RelatesToNode_: Edge representation as nodes (workaround for Kuzu limitations)
- Saga: Saga nodes for episode sequencing
Relationship Tables
- RELATES_TO: Entity relationships
- MENTIONS: Episodic to Entity connections
- HAS_MEMBER: Community membership
- HAS_EPISODE: Saga to Episode connections
- NEXT_EPISODE: Episode sequencing
graphiti_core/driver/kuzu_driver.py:54).
Edge Representation
Kuzu currently doesn’t support fulltext indexes on edge properties. Graphiti works around this by representingRELATES_TO edges as intermediate nodes:
Complete Example
When to Use Kuzu
Choose Kuzu if you:- Need an embedded database (no separate server)
- Want fast analytical queries over large graphs
- Prefer simpler deployment (single process)
- Are building desktop or edge applications
- Need DuckDB-compatible analytics
- Need client-server architecture
- Require production-ready clustering
- Want extensive ecosystem support
- Need dynamic schema updates
Performance Characteristics
- Write Performance: Optimized for batch writes
- Read Performance: Excellent for analytical queries and graph traversals
- Storage: Columnar storage for efficient compression
- Memory: Lower memory footprint than in-memory databases
Index Management
Kuzu’s schema-based approach means indices are defined during schema creation. Thebuild_indices_and_constraints() method is a no-op for Kuzu, as indices are built automatically from the schema.
Production Considerations
- Database Path: Use absolute paths for persistent databases
- Concurrency: Tune
max_concurrent_queriesbased on workload - Backups: Copy the database directory for backups
- Version Compatibility: Kuzu is under active development; test version upgrades carefully
- Schema Changes: Require database recreation (no dynamic schema evolution)