Workflows
Build complex multi-step agent workflows
Workflows chain agents, conditions, and loops into powerful automation pipelines.
Quick Start
- Linear Workflow
rust use praisonai::{Agent, workflow}; let writer = Agent::new().name("Writer").build()?; let editor = Agent::new().name("Editor").build()?; let flow = workflow() .then(writer) .then(editor); flow.run("Write about AI").await?; - With Conditions
rust use praisonai::{workflow, when}; let flow = workflow() .then(researcher) .when(|result| result.len() > 100) .then(summarizer) .then(publisher);
Workflow Patterns
Research → Write → Edit
use praisonai::workflow;
let content_pipeline = workflow()
.then(researcher) // Research the topic
.then(writer) // Write the content
.then(editor) // Edit and polish
.then(reviewer); // Final reviewWith Validation Loop
use praisonai::{workflow, r#loop};
let validated_pipeline = workflow()
.then(generator)
.then(r#loop(validator)
.until(|r| r.contains("approved"))
.max_iterations(3));Best Practices
Start simple
Build linear workflows first, add branching later.
Give each step a clear purpose
Name agents by their role in the workflow.