Expand description
Graph definition, plus structural validation when you call
GraphBuilder::compile.
The public graph API is deliberately a thin builder (GraphBuilder);
compile() freezes the graph into an immutable, cheaply-clonable
Graph with Arc-wrapped internals and validates structure before
any node (or LLM call) ever runs:
- an entry point must be set and must reference a known node;
- every edge endpoint must reference a known node;
- at least one node must be registered;
- node names must not collide with the reserved
ENDsentinel; - edges must be unambiguous: no duplicate
from → toedges, at most one conditional edge per source node, and no source node mixing static and conditional edges.
Edge types:
- Normal edges (
GraphBuilder::add_edge):from → to. Multiple outgoing normal edges from one node activate all destinations in parallel in the next super-step. - Conditional edges (
GraphBuilder::add_conditional_edges): an async routing function reads the post-barrier state and returns aRoute— one node, dynamic fan-out viaSend, or the end of the run.
Structs§
- Graph
- A compiled, immutable, thread-safe graph. Cheap to clone (Arc internals).
- Graph
Builder - Builder for a
Graph. Register nodes and edges, set the entry point, thenGraphBuilder::compileto validate and freeze. - Send
- A single dynamic fan-out instruction: run
nodeonce withstateas its scoped input state.
Enums§
Constants§
- END
- Reserved node name for the terminal route. Not a real node: routers
signal termination with
Route::Endinstead of naming a node.GraphBuilder::compilerejects registering a node under this name (or any__-prefixed name) so the sentinel namespace can never collide with user nodes.
Type Aliases§
- Conditional
Router - Async routing function for a conditional edge: reads the post-barrier state and decides where the run goes next.