haive.core.graph.state_graph.components¶

Components module for the Haive state graph system.

This module provides both legacy components and new modular components for building computational graphs with rich state management and control flow capabilities.

Legacy Components:
  • Node: Base processing unit in a graph that handles state transformation

  • Branch: Conditional routing component for decision points in the graph

New Modular Components (Composition-based architecture):
  • BaseGraphComponent: Abstract base for all graph components

  • ComponentRegistry: Manages component lifecycle

  • NodeManager: Handles all node operations

  • EdgeManager: Handles direct edge operations

  • BranchManager: Handles conditional routing and branches

  • ModularBaseGraph: Main graph class using composition

Examples

Using the new modular architecture:

from haive.core.graph.state_graph.components import ModularBaseGraph

# Create a modular graph graph = ModularBaseGraph(name=”my_workflow”)

# Add nodes graph.add_node(“start”, start_function) graph.add_node(“process”, process_function)

# Add edges and routing graph.add_edge(“start”, “process”) graph.add_conditional_edges(“process”, router_function, {

“success”: “finish”, “error”: “retry”

})

Submodules¶