Agent Process
Understanding agent workflows and processes
Process defines how agents work together – the order, flow, and coordination of tasks.
Quick 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:
team = AgentTeam(
agents=[researcher, analyst, writer],
process="sequential"
)Parallel
Agents work at the same time:
Set 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:
manager = 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.