Agent Process
Understanding agent workflows and processes
Process defines how agents work together – the order, flow, and coordination of tasks.
graph LR
subgraph "Process Types"
Seq[📋 Sequential<br/>One by one]
Par[⚡ Parallel<br/>All at once]
Hier[👔 Hierarchical<br/>Manager + workers]
end
classDef seq fill:#8B0000,stroke:#7C90A0,color:#fff
classDef par fill:#189AB4,stroke:#7C90A0,color:#fff
classDef hier fill:#2E8B57,stroke:#7C90A0,color:#fff
class Seq seq
class Par par
class Hier hierQuick Start
from praisonaiagents import Agent, AgentTeam
researcher = Agent(instructions="Research the topic")
writer = Agent(instructions="Write the content")
team = AgentTeam(
agents=[researcher, writer],
process="sequential" # Options: sequential, workflow, hierarchical
)
team.start()Process Types
Sequential
Agents work one after another:
graph LR
subgraph "Sequential Process"
A[🔍 Research] --> B[📊 Analyze] --> C[✍️ Write] --> D[✅ Done]
end
classDef step fill:#189AB4,stroke:#7C90A0,color:#fff
classDef done fill:#2E8B57,stroke:#7C90A0,color:#fff
class A,B,C step
class D doneteam = AgentTeam(
agents=[researcher, analyst, writer],
process="sequential"
)Parallel
Agents work at the same time:
graph TB
subgraph "Parallel Process"
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 resultSet async_execution=True on each Task inside a workflow (or sequential) process to fan out work in parallel:
import asyncio
from praisonaiagents import Agent, Task, PraisonAIAgents
team = PraisonAIAgents(
agents=[agent1, agent2, agent3],
tasks=[
Task(description="First task", agent=agent1, async_execution=True),
Task(description="Second task", agent=agent2, async_execution=True),
Task(description="Third task", agent=agent3, async_execution=True),
],
process="workflow" # parallel fan-out via async_execution on tasks
)
# Use the async entry point — sync .start() runs these sequentially and warns
asyncio.run(team.astart())Hierarchical
A manager coordinates workers:
graph TB
subgraph "Hierarchical Process"
Manager[👔 Manager] --> W1[🤖 Worker 1]
Manager --> W2[🤖 Worker 2]
W1 --> Manager
W2 --> Manager
Manager --> Result[✅ Result]
end
classDef manager fill:#8B0000,stroke:#7C90A0,color:#fff
classDef worker fill:#189AB4,stroke:#7C90A0,color:#fff
classDef result fill:#2E8B57,stroke:#7C90A0,color:#fff
class Manager manager
class W1,W2 worker
class Result resultmanager = Agent(instructions="Coordinate the team")
worker1 = Agent(instructions="Handle research")
worker2 = Agent(instructions="Handle writing")
team = AgentTeam(
agents=[manager, worker1, worker2],
process="hierarchical"
)Complete Example
from praisonaiagents import Agent, AgentTeam
# Create specialized agents
researcher = Agent(
name="Researcher",
instructions="Research topics and gather facts",
web=True
)
analyst = Agent(
name="Analyst",
instructions="Analyze data and find insights"
)
writer = Agent(
name="Writer",
instructions="Write clear, engaging content"
)
# Sequential process - research → analyze → write
team = AgentTeam(
agents=[researcher, analyst, writer],
process="sequential",
output="verbose" # See what's happening
)
result = team.start("Create a report on AI trends")Choosing a Process
| Process | When to Use | Example |
|---|---|---|
| Sequential | Steps depend on each other | Research → Write → Edit |
Parallel (via async_execution=True tasks, async entry point required) | Independent tasks | Analyze 3 different topics |
| Hierarchical | Need coordination | Manager assigns tasks |
Best Practices
Start Sequential
Easiest to understand and debug
Clear RolesEach agent has one specific job
Enable VerboseUse output="verbose" to see progress
Test each agent before combining
Next: Knowledge Bases
Learn how to give agents access to documents and data.