pub struct FoldSpec { /* private fields */ }Expand description
The spec for a fold node: bounded iteration that accumulates across passes.
Implementations§
Source§impl FoldSpec
impl FoldSpec
Sourcepub fn new(
id: impl Into<String>,
body: FoldBody,
max_iterations: u32,
stop_when: impl Into<String>,
join: FoldJoin,
) -> Self
pub fn new( id: impl Into<String>, body: FoldBody, max_iterations: u32, stop_when: impl Into<String>, join: FoldJoin, ) -> Self
Sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
Sets a short display label for this node. Bounds (a 64-character cap,
not empty or all whitespace) are checked by [crate::validate], not
here; see crate::document’s “The optional node display name”
section for why this field, unlike an agent’s own name, is part of
the graph’s content hash.
Sourcepub fn on_bound(self, on_bound: OnBound) -> Self
pub fn on_bound(self, on_bound: OnBound) -> Self
Declares what a reached iteration bound means. Left unset, the field
stays off the wire and the fold means OnBound::Join, which is what a
fold written before the field existed does; set it to
OnBound::Fail when the stop predicate is a requirement rather than
an early exit.
Sourcepub fn accumulator_schema(self, schema: Value) -> Self
pub fn accumulator_schema(self, schema: Value) -> Self
Declares the JSON Schema for the accumulated value the loop carries and
produces. Data only, like an agent’s output_schema.