What is Hypergraph?
The Idea
┌─────────────────────────────────────────────────────────────────┐
│ THE SPECTRUM │
│ │
│ Batch Pipelines → Branching → Agentic Loops │
│ ──────────────────────────────────────────────────────────── │
│ ETL, ML inference @ifelse @route, END │
│ (DAG) (conditional) (cycles) │
│ │
│ ─────────────── hypergraph handles all of it ──────────────── │
└─────────────────────────────────────────────────────────────────┘How It Works
from hypergraph import Graph, node, SyncRunner
@node(output_name="embedding")
def embed(text: str) -> list[float]:
# Your embedding model here
return [0.1, 0.2, 0.3]
@node(output_name="docs")
def retrieve(embedding: list[float]) -> list[str]:
# Your vector search here
return ["Document 1", "Document 2"]
@node(output_name="answer")
def generate(docs: list[str], query: str) -> str:
# Your LLM here
return f"Based on {len(docs)} docs: answer to {query}"
# Edges inferred from matching names
graph = Graph(nodes=[embed, retrieve, generate])
runner = SyncRunner()
result = runner.run(graph, {"text": "RAG tutorial", "query": "What is RAG?"})
print(result["answer"])Key Differentiators
1. One Framework to Master
2. Natural Hierarchy
3. Just Functions
4. Pure, Testable Functions
5. Build-Time Validation
6. Think Singular, Scale with Map
What's Next?
Last updated