Multi-Agent Systems
How multiple agents can work together
Multiple agents working together can solve complex problems that one agent can’t handle alone.
graph LR
subgraph "Multi-Agent Team"
Task[📋 Task] --> A1[🔍 Researcher]
A1 --> A2[📊 Analyst]
A2 --> A3[✍️ Writer]
A3 --> Result[✅ Result]
end
classDef task fill:#8B0000,stroke:#7C90A0,color:#fff
classDef agent fill:#189AB4,stroke:#7C90A0,color:#fff
classDef result fill:#2E8B57,stroke:#7C90A0,color:#fff
class Task task
class A1,A2,A3 agent
class Result resultQuick 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:
graph LR
subgraph "Sequential"
A[🔍 Research] --> B[📊 Analyze] --> C[✍️ Write]
end
classDef step fill:#189AB4,stroke:#7C90A0,color:#fff
class A,B,C stepfrom 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:
graph TB
subgraph "Parallel"
Task[📋 Task] --> A[🔍 Agent 1]
Task --> B[📊 Agent 2]
Task --> C[✍️ Agent 3]
A --> Result[✅ Combined]
B --> Result
C --> Result
end
classDef task fill:#8B0000,stroke:#7C90A0,color:#fff
classDef agent fill:#189AB4,stroke:#7C90A0,color:#fff
classDef result fill:#2E8B57,stroke:#7C90A0,color:#fff
class Task task
class A,B,C agent
class Result resultRun 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:
graph TB
subgraph "Hierarchical"
Manager[👔 Manager] --> W1[🤖 Worker 1]
Manager --> W2[🤖 Worker 2]
Manager --> W3[🤖 Worker 3]
end
classDef manager fill:#8B0000,stroke:#7C90A0,color:#fff
classDef worker fill:#189AB4,stroke:#7C90A0,color:#fff
class Manager manager
class W1,W2,W3 workerteam = 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:
graph LR
subgraph "Communication"
A1[🤖 Agent 1] -->|Output| A2[🤖 Agent 2]
A2 -->|Output| A3[🤖 Agent 3]
end
classDef agent fill:#189AB4,stroke:#7C90A0,color:#fff
class A1,A2,A3 agent| 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.