Skip to main content
Pass work from one agent to the next when each step depends on the previous output.
from praisonaiagents import Agent, AgentFlow

researcher = Agent(name="Researcher", instructions="Research topics")
analyst = Agent(name="Analyst", instructions="Analyze research findings")
writer = Agent(name="Writer", instructions="Write based on analysis")
flow = AgentFlow(steps=[researcher, analyst, writer])
flow.start("AI trends in 2024")
The user chains agents in order; each step receives the prior output until the final result is ready.

Sequential Workflow

Pass work from one agent to the next, like an assembly line.

How Context Flows

Each agent receives the previous output automatically.

When to Use


Code

from praisonaiagents import Agent, AgentFlow

researcher = Agent(name="Researcher", instructions="Research topics")
analyst = Agent(name="Analyst", instructions="Analyze research findings")
writer = Agent(name="Writer", instructions="Write based on analysis")

# Sequential: researcher → analyst → writer
flow = AgentFlow(steps=[researcher, analyst, writer])
result = flow.start("AI trends in 2024")

Example: Blog Post Pipeline

StepAgentReceivesOutputs
1ResearcherTopicFacts, data
2AnalystFactsKey insights
3WriterInsightsDraft article
4EditorDraftPolished post

With Callbacks

from praisonaiagents import AgentFlow, WorkflowHooksConfig

flow = AgentFlow(
    steps=[researcher, analyst, writer],
    hooks=WorkflowHooksConfig(
        on_step_complete=lambda name, r: print(f"✅ {name} done")
    )
)

Parallel

All at once (faster)

Routing

Send to specialists