Skip to main content

Parallel Workflow

Run multiple agents at the same time instead of waiting for each one.

Speed Comparison

SequentialParallel
Time3 seconds~1 second
Speed1x3x faster

When to Use


Code

from praisonaiagents import Agent, AgentFlow
from praisonaiagents import parallel

# Create agents
ai_researcher = Agent(name="AI", instructions="Research AI trends")
ml_researcher = Agent(name="ML", instructions="Research ML trends")
nlp_researcher = Agent(name="NLP", instructions="Research NLP trends")
summarizer = Agent(name="Summary", instructions="Combine all research")

# Run in parallel, then summarize
flow = AgentFlow(steps=[
    parallel([ai_researcher, ml_researcher, nlp_researcher]),
    summarizer
])

result = flow.start("Research latest developments")

How Results Combine