Multi-Agent Systems
How multiple agents can work together
Multiple agents working together can solve complex problems that one agent can’t handle alone.
Quick Start
from praisonaiagents import Agent, AgentTeam
# Create specialized agents
researcher = Agent(instructions="Research topics thoroughly")
writer = Agent(instructions="Write clear summaries")
# Combine into a team
team = AgentTeam(agents=[researcher, writer])
team.start()Why Multiple Agents?
Each agent is an expert at one thing
Complex TasksBreak big problems into smaller pieces
Better ResultsSpecialists produce higher quality work
ScalabilityAdd more agents as needed
Workflow Patterns
Sequential (Pipeline)
Agents work one after another:
from praisonaiagents import Agent, AgentTeam
researcher = Agent(instructions="Research the topic")
analyst = Agent(instructions="Analyze the research")
writer = Agent(instructions="Write the final report")
team = AgentTeam(
agents=[researcher, analyst, writer],
process="sequential" # One after another
)
team.start()Parallel
Agents work at the same time:
Run agents at the same time by setting async_execution=True on each Task inside a workflow (or sequential) process, and start the team with await team.astart() — the sync team.start() runs them sequentially and warns:
import asyncio
from praisonaiagents import Agent, Task, AgentTeam
team = AgentTeam(
agents=[agent1, agent2, agent3],
tasks=[
Task(description="First analysis", agent=agent1, async_execution=True),
Task(description="Second analysis", agent=agent2, async_execution=True),
Task(description="Third analysis", agent=agent3, async_execution=True),
],
process="workflow" # parallel fan-out via async_execution on tasks
)
asyncio.run(team.astart()) # async entry point — sync .start() would run sequentially and warnHierarchical
A manager delegates to workers:
team = AgentTeam(
agents=[manager, worker1, worker2],
process="hierarchical"
)Complete Example
from praisonaiagents import Agent, AgentTeam
# Research agent with web search
researcher = Agent(
name="Researcher",
instructions="Find the latest information on the topic",
web=True # Can search the web
)
# Analyst agent
analyst = Agent(
name="Analyst",
instructions="Analyze findings and identify key insights"
)
# Writer agent
writer = Agent(
name="Writer",
instructions="Create a clear, engaging summary"
)
# Create the team
team = AgentTeam(
agents=[researcher, analyst, writer],
process="sequential"
)
# Run the team
result = team.start("Research AI trends in 2025")
print(result)Agent Communication
Agents share information automatically:
| Method | Description |
|---|---|
| Output Passing | One agent’s result → next agent’s input |
| Shared Memory | All agents access common memory |
| Context | Agents see what others have done |
Best Practices
Start with 2-3 Agents
Don’t overcomplicate. Add more agents only when needed.
Clear Roles
Each agent should have one specific job.
Sequential First
Start with sequential, then try parallel if needed.
Test Each Agent
Make sure each agent works alone before combining.
Next: Agent Process
Learn about different workflow processes.