Glossary

Hierarchical agents

A multi-agent design that arranges AI agents in layers, with coordinators breaking work down for the agents below them and summarising results back up.

Hierarchical agents are a multi-agent design in which AI agents are arranged in layers, like an organisation chart. A top-level agent holds the overall goal and breaks it into large parts, mid-level agents break those parts into tasks and manage the agents below them, and the agents at the bottom do the concrete work. Results flow back up the tree, getting more condensed at each level, until the top-level agent can assemble the final answer.

How hierarchical agents work

The structure extends the supervisor agent pattern by nesting it. A single supervisor coordinates one team of workers. In a hierarchy, some of those workers are themselves supervisors with their own teams. Each agent only talks to its parent and its direct children, so no agent has to hold the whole task in its context window.

Information moves in two directions. Going down, each level turns a broad goal into narrower instructions through task decomposition: “review this acquisition” becomes “review the commercial contracts”, which becomes “check these twenty contracts for change-of-control clauses”. Going up, each level turns detailed results into summaries: twenty contract reviews become a list of three problem contracts, which becomes one line in a risk summary. The top of the tree reasons about goals and trade-offs, the bottom reasons about specifics, and each level in between translates.

Each layer usually works on a different time scale and holds a different kind of state. The top level keeps the goal, the plan and the overall status. Middle levels keep the plan for their branch and the outputs of their workers. Leaf agents keep only what they need for one task and typically run as subagents that start fresh and end when they return.

The idea is older than LLM agents. Hierarchical task network planning in classical AI and hierarchical reinforcement learning both split decisions into levels of abstraction for the same reason: a single flat planner struggles when a task has too many steps. LLM frameworks such as LangGraph and CrewAI let you build the same shape by nesting supervisor graphs or crews inside each other.

When a hierarchy helps

Hierarchies earn their cost on tasks that are too big for one coordinator. A single supervisor with forty workers has the same problem as a single agent with forty tools: its context fills with results, its plan gets long and its routing gets worse as context rot and the lost in the middle effect set in. Splitting the forty workers into four teams of ten, each with its own lead, keeps every coordinator’s context manageable.

They also help when the task has natural divisions. A software migration might split by service, a due diligence review by contract category, a market report by region. Giving each division its own lead lets you tune that branch separately: a different system prompt, different tools, a different model, different agent permissions. A branch that only reads documents can be given read-only tools, in line with least privilege, while the branch that writes the final report gets write access to one folder.

Finally, hierarchies suit long-running agents. When a task runs for hours or days, branches can progress independently, fail and retry independently, and report partial results as they finish, rather than waiting for one long sequence to complete.

Hierarchical agents compared with other patterns

Pattern

Shape

Coordination

Good fit

Single agent

One agent, many tools

None needed

Most tasks; the default to start with

Subagents

One parent, temporary helpers

Parent delegates and waits

Isolated searches and reviews

Supervisor

One coordinator, one team

Central routing

Multi-stage tasks with a handful of specialists

Hierarchical agents

Tree of coordinators and teams

Central at each level

Very large tasks with natural divisions

Agent handoff

Chain of agents

Control passes along

Routing conversations to specialists

Agent swarm

Network of peers

Emergent, no centre

Open-ended exploration

The single-agent vs multi-agent entry covers the first and most important choice in that list. Most teams that end up with a hierarchy started with one agent, moved to a supervisor when it outgrew one context, and added a layer only when the supervisor in turn became the bottleneck.

Trade-offs

Cost and latency multiply with depth. Every coordinator adds model calls for planning, routing and summarising, and every level adds a round trip. A three-level tree can easily spend more tokens on coordination than on the work itself. Using smaller models for routing and summarising, and keeping the tree as shallow as the task allows, limits this.

Errors compound. A misread instruction at the top sends a whole branch in the wrong direction, and a leaf’s mistake can be summarised away before anyone notices. Each level should ask its children for evidence, such as document IDs, page numbers or file paths, alongside conclusions, so that claims can be checked from the top without redoing the work. Agent evaluation at each level, not only on the final output, shows where quality drops.

Goal drift is the subtler problem. As instructions are rewritten at each level, the original intent can blur. Passing the top-level goal and its constraints down unchanged, alongside each level’s specific instruction, keeps every agent anchored.

Span of control is the other design lever. A coordinator with two children adds a level of cost for little gain, and one with twenty children faces the same overload the hierarchy was meant to fix. In practice, three to eight children per coordinator tends to keep both the plan and the incoming results small enough to reason about, though the right number depends on how much each child returns and how often the coordinator has to step in.

Observability gets harder with every layer. Agent tracing that records the tree of calls, with each agent’s input, output and parent, turns a confusing failure into a path you can follow. Agent observability tooling that can show nested runs is close to essential beyond two levels.

Durability matters once runs are long. If a branch fails halfway through, you want to resume it, not restart the whole tree. Frameworks with checkpointing or a durable execution layer handle this; the best durable execution for AI agents roundup compares the options.

A worked example

A legal team uses agents to support a due diligence review of a company it is acquiring. The data room holds around 400 contracts, plus board minutes and financial statements.

The top-level agent receives the goal, “identify material risks in the target’s contracts”, along with the deal’s constraints, such as the planned closing date and the jurisdictions involved. It splits the work into four branches: commercial contracts, employment agreements, intellectual property and real estate. Each branch gets a lead agent and the list of documents in its category.

The commercial lead splits its 180 contracts into batches and starts a reviewer for each batch. Each reviewer reads its contracts, checks for change-of-control clauses, exclusivity, unusual termination rights and liability caps, and returns findings with the contract name and page number for each issue. The commercial lead merges these, removes duplicates, ranks issues by severity and reports the top items with references. The other branches do the same for their categories in parallel.

The top-level agent receives four ranked lists, not 400 reviews. It writes the risk summary, flags two issues that appear in more than one branch, and sends the draft to a lawyer for review, because the legal judgement belongs to a person. The agents provide the reading and the references; the conclusions are reviewed and owned by the legal team. The due diligence and legal agents use cases cover this kind of work in more detail.

Where Exabase fits

Exabase does not build the hierarchy; your agent framework does. Exabase provides the shared document layer, search and memory that every level of the tree reads from and writes to, so that agents pass references to each other instead of copying content up and down.

Putting the corpus in a Base gives all agents in the tree one isolated workspace (creating Bases). Documents go in through Extract, which returns text chunks with page numbers and, for recognised contracts, structured fields such as parties, effective date, governing law and clauses (about extraction). That gives leaf agents structured input rather than raw PDFs, which is the job described in file extraction and contract extraction.

Leaf agents then use Deep Search to find the passages that answer their question, with a page number on each result, so every finding that travels up the tree carries a reference that a person can check. That is what makes source attribution survive several rounds of summarising. Deep Search returns the specific passage rather than a topically similar chunk, which is the problem covered under RAG accuracy.

Agents at each level can write their outputs as notes through Resources: batch findings, branch summaries, the draft report. Those agent artifacts are searchable, auditable and stay after the run ends, so a lawyer can trace a line in the summary back to the batch review and then to the page. Exabase Memory can hold the facts every level should respect, such as the deal’s constraints and the client’s priorities, so each agent retrieves them by query rather than receiving them in every instruction.

For long runs with many writers, turning on snapshots for the Base records how resources change, so you can see what a branch moved, renamed or deleted and recover it, as described in agent undo. Snapshots cover resource metadata, not file content.

Frequently asked questions

What is the difference between hierarchical agents and a supervisor agent?

A supervisor agent coordinates one team. Hierarchical agents nest that arrangement, so some workers are supervisors of their own teams. A hierarchy is a tree of supervisors; a single supervisor is a tree with one level.

How many levels should a hierarchy have?

As few as the task allows. Two levels, a coordinator and workers, cover most cases. Add a third only when the coordinator has too many workers or too much output to manage well. Each level adds cost, latency and another place for errors.

Do hierarchical agents cost more?

Usually, yes. Every coordinator adds model calls for planning and summarising. The cost is worth it when the task is too large for one context and splits into parallel branches; for smaller tasks, a single agent or one supervisor is cheaper.

How do results get back to the top?

Each level summarises its children’s results and passes the summary up, ideally with references such as document IDs or page numbers. Storing full results outside the agents, for example as notes in a shared workspace, lets higher levels read detail only when they need it.

How do I debug a hierarchy of agents?

Trace every call with its parent, input and output so you can follow a result back through the tree. Evaluate each level separately, and require evidence with every finding so errors can be located without re-running the whole tree.

Are hierarchical agents the same as an agent swarm?

No. A hierarchy has clear parents and children and central control at each level. A swarm has no fixed structure; agents coordinate as peers and behaviour emerges from their interactions.

Which frameworks support hierarchical agents?

LangGraph supports nesting supervisor graphs, CrewAI supports hierarchical processes with manager agents, and most frameworks with tool calling can express the pattern. The best AI agent frameworks roundup compares them.

Related pages: Supervisor agent, Subagents, Multi-agent, Orchestration, Agent swarm, Task decomposition, Multi-agent coordination use case, CrewAI vs AutoGen, Agent infrastructure will consolidate, Knowledge base solution.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.