Skip to main content

Crate klieo_flows

Crate klieo_flows 

Source
Expand description

Multi-agent composition shapes for the klieo agent framework.

Foundation Plan #10 fixed the klieo_core::Agent trait with associated types Input, Output, Error. That choice prevents Box<dyn Agent>, which composition shapes (Sequential / Parallel / Loop / Graph) need.

klieo-flows introduces a separate type-erased Flow trait with serde_json::Value I/O. The AgentFlow<A> adapter wraps any concrete Agent implementation into a Flow by JSON-marshalling at the boundary. Concrete shapes (SequentialFlow, ParallelFlow, LoopFlow, GraphFlow) compose Arc<dyn Flow> references freely.

The cost: one JSON serialise/deserialise per Flow::run boundary. Acceptable for v0.0.1; a typed-builder follow-up is listed in the plan’s carryovers section.

Structs§

AgentFlow
Adapter wrapping a concrete Agent into a Flow by JSON-marshalling at the I/O boundary.
GraphFlow
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.
LoopFlow
Loop a single body flow until the predicate returns Done.
ParallelFlow
Fan-out the input to N branches, run them concurrently, return a JSON object keyed by branch name. First error fails the whole flow (other branches are dropped).
SequentialFlow
Ordered pipeline. Each step’s output is threaded as the next step’s input. Empty pipelines return their input unchanged (identity). First error short-circuits.
TypedSequentialFlow
Pipeline of typed transformations.

Enums§

Edge
Outgoing edge from a graph node.
FlowError
Errors returned by crate::flow::Flow::run and its concrete impls.
LoopVerdict
Predicate verdict for LoopFlow.

Traits§

Flow
Type-erased composition primitive. All composition shapes (crate::sequential::SequentialFlow, crate::parallel::ParallelFlow, crate::loop_flow::LoopFlow, crate::graph::GraphFlow) implement this trait.