Workflows

Understanding workflow patterns for multi-agent systems

Pick a workflow pattern and connect agents so they share context across steps.

python
from praisonaiagents import Agent, AgentFlow

researcher = Agent(name="Researcher", instructions="Research topics.")
writer = Agent(name="Writer", instructions="Write clear summaries.")
flow = AgentFlow(steps=[researcher, writer])
flow.start("Explain workflow patterns in one paragraph.")

The user chooses a pattern, configures agents, and submits a task that flows through the team.

Diagram

Workflows

📋 Task

🤖 Agent Team

✅ Result

Quick Start

  1. Simple Usage

    Chain two agents so the second builds on the first.

    python
    from praisonaiagents import Agent, AgentFlow
    
    researcher = Agent(name="Researcher", instructions="Research topics.")
    writer = Agent(name="Writer", instructions="Write clear summaries.")
    flow = AgentFlow(steps=[researcher, writer])
    flow.start("Explain workflow patterns in one paragraph.")
  2. With Configuration

    Run independent agents together with the top-level parallel primitive.

    python
    from praisonaiagents import Agent, AgentFlow, parallel
    
    ai = Agent(name="AI", instructions="Research AI trends")
    ml = Agent(name="ML", instructions="Research ML trends")
    summary = Agent(name="Summary", instructions="Combine research")
    flow = AgentFlow(steps=[parallel([ai, ml]), summary])
    flow.start("Research latest developments")

How It Works

Diagram
AgentAgentFlowUserAgentAgentFlowUserstart(“task”)Run each step in orderStep output feeds the nextFinal result

Workflows

Workflows define how multiple agents work together to complete a task. Just like a team of people in an office, agents can collaborate in different ways depending on the task.

What is a Workflow?

Think of a workflow as a recipe that tells your agents:

  • Who does what
  • In what order
  • How they share information
Diagram

Workflow = Recipe for Agents

📋 Task

🤖 Agent 1

🤖 Agent 2

✅ Result

The Four Main Patterns


Which Pattern Should I Use?

I want to…Use this pattern
Send requests to different specialistsRouting
Do multiple independent things at onceParallel
Process step-by-step (A → B → C)Sequential
Let an AI decide how to break down workOrchestrator

Real-World Examples

Example 1: Customer Support Bot

A customer asks: “Why is my order delayed?”

PatternHow it works
RoutingClassify the question → Send to Shipping Agent
SequentialLookup Order → Check Status → Write Response

Example 2: Research Report

You ask: “Create a report on AI trends”

PatternHow it works
ParallelResearch AI + Research ML + Research NLP (all at once)
SequentialResearch → Analyze → Write → Edit (step by step)
OrchestratorManager assigns: “You research, you analyze, you write”

Two Ways to Build Workflows

PraisonAI offers two approaches:

ApproachClassBest for
Deterministic PipelinesAgentFlowYou define exactly what happens
Dynamic DelegationAgentTeam + hierarchicalAI manager decides

Best Practices

Match the pattern to the task shape

Independent subtasks fit parallel; ordered steps fit sequential; expert routing fits routing. Choosing the shape first keeps flows simple.

Use AgentFlow for deterministic pipelines

AgentFlow(steps=[...]) runs exactly the steps you list. Reach for AgentTeam + hierarchical only when you want an AI manager to decide.

Import primitives from the top level

from praisonaiagents import parallel (and when, loop) uses the friendly re-exports, so samples stay short and portable.


Next Steps