Multi-agent Systems
Multi-agent Systems
A single agent is powerful. A team of agents — each with specialised roles, working in parallel or in sequence — is more powerful still. Multi-agent systems are becoming a standard pattern for tackling complex, long-horizon tasks.
Why Multiple Agents?
A single agent faces practical limits:
Context window: a complex task might generate more reasoning and tool output than fits in one context window.
Parallelisation: some tasks can be broken into independent subtasks that run simultaneously. A single agent must execute sequentially.
Specialisation: different agents can be optimised for different roles — a planner, a coder, a reviewer, a researcher — each with the right tools, system prompt, and model for its task.
Error checking: one agent's output can be independently reviewed by another, catching mistakes before they propagate.
Reliability: if one agent fails, the orchestrator can retry or route around it.
Common Multi-agent Patterns
Orchestrator → Workers: a planning agent breaks a task into subtasks and dispatches them to specialised worker agents. The orchestrator collects results and assembles the final output.
Pipeline: agent A produces output that becomes input for agent B, which passes to agent C. Each agent specialises in one transformation.
Parallel fan-out: a task is sent to multiple agents simultaneously, each attacking it from a different angle. Results are compared or merged.
Critic/reviewer: one agent produces output, another reviews and critiques it, the first revises based on feedback. Iterates until the reviewer is satisfied.
Debate: two agents argue opposing positions, with a judge agent deciding. Useful for complex decisions or stress-testing reasoning.
Challenges and Guardrails
Multi-agent systems amplify both capabilities and failure modes:
Cost: each agent is making API calls. A complex multi-agent system might make dozens or hundreds of calls per task. Budget carefully.
Debugging: when something goes wrong, it can be hard to trace the failure through multiple agent handoffs. Good logging and tracing are essential.
Trust boundaries: should one agent blindly follow instructions from another? A compromised or misbehaving agent in a chain can cascade. Apply the same prompt injection vigilance between agents as between users and agents.
Stopping conditions: agents need clear criteria for when they're done. Without good stopping conditions, agent loops can run indefinitely.
Human oversight: complex, long-running multi-agent tasks benefit from checkpoints where a human can review progress and course-correct.
Sign up free to take the quiz, earn XP, and track your progress.