Phase 16: Multi-Agent & Swarms

Why Multi-Agent?

One agent hits a wall. The smart move is not a bigger agent - it is more agents. Identify the single-agent ceiling (context overflow, mixed expertise, sequential bottleneck) and explain when splitting into multiple agents is the right move. Compare orchestration patterns (pipeline, parallel fan-out, supervisor, hierarchical) and select the right one for a given task structure. Design a multi-agent system with clear role boundaries, shared state, and a communication contract. Analyze the tradeoffs of multi-agent complexity (latency, cost, debugging difficulty) versus single-agent simplicity. You built a single agent in Phase 14. It works. It can read files, run commands, call APIs, and reason about results. Then you point it at a real codebase: 200 files, three languages, tests that depend on infrastructure, and a requirement to research external APIs before writing code. The agent chokes. Not because the LLM is dumb, but because the task exceeds what one agent loop can handle. The context window fills up with file contents. The agent forgets what it read 40 tool calls ago. It tries to be a researcher, a coder, and a reviewer all at once, and does all three poorly. This is the single-agent ceiling. You hit it every time a task requires: More context than fits in one window - reading 50 files blows past 200k tokens. Different expertise…

Why Multi-Agent?: One agent hits a wall. The smart move is not a bigger agent - it is more agents. Identify the single-agent ceiling (context overflow, mixed…

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.