Getting Started with SKGraph
Overview
SKGraph provides graph-based knowledge storage for AI agents using FalkorDB. It maps semantic relationships between memories, concepts, agents, and events.
Installation
pip install "skmemory[skgraph]"
Or standalone:
pip install skgraph
Requirements
- FalkorDB server (Redis-compatible graph database)
- Python 3.10+
Quick Start
from skgraph import KnowledgeGraph
kg = KnowledgeGraph(url="redis://localhost:6379")
# Add entities
kg.add_entity("lumina", type="agent", properties={"role": "queen"})
kg.add_entity("chef", type="human", properties={"name": "David"})
# Add relationships
kg.add_relation("lumina", "chef", "partners_with", weight=0.97)
# Query
results = kg.query("MATCH (a)-[r]->(b) WHERE a.name = 'lumina' RETURN b, r")
Integration with SKMemory
SKGraph works as a backend layer for SKMemory, automatically building a knowledge graph from stored memories:
from skmemory import Memory
from skgraph import KnowledgeGraph
# Memories automatically create graph nodes and edges
mem = Memory(backend="skgraph")
mem.snapshot(title="Project meeting", content="Discussed capauth integration...")
# Creates: (meeting) -[discusses]-> (capauth), (meeting) -[attended_by]-> (agent)