Hierarchical Agents
also known as Manager-Worker Tree, Agent Hierarchy
Organise agents in a tree where higher-level agents decompose tasks for lower-level agents, recursively.
This pattern helps complete certain larger patterns —
- specialisesOrchestrator-Workers★★— An orchestrator dynamically breaks a task into subtasks at runtime and delegates each to a worker LLM, then synthesises results.
Context
A team is working with tasks that decompose recursively across several levels — a market research project breaks into vertical-specific research, each vertical breaks into specific information-gathering steps; a software project breaks into epics, tickets, and individual edits. At each level the right next step is different in kind, not just in detail. A single supervisor cannot meaningfully reason about every leaf at once.
Problem
A flat supervisor pattern, where one coordinating agent dispatches to a list of specialists, scales poorly as the list grows. The supervisor's prompt grows with the number of specialists, recall on which specialist to call drops, and any new vertical forces an edit to the root prompt. The supervisor ends up trying to think simultaneously at the level of the whole project and the level of individual specialist tasks, which neither it nor any other agent does well.
Forces
- Tree depth trades latency for clarity.
- Inter-level communication needs a contract.
- Failure recovery: which level retries?
Example
A consulting firm builds a market-research agent with one supervisor and twenty specialist tools: data-fetch, summarise, compare, draw-chart, and so on. As they add specialists for new verticals, the supervisor prompt balloons and the agent starts forgetting which tool to call. They restructure as hierarchical-agents: a root research-manager dispatches to vertical managers (healthcare, fintech), each of whom dispatches to leaf specialists for their domain. Depth and breadth are both capped, and adding a new vertical no longer touches the root prompt.
Diagram
Solution
Therefore:
Each non-leaf agent receives a task, decomposes it, and dispatches sub-tasks to its children. Children may be specialists (leaves) or further managers. Results bubble up; each manager synthesises its children's outputs. Bounded depth and breadth prevent runaway hierarchies.
What this pattern forbids. An agent communicates only with its parent and children; cross-tree communication is forbidden.
The smaller patterns that complete this one —
- generalisesSupervisor★★— Place a coordinating agent above a set of specialised agents and route work to them.
- generalisesAgent-as-Tool Embedding★— Wrap a sub-agent (with its own loop, prompt, and tool palette) behind a single function-shaped tool signature, so the parent agent calls it like any other tool and never sees the sub-agent's internal turns.
And the patterns that stand alongside it, or against it —
- complementsGoal Decomposition★★— Decompose a goal into sub-goals recursively until each leaf is directly actionable.
- complementsHybrid HTN + Generative Agent★— Hierarchical Task Network decomposition provides the procedural backbone; the generative LLM is invoked only at leaf nodes for the parts of the task that are genuinely open-ended.
- complementsOne Tool, One Agent★— Design agent systems as a team of narrow single-purpose agents, each owning one tool or one capability, rather than a single super-agent that handles every tool — the agent analogue of microservices over monolith.
- complementsBehavior Tree Back Chaining·— Construct an agent's behavior tree starting from the desired goal condition and recursively adding child nodes whose post-conditions satisfy each parent's pre-conditions.
- alternative-toPartial Global Planning·— Each agent maintains a partial view of others' plans and incrementally merges local plans into a shared partial global plan, interleaving coordination with execution.
Neighbourhood
Click any neighbour to follow the language. Scroll to zoom, drag to pan.