Skip to main content
Hypergraph takes the best from both DAG frameworks and agent frameworks:
  • From DAG frameworks (Hamilton, Pipefunc): Pure functions, automatic edge inference, no state schema
  • From agent frameworks (LangGraph, Pydantic-Graph): Cycles, routing, human-in-the-loop

Quick Comparison

FeaturehypergraphLangGraphHamiltonPipefuncPydantic-Graph
DAG Pipelines
Agentic Loops
State SchemaNoneTypedDictNoneNonePydantic
Edge InferenceAutomaticManualAutomaticAutomaticManual
HierarchicalFirst-class
Human-in-the-Loop

The Design Space

DAG-First Frameworks

Hamilton and Pipefunc excel at data pipelines. Functions define nodes, edges are inferred from parameter names. Clean, testable, minimal boilerplate.
But they can’t express cycles. Multi-turn conversations, agentic workflows, iterative refinement — none of these are possible when the framework fundamentally assumes DAG execution.

Agent-First Frameworks

LangGraph and Pydantic-Graph were built for agents. They support cycles, conditional routing, and human-in-the-loop patterns.
But they require explicit state schemas. Every node reads from and writes to a shared state object. Functions become framework-coupled. Testing requires mocking state.

Hypergraph: The Middle Path

Hypergraph takes the best of both:

From DAG Frameworks

  • Pure functions (testable without framework)
  • Automatic edge inference (no manual wiring)
  • No state schema (just function parameters)

From Agent Frameworks

  • Cycles for multi-turn workflows
  • Conditional routing (@route, @ifelse)
  • Human-in-the-loop (@interrupt)

Code Comparison: RAG Pipeline

The same RAG pipeline in each framework.
from hypergraph import Graph, node

@node(output_name="embedding")
def embed(query: str) -> list[float]:
    return model.embed(query)

@node(output_name="docs")
def retrieve(embedding: list[float]) -> list[str]:
    return db.search(embedding)

@node(output_name="answer")
def generate(docs: list[str], query: str) -> str:
    return llm.generate(docs, query)

graph = Graph(nodes=[embed, retrieve, generate])
FrameworkLines of CodeBoilerplateState Schema
Hypergraph12NoneNone
LangGraph25State TypedDict, manual edges, entry/finish pointsRequired
Hamilton14Driver setupNone
Pipefunc13NoneNone

Code Comparison: Agentic Loop

A multi-turn conversation with iterative retrieval.
from hypergraph import Graph, node, route, END

@node(output_name="response")
def generate(docs: list, messages: list) -> str:
    return llm.chat(docs, messages)

@node(output_name="messages")
def accumulate(messages: list, response: str) -> list:
    return messages + [{"role": "assistant", "content": response}]

@route(targets=["generate", END])
def should_continue(messages: list) -> str:
    if is_complete(messages):
        return END
    return "generate"

graph = Graph(nodes=[generate, accumulate, should_continue])

Key Differences

State Model

FrameworkState Model
hypergraphEdges inferred from names. No schema needed.
LangGraphExplicit TypedDict with reducers for appends
Pydantic-GraphPydantic models with explicit read/write
HamiltonOutputs flow forward, no shared state
PipefuncOutputs flow forward, no shared state

Function Portability

Can you test functions without the framework?
FrameworkPortability
hypergraphembed.func(“hello”) - direct access ✓
LangGraphFunctions take State dict - framework-coupled ✗
Pydantic-GraphFunctions take context - framework-coupled ✗
HamiltonPure functions - fully portable ✓
Pipefuncembed.func(“hello”) - direct access ✓

When to Choose Each

Choose Hypergraph When

Unified Workflows

You need both DAGs and agentic patterns in one framework

Minimal Boilerplate

You want the cleanest possible API with automatic wiring

Hierarchical Composition

You’re building nested workflows (DAGs in cycles, cycles in DAGs)

Multi-Agent Systems

You’re orchestrating multiple agents with complex control flow

Choose LangGraph When

  • You’re already in the LangChain ecosystem
  • You need LangChain integrations (tools, retrievers, etc.)
  • You want a mature, production-tested solution
  • You prefer explicit state management

Choose Hamilton When

  • You’re doing data engineering, feature engineering, or ML pipelines
  • Lineage tracking and observability matter (Hamilton UI)
  • You want a mature framework with years of production use at scale
  • You need portability across execution environments (notebooks, Airflow, Spark)

Choose Pipefunc When

  • You’re doing scientific computing, simulations, or parameter sweeps
  • You need HPC/SLURM integration for cluster execution
  • Low orchestration overhead matters for compute-intensive workloads
  • You want n-dimensional map operations with adaptive scheduling

Choose Pydantic-Graph When

  • You want Pydantic integration for validation
  • Type validation at runtime is important
  • You’re building API-driven workflows

Honest Tradeoffs

Hypergraph is younger than these alternatives. Tradeoffs to consider:
AreaStatus
MaturityAlpha - API may change
Production useLimited testing at scale
EcosystemSmaller community
IntegrationsFewer pre-built connectors
If you need a battle-tested solution today, LangGraph or Hamilton may be safer choices. If you value the unified model and cleaner API, hypergraph is worth evaluating.

Migration Path

From Hamilton/Pipefunc

Minimal changes - the decorator pattern is similar:
def embedding(query: str) -> list[float]:
    return model.embed(query)
Main difference: Add output_name parameter to explicitly name what the function produces.

From LangGraph

Bigger changes - remove state schema, refactor functions:
class State(TypedDict):
    docs: list
    query: str
    response: str

def generate(state: State) -> dict:
    return {"response": llm.chat(state["docs"], state["query"])}
The function becomes pure - takes inputs directly, returns output directly. No state dict.

Summary

FrameworkBest ForKey Strength
HypergraphUnified DAG + agent workflowsOne framework for everything
LangGraphLangChain-based agentsMature ecosystem, integrations
HamiltonData/ML pipelines at scaleLineage, observability, maturity
PipefuncScientific computing, HPCPerformance, cluster execution
Pydantic-GraphAPI-driven workflowsRuntime validation

Build docs developers (and LLMs) love