Graph Execution Model And Parallelization
June 29, 2026 ยท View on GitHub
Milestone 1 executor:
- sequential
- one active node at a time
- whole-state updates
- direct or string conditional routes
- recursion limit
Target executor:
- Pregel-like bulk synchronous parallel supersteps
- multiple active tasks per step
- immutable state snapshot during a step
- writes visible in the next step only
- deterministic write ordering before reducer application
- reducer/channel updates at step boundaries
- checkpoint after step completion
- pending writes from completed tasks
- cached writes replay without rerunning nodes
- resume from checkpoint
- recursive call tracking
- child graph and child agent run tracking
Superstep lifecycle:
- Load checkpoint, active tasks, and pending writes.
- Emit step started event.
- Match cached task writes when cache policy allows it.
- Run active tasks under concurrency, timeout, retry, and cancellation policy.
- Collect writes, commands, sends, interrupts, and errors.
- Persist task writes as pending writes when checkpointing supports it.
- Apply channel reducers at the step boundary.
- Select next active tasks from channel version changes and routing commands.
- Persist the checkpoint according to durability mode.
- Emit checkpoint, update, task, and step completion events.
Checkpointing mid-node should be avoided. Async Rust stack suspension is not a stable persistence primitive; rerunning a node from the beginning is easier to reason about and matches interrupt semantics.
Parallelization
Parallel execution is represented as multiple active tasks in one superstep. A
node can route to more than one next node through conditional routing, a
command, or Send packets.
Command::new()
.update(update)
.goto([
Send::new("retrieve_docs", json!({ "query": "billing" })),
Send::new("retrieve_docs", json!({ "query": "refund" })),
Send::new("score_risk", json!({ "account_id": 42 })),
])
Parallel execution rules:
- all active nodes in a superstep read the same committed state snapshot
- node-local reads may optionally include that node's own pending writes for branch decisions
- each node returns partial updates, commands, interrupts, sends, or errors
- channels merge successful writes at the step boundary
- conflicting writes produce reducer/channel errors, not arbitrary last-writer behavior
- a failed required node fails the step unless an error handler or policy routes it elsewhere
- completed writes can be preserved as pending writes when other nodes fail
- concurrency is bounded by graph defaults and run config
Parallelism must be visible in events:
StepStarted { active: [...] }TaskStartedTaskCompletedTaskFailedTaskCachedStateUpdatedRouteSelectedCheckpointSavedStepCompleted
For agent-specific fanout, forked runtime context, and shared-cache semantics, see Parallel agents and context forking.