Gates
Gate nodes control execution flow in graphs. They make routing decisions but do not produce data outputs.Gate Decorators
@route
Valid target names. Can be a list or dict with descriptions for visualization
Default target if function returns None (incompatible with
multi_target)If True, function returns list of targets to run in parallel
Cache the routing function’s return value. On cache hit, the runner restores the routing decision without calling the function
Whether to hide from visualization
If True, targets may execute before the gate runs the first time. If False, targets are blocked until the gate executes and records a decision
Node name (default:
func.__name__)Mapping to rename inputs
{old: new}Ordering-only output name(s)
Ordering-only input name(s)
RouteNode
Returns a RouteNode instance
Return Value
The decorated function should return:- A target name (str) to activate that node
ENDto terminate execution along this pathNoneto use fallback (if set) or do nothing- A list of targets if
multi_target=True
@ifelse
Target to activate when function returns True
Target to activate when function returns False
Cache the routing function’s return value
Whether to hide from visualization
If True, targets may execute before the gate runs the first time. If False, targets are blocked until the gate executes
Node name (default:
func.__name__)Mapping to rename inputs
{old: new}Ordering-only output name(s)
Ordering-only input name(s)
IfElseNode
Returns an IfElseNode instance
Return Value
The decorated function should return:True: Routes towhen_truetargetFalse: Routes towhen_falsetarget
Gate Classes
GateNode
Abstract base class for routing/control flow nodes. Gate nodes make routing decisions but do not produce data outputs.Node name
Input parameter names from function signature
Always empty tuple or emit-only outputs (gates produce no data)
List of valid target names (or END)
Optional descriptions for visualization
The routing function
Properties
Whether routing function results should be cached
Whether this node is hidden from visualization
Ordering-only inputs this gate waits for
Gates produce no data outputs (always empty tuple)
Route functions must be sync, so always False
Route functions must not be generators, so always False
RouteNode
Routes execution to target nodes based on a routing function’s return value.Function that returns target name(s) or END
Valid targets (list or dict with descriptions)
Default target if func returns None (incompatible with
multi_target)If True, func returns list of targets to run in parallel
Whether to cache routing decisions
Whether to hide from visualization
If True, targets may execute before the gate runs the first time
Node name (default:
func.__name__)Mapping to rename inputs
{old: new}Ordering-only output name(s)
Ordering-only input name(s)
Properties
Default target if function returns None
Whether function returns list of targets
IfElseNode
Binary gate that routes based on boolean decision.Function that returns True or False
Target to activate when func returns True
Target to activate when func returns False
Whether to cache routing decisions
Whether to hide from visualization
If True, targets may execute before the gate runs the first time
Node name (default:
func.__name__)Mapping to rename inputs
{old: new}Ordering-only output name(s)
Ordering-only input name(s)
Properties
Target when function returns True
Target when function returns False
END Sentinel
END
Sentinel class indicating execution should terminate along this path.END is a class, not an instance. Use it directly (END, not END()).