1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! Partial-update node results, commands, and interrupts.
//!
//! In the durable execution model a node no longer returns whole state. It
//! returns a [`NodeResult`], which is one of:
//!
//! - [`NodeResult::Update`]: a partial update merged through the graph reducer
//! at the superstep boundary.
//! - [`NodeResult::Command`]: a [`Command`] combining an optional update with
//! explicit routing (`goto`) and/or an interrupt resume value.
//! - [`NodeResult::Interrupt`]: an [`Interrupt`] that pauses the run for
//! human-in-the-loop input.
use crateNodeId;
/// The outcome of running a durable graph node.
/// A dynamic-fanout packet: schedule `node` for the next superstep with a
/// custom `arg` delivered to it through [`crate::graph::NodeContext::send_arg`],
/// independent of the graph's main committed state.
///
/// `Send` is the primitive for map-reduce, search fanout, parallel tool calls,
/// and per-item scoring: a node can emit one `Send` per work item — even many
/// pointing at the *same* target node — and each scheduled invocation receives
/// its own `arg`. Distinct from a plain `goto`, which simply activates a node
/// against the shared state with no per-activation input.
/// A single routing target produced by a [`Command`]: either a plain node
/// activation ([`RouteTarget::Node`]) or a [`Send`] packet carrying
/// per-invocation input ([`RouteTarget::Send`]).
/// A routing/update/resume directive returned from a node.
///
/// Commands combine three orthogonal effects:
///
/// - `update`: a partial state update applied through the reducer.
/// - `goto`: explicit next-step targets — plain node activations and/or [`Send`]
/// fanout packets — overriding static/conditional edges.
/// - `resume`: a value paired with an interrupt resume (set on the caller side).
/// A human-in-the-loop pause point.
///
/// Interrupts require a checkpointer. When a node returns an interrupt the
/// executor persists a checkpoint at the boundary and returns control to the
/// caller; `CompiledGraph::resume` re-runs the interrupted node.