The Core Idea: The shape of a team matters. Sequential chains are simple, parallel teams are fast, a supervisor adds control, a hierarchy scales to big jobs, and peer-to-peer networks give flexibility at the price of many messages.
- Beginner: Sequential Agents
In a sequential architecture, agents work one after another like a production line. The output of one agent is the input of the next: research, then write, then review.
Use when: Each step truly needs the result of the previous one.
- Beginner: Parallel Agents
In a parallel architecture, independent tasks go to several agents at the same time, and their results are combined afterwards (fan-out, then fan-in).
In the code: The six subtasks take 23 seconds in sequence but only 10 seconds with three parallel workers.
Needs: Tasks that do not depend on each other, and a way to merge the results without conflicts.
- Medium: Supervisor Agents
A supervisor agent receives the goal, splits it into tasks, delegates them to worker agents, collects the results and synthesizes the final answer. Workers do not need to know about each other.
Benefit: One place for control, checks and error handling.
Cost: The supervisor is a bottleneck and a single point of failure, and it adds overhead. In the code the supervisor design takes 15 seconds, 5 more than pure parallel, because of planning, delegation and synthesis.
- Medium: Hierarchical Agents
For very large jobs one supervisor cannot manage everything. In a hierarchy, a top-level agent manages team leads, and each lead manages its own workers. It mirrors how companies are organized.
Fair comparison: In the code the hierarchy finishes in 9 seconds, faster than the 10-second parallel design, but it used six workers instead of three, and it sends the most messages among the manager designs. More workers cost more.
- Advanced: Peer-to-Peer Agents and How to Choose
In a peer-to-peer (network) design, any agent can message any other without a central manager. It is flexible and has no single bottleneck, but messages grow fast: with agents, one round of everyone talking to everyone is messages.
| Architecture | Time (s) | Messages | Best for |
|---|---|---|---|
| Sequential | 23 | 5 | Strictly ordered steps |
| Parallel | 10 | 12 | Independent tasks |
| Supervisor | 15.0 | 12 | Control and quality checks |
| Hierarchical | 9.0 | 16 | Large jobs, small contexts per manager |
| Peer-to-peer | 10.0 | 24 | Open-ended collaboration and debate |
Choose the simplest shape that works. Sequential or supervisor designs cover most real needs. Peer-to-peer designs are the hardest to predict and debug.
- Visual Explanation: Five Team Shapes Compared
The figure lists the five architectures with the time and message numbers from the code, then summarizes what each trade-off buys you.
Click to see why the hierarchy is faster hereCompare ▼
Part 1 shows time and message count per design for the same six tasks. Part 2 lists the main trade-offs. Open the bar for an important caveat about the hierarchy.
- Python Implementation: A Simple Model of Time and Messages
This script computes the completion time and the number of messages for the same six subtasks under five architectures: sequential, parallel, supervisor, hierarchical and peer-to-peer. It is a simplified model with fixed overheads, meant to show the trade-offs.
# Compare multi-agent architectures on the same six subtasks (durations in seconds)tasks = [4, 3, 5, 2, 6, 3]workers = 3 def makespan(durations, n_workers): loads = [0] * n_workers for d in durations: loads[loads.index(min(loads))] += d # give the task to the least busy worker return max(loads) def sequential(): return sum(tasks), len(tasks) - 1 # each step hands over to the next def parallel(): return makespan(tasks, workers), len(tasks) * 2 # each task: start message and result message def supervisor(): plan, delegate, synthesize = 1.0, 0.5, 1.0 time = plan + delegate * len(tasks) + makespan(tasks, workers) + synthesize return time, len(tasks) * 2 def hierarchical(): team_a, team_b = tasks[:3], tasks[3:] time = 1.0 + 1.0 + max(makespan(team_a, 3), makespan(team_b, 3)) + 1.0 # top planner, team lead, work, merge return time, 2 * 2 + len(tasks) * 2 def peer_to_peer(agents=4, rounds=2): return makespan(tasks, agents) + rounds * 1.0, agents * (agents - 1) * rounds # everyone talks to everyone print("Architecture".ljust(14), "time (s)".ljust(10), "messages")for name, fn in [("sequential", sequential), ("parallel", parallel), ("supervisor", supervisor), ("hierarchical", hierarchical), ("peer-to-peer", peer_to_peer)]: time, msgs = fn() print(name.ljust(14), str(time).ljust(10), msgs)Sequential is slowest but sends the fewest messages. Parallel is fast. The supervisor adds control overhead. The hierarchy and peer-to-peer designs are quick but use more workers or many more messages. The numbers come from the assumptions in the code, so change them and observe.
Knowledge Check
Key Points
The Big Picture
Order for dependencies, parallel for speed, a supervisor for control, a hierarchy for scale
The best team shape is the simplest one that meets your quality and speed needs.
Up Next: Once you pick a shape, something has to run it. In Multi-Agent Orchestration you will study routing, delegation, coordination and shared state.