Skip to main content
Process types define how agents execute tasks in a team - sequentially, in parallel, or hierarchically.

Quick Start

1

Sequential Pipeline

use praisonai::{Agent, AgentTeam, Process};

// Create specialized agents
let researcher = Agent::new()
    .name("Researcher")
    .instructions("Research the given topic thoroughly")
    .build()?;

let writer = Agent::new()
    .name("Writer")
    .instructions("Write a clear article based on the research")
    .build()?;

// Build team with sequential process
let team = AgentTeam::new()
    .agent(researcher)
    .agent(writer)
    .process(Process::Sequential)
    .build();

// Run the pipeline
let result = team.start("Write about quantum computing").await?;
println!("{}", result);
2

Parallel Execution

use praisonai::{Agent, AgentTeam, Process};

// Agents work simultaneously on the same task
let analyzer1 = Agent::new()
    .name("Analyzer1")
    .instructions("Analyze from perspective A")
    .build()?;

let analyzer2 = Agent::new()
    .name("Analyzer2")
    .instructions("Analyze from perspective B")
    .build()?;

let team = AgentTeam::new()
    .agent(analyzer1)
    .agent(analyzer2)
    .process(Process::Parallel)
    .build();

// Both agents run concurrently
let combined = team.start("Analyze this dataset").await?;

User Interaction Flow


Process Enum

pub enum Process {
    Sequential,   // default
    Parallel,
    Hierarchical,
}

Process Types

TypeDescriptionUse Case
SequentialAgents run one after another, each receiving previous outputPipelines, step-by-step workflows
ParallelAgents run concurrently on the same taskMulti-perspective analysis, speed
HierarchicalManager delegates to workersComplex coordination, validation

AgentTeam

pub struct AgentTeam {
    agents: Vec<Arc<Agent>>,
    process: Process,
    verbose: bool,
}

Builder Methods

MethodSignatureDescription
new()fn new() -> AgentTeamBuilderCreate builder
agent(a)fn agent(self, Agent) -> SelfAdd agent
process(p)fn process(self, Process) -> SelfSet process type
verbose(b)fn verbose(self, bool) -> SelfEnable logging
build()fn build(self) -> AgentTeamBuild team

Runtime Methods

MethodSignatureDescription
start(task)async fn start(&self, &str) -> Result<String>Run team on task
run(task)async fn run(&self, &str) -> Result<String>Alias for start
len()fn len(&self) -> usizeNumber of agents

Sequential Process

Each agent runs in order, receiving the previous agent’s output as context:
use praisonai::{Agent, AgentTeam, Process};

let step1 = Agent::new()
    .name("Step1")
    .instructions("First processing step")
    .build()?;

let step2 = Agent::new()
    .name("Step2")
    .instructions("Use previous output for next step")
    .build()?;

let pipeline = AgentTeam::new()
    .agent(step1)
    .agent(step2)
    .process(Process::Sequential)
    .verbose(true)
    .build();

let result = pipeline.start("Initial input").await?;

Parallel Process

All agents work simultaneously on the same input, results are combined:
use praisonai::{Agent, AgentTeam, Process};

let fast_analyzer = Agent::new().name("Fast").build()?;
let deep_analyzer = Agent::new().name("Deep").build()?;

let team = AgentTeam::new()
    .agent(fast_analyzer)
    .agent(deep_analyzer)
    .process(Process::Parallel)
    .build();

// Both agents run concurrently
let combined = team.start("Analyze this").await?;

Best Practices

When each agent needs the previous agent’s output - research → write → edit.
When agents can work simultaneously - multiple perspectives, speed optimization.
Use .verbose(true) to see workflow execution details.
3-5 agents typically works well. Split larger workflows into multiple teams.