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§
- Agent
Flow - Adapter wrapping a concrete
Agentinto aFlowby JSON-marshalling at the I/O boundary. - Graph
Flow - 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.
- Loop
Flow - Loop a single body flow until the predicate returns
Done. - Parallel
Flow - 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).
- Sequential
Flow - 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.
- Typed
Sequential Flow - Pipeline of typed transformations.
Enums§
- Edge
- Outgoing edge from a graph node.
- Flow
Error - Errors returned by
crate::flow::Flow::runand its concrete impls. - Loop
Verdict - 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.