Graph
The Graph class defines a computation graph from nodes. It describes what nodes exist and how they connect.Graph Class
Constructor
List of HyperNode objects (FunctionNode, GraphNode, GateNode, etc.)
Explicit edge declarations. Each edge is a tuple of
(source, target) or (source, target, values) where source/target are node names (str) or node objects, and values is a str or list of str specifying which outputs flow on the edge. When provided, auto-inference is disabledOptional graph name (required for nesting via
as_node())If True, validate type compatibility between connected nodes at graph construction time
Properties
Graph name (required for nesting)
Map of node name → node object
All unique output names produced by nodes
Outputs from terminal nodes (no downstream destinations)
Input specification describing required/optional/entrypoint parameters (cached per instance)
True if graph contains cycles
True if any FunctionNode is async
True if any node is an interrupt node
Ordered list of interrupt node instances
Whether type validation is enabled
Merkle-tree hash of graph structure (cached, includes node hashes and edges)
Underlying NetworkX directed graph
Default output selection, or None if all outputs are returned
Configured entry points, or None if all nodes are active
Map of node_name → list of controlling gate names
Methods
bind
Keyword arguments mapping parameter names to default values
Graph
New Graph instance with bound values
run() values — overridable at run time.
Raises
ValueError if key is not a valid graph input or output, or if key is an emit-only output (ordering signal).unbind
Parameter names to unbind
Graph
New Graph instance without specified bindings
select
Output names to include. Must be valid graph outputs
Graph
New Graph with default selection set
runner.run() and which outputs are exposed when this graph is used as a nested node via as_node().
Also narrows graph.inputs to only parameters needed to produce the selected outputs. A runtime select= passed to runner.run() overrides this default.
Raises
ValueError if any name is not a graph output or if names are not unique.with_entrypoint
One or more node names to use as entry points
Graph
New Graph with entry points configured
- DAG: entry point determines where computation starts
- Cycle: entry point determines cycle bootstrap requirements
graph.with_entrypoint("A").with_entrypoint("B")
Raises
GraphConfigError if node doesn’t exist or is a gate node.add_nodes
Nodes to add
Graph
New Graph with added nodes
Raises
GraphConfigError if graph was constructed with explicit edges. Raises ValueError if existing bindings become invalid after adding nodes.as_node
Optional node name. If not provided, uses
graph.nameGraphNode
GraphNode wrapping this graph
Raises
ValueError if name is None and graph.name is None.visualize
How many levels of nested graphs to expand
“dark”, “light”, or “auto” to detect from environment
Whether to show type annotations on nodes
Whether to render outputs as separate DATA nodes
Path to save HTML file (default: None, display in notebook)
ScrollablePipelineWidget | None
Widget if output is None (displays in notebook), otherwise None (saves to file)
to_mermaid
How many levels of nested graphs to expand
Whether to show type annotations in labels
Whether to render outputs as separate DATA nodes
Flowchart direction — “TD”, “TB”, “LR”, “RL”, “BT”
Custom color overrides per node class, e.g.
{"function": {"fill": "#fff", "stroke": "#000"}}MermaidDiagram
Diagram object that auto-renders in notebooks and converts to raw Mermaid source via
str() or print()to_flat_graph
nx.DiGraph
New DiGraph where all nodes (root + nested) are in one graph with hierarchical node IDs
- All nodes (root + nested) are in one graph
- Node attributes include
parentfor hierarchy - Node IDs are hierarchical to prevent collisions (e.g., “pipeline1/process”)
- Edges include both root-level and nested edges
- Graph attributes include
input_specandoutput_to_sources
iter_nodes
Iterable[HyperNode]
Iterator over node objects
debug_viz
VizDebugger
VizDebugger instance for tracing nodes/edges and finding issues