Parallel Execution

Run multiple agents simultaneously

Run agents in parallel for faster results on independent tasks.

Diagram

Parallel Execution

Start

🤖 Agent 1

🤖 Agent 2

🤖 Agent 3

✅ Combine

Quick Start

  1. Parallel Agents
    rust
    use praisonai::parallel;
    
    let results = parallel([
        researcher.chat("Research topic A"),
        researcher.chat("Research topic B"),
        researcher.chat("Research topic C"),
    ]).await?;
    
    // All three run simultaneously
  2. Parallel Teams
    rust
    use praisonai::{AgentTeam, Process};
    
    let team = AgentTeam::new()
        .agent(researcher)
        .agent(analyst)
        .agent(writer)
        .process(Process::Parallel)
        .build();
    
    // All agents work simultaneously

When to Use Parallel

Diagram

Use When

Independent tasks

✅ Use Parallel

Dependent tasks

❌ Use Sequential

Task TypeUse Parallel?
Research 3 topics✅ Yes
Translate to 5 languages✅ Yes
Write then edit❌ No
Research then summarize❌ No

Best Practices

Only parallelize independent tasks

If task B needs task A’s output, use sequential.

Watch API rate limits

Parallel calls may hit rate limits faster.


Related