Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Parallel Workflow
Run multiple agents at the same time instead of waiting for each one.
Speed Comparison
| Sequential | Parallel |
|---|
| Time | 3 seconds | ~1 second |
| Speed | 1x | 3x 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
Failure Handling
Choose how parallel execution responds to failures.
Strategy Examples
from praisonaiagents import WorkflowStepError
# Default: Continue with partial results
flow = AgentFlow(steps=[
parallel([agent_a, agent_b, agent_c]), # Some might fail
summarizer # Gets whatever succeeded
])
# Stop fast: First failure cancels others
flow = AgentFlow(steps=[
parallel([agent_a, agent_b, agent_c], on_failure="fail_fast"),
# This step never runs if any agent fails
])
# Fail all: Wait for everything, then report errors
try:
flow = AgentFlow(steps=[
parallel([agent_a, agent_b, agent_c], on_failure="fail_all"),
])
result = flow.start("Process")
except WorkflowStepError as e:
print(f"Failed agents: {len(e.errors)}")
Sequential
One step at a time
Routing
Send to the right expert