Skip to main content

Agent

Trait Agent 

Source
pub trait Agent<S>: Send + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn run(&mut self, state: S, ctx: &mut Ctx) -> StepResult<S>;
}
Expand description

A sync agent that transforms state one step at a time.

Implement this trait on your own structs and register them into a crate::Workflow to build a pipeline.

Required Methods§

Source

fn name(&self) -> &'static str

A unique name for this agent, used for routing with Outcome::Next.

Source

fn run(&mut self, state: S, ctx: &mut Ctx) -> StepResult<S>

Run one step. Returns the updated state and an Outcome that tells the runner what to do next.

Implementors§