pub enum Composable {
Agent(AgentBuilder),
Pipeline(Pipeline),
FanOut(FanOut),
Loop(Loop),
Fallback(Fallback),
}Expand description
A composable workflow node — can be sequenced, fan-out, looped, etc.
Variants§
Agent(AgentBuilder)
A single agent node.
Pipeline(Pipeline)
A sequential pipeline of steps.
FanOut(FanOut)
A parallel fan-out of branches.
Loop(Loop)
A loop with optional termination predicate.
Fallback(Fallback)
A fallback chain (try each until one succeeds).
Implementations§
Source§impl Composable
impl Composable
Sourcepub fn compile(self, llm: Arc<dyn BaseLlm>) -> Arc<dyn TextAgent>
pub fn compile(self, llm: Arc<dyn BaseLlm>) -> Arc<dyn TextAgent>
Compile this composable tree into an executable TextAgent.
Recursively compiles the tree: pipelines become SequentialTextAgent,
fan-outs become ParallelTextAgent, loops become LoopTextAgent,
fallbacks become FallbackTextAgent, and agents compile via
AgentBuilder::build().
let pipeline = AgentBuilder::new("writer").instruction("Write a draft")
>> AgentBuilder::new("reviewer").instruction("Review and improve");
let agent = pipeline.compile(llm);
let result = agent.run(&state).await?;Source§impl Composable
impl Composable
Sourcepub fn middleware(self, composite: MiddlewareComposite) -> Self
pub fn middleware(self, composite: MiddlewareComposite) -> Self
Attach middleware to a Loop or Fallback node — the place where
combinator-level observers (M::on_loop, M::on_fallback) live.
For other node kinds (single agent, pipeline, fan-out) this is a no-op:
attach M:: middleware to the agent itself via
AgentBuilder::middleware instead.
Source§impl Composable
impl Composable
Sourcepub fn first_step(&self) -> Option<&Composable>
pub fn first_step(&self) -> Option<&Composable>
The first step of a Pipeline, or None if this is not a pipeline
(or the pipeline is empty).
Sourcepub fn last_step(&self) -> Option<&Composable>
pub fn last_step(&self) -> Option<&Composable>
The last step of a Pipeline, or None if this is not a pipeline
(or the pipeline is empty).
Sourcepub fn nth_step(&self, n: usize) -> Option<&Composable>
pub fn nth_step(&self, n: usize) -> Option<&Composable>
The nth step of a Pipeline, or None if this is not a pipeline
or the index is out of bounds.
Sourcepub fn pipeline_steps(&self) -> Option<&[Composable]>
pub fn pipeline_steps(&self) -> Option<&[Composable]>
All steps of a Pipeline, or None if this is not a pipeline.
Sourcepub fn fan_out_branches(&self) -> Option<&[Composable]>
pub fn fan_out_branches(&self) -> Option<&[Composable]>
The branches of a FanOut, or None if this is not a fan-out.
Sourcepub fn loop_predicate(&self) -> Option<&LoopPredicate>
pub fn loop_predicate(&self) -> Option<&LoopPredicate>
The termination predicate of a Loop, or None if this is not a loop
(or the loop has no predicate).
Sourcepub fn loop_body(&self) -> Option<&Composable>
pub fn loop_body(&self) -> Option<&Composable>
The body of a Loop, or None if this is not a loop.
Sourcepub fn fallback_candidates(&self) -> Option<&[Composable]>
pub fn fallback_candidates(&self) -> Option<&[Composable]>
The candidates of a Fallback chain, or None if this is not a fallback.
Trait Implementations§
Source§impl BitOr<AgentBuilder> for Composable
Composable | AgentBuilder → FanOut (flattening)
impl BitOr<AgentBuilder> for Composable
Composable | AgentBuilder → FanOut (flattening)
Source§type Output = Composable
type Output = Composable
| operator.Source§impl BitOr for Composable
Composable | Composable → FanOut (flattening)
impl BitOr for Composable
Composable | Composable → FanOut (flattening)
Source§type Output = Composable
type Output = Composable
| operator.Source§impl Clone for Composable
impl Clone for Composable
Source§fn clone(&self) -> Composable
fn clone(&self) -> Composable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Composable
impl Debug for Composable
Source§impl Div<AgentBuilder> for Composable
Composable / AgentBuilder → Fallback (flattening)
impl Div<AgentBuilder> for Composable
Composable / AgentBuilder → Fallback (flattening)
Source§type Output = Composable
type Output = Composable
/ operator.Source§impl Div for Composable
Composable / Composable → Fallback (flattening)
impl Div for Composable
Composable / Composable → Fallback (flattening)
Source§type Output = Composable
type Output = Composable
/ operator.Source§impl From<AgentBuilder> for Composable
impl From<AgentBuilder> for Composable
Source§fn from(b: AgentBuilder) -> Self
fn from(b: AgentBuilder) -> Self
Source§impl From<Fallback> for Composable
impl From<Fallback> for Composable
Source§impl From<FanOut> for Composable
impl From<FanOut> for Composable
Source§impl From<Loop> for Composable
impl From<Loop> for Composable
Source§impl From<Pipeline> for Composable
impl From<Pipeline> for Composable
Source§impl Mul<LoopPredicate> for Composable
Composable * until(pred) → conditional Loop
impl Mul<LoopPredicate> for Composable
Composable * until(pred) → conditional Loop
Source§type Output = Composable
type Output = Composable
* operator.Source§impl Mul<u32> for Composable
Composable * 3 → Loop(max=3)
impl Mul<u32> for Composable
Composable * 3 → Loop(max=3)
Source§impl Shr<AgentBuilder> for Composable
Composable >> AgentBuilder → Pipeline (flattening)
impl Shr<AgentBuilder> for Composable
Composable >> AgentBuilder → Pipeline (flattening)
Source§type Output = Composable
type Output = Composable
>> operator.Source§impl Shr<Composable> for AgentBuilder
AgentBuilder >> Composable → Pipeline (flattening)
impl Shr<Composable> for AgentBuilder
AgentBuilder >> Composable → Pipeline (flattening)
Source§type Output = Composable
type Output = Composable
>> operator.Source§impl Shr for Composable
Composable >> Composable → Pipeline (flattening)
impl Shr for Composable
Composable >> Composable → Pipeline (flattening)
Source§type Output = Composable
type Output = Composable
>> operator.