pub struct GraphFlow { /* private fields */ }Expand description
DAG of flows. Each node is itself a flow; edges route based on node output. A node without an outgoing edge is terminal — its output is the graph’s output.
Implementations§
Source§impl GraphFlow
impl GraphFlow
Sourcepub fn new(name: impl Into<String>, entry: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, entry: impl Into<String>) -> Self
New empty graph rooted at entry. The entry node must be added via
GraphFlow::node before GraphFlow::run is called.
Sourcepub fn node_agent<A>(self, name: impl Into<String>, agent: A) -> Selfwhere
A: Agent + 'static,
pub fn node_agent<A>(self, name: impl Into<String>, agent: A) -> Selfwhere
A: Agent + 'static,
Convenience builder that wraps a concrete klieo_core::agent::Agent
in crate::flow::AgentFlow + upcasts to Arc<dyn Flow> in one
call.
Sourcepub fn edge_to(self, from: impl Into<String>, to: impl Into<String>) -> Self
pub fn edge_to(self, from: impl Into<String>, to: impl Into<String>) -> Self
Add an unconditional edge from -> to.
Sourcepub fn edge_branch<F>(
self,
from: impl Into<String>,
predicate: F,
on_true: impl Into<String>,
on_false: impl Into<String>,
) -> Self
pub fn edge_branch<F>( self, from: impl Into<String>, predicate: F, on_true: impl Into<String>, on_false: impl Into<String>, ) -> Self
Add a conditional edge from from that branches on predicate.
Sourcepub fn with_max_steps(self, n: u32) -> Self
pub fn with_max_steps(self, n: u32) -> Self
Override the default step cap (32). Hitting it returns
FlowError::Graph("max_steps exceeded; possible cycle").
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GraphFlow
impl !UnwindSafe for GraphFlow
impl Freeze for GraphFlow
impl Send for GraphFlow
impl Sync for GraphFlow
impl Unpin for GraphFlow
impl UnsafeUnpin for GraphFlow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more