Skip to main content

06. Multi-Agent Systems

Hierarchical Multi-Agent Systems

A hierarchical multi-agent system stacks authority: top managers set goals, mid-level leads own domains, and leaf workers execute with scoped tools. Work and budgets flow down; status, results, and escalations flow up. Use hierarchy when flat supervisor–worker spans get too wide — not as decoration.

What you will learn

  • Define hierarchical MAS vs flat supervisor–worker
  • Design 2–3 levels with clear ownership
  • Specify rollup reports and escalation paths
  • Know when hierarchy is overkill
  • Answer interview questions with short, solid answers
Top manager to domain leads to leaf workers hierarchy
Interview staple: hierarchy = assign down, report up, escalate by policy.

Definition

A hierarchical multi-agent system (hierarchical MAS) organizes agents into levels of authority. Higher agents decompose goals and assign to lower agents; lower agents return structured results; exceptions escalate upward when local handling fails or policy requires it.

Flat supervisor–worker is hierarchy of depth one. True hierarchical MAS adds mid-level leads that run their own worker pools — useful when domains (billing, fulfillment, research) need independent planning and local joins before a global rollup. Module 05 introduced the pattern shape; this lesson is the Module 06 systems view.

Introduction

This lesson closes Module 06 (Multi-Agent Systems). You have MAS basics, architecture, communication, delegation, supervisors, specialties, and debate — hierarchy composes them at scale.

Module 07 starts frameworks. Next: LangChain Fundamentals (Chains, Agents, Tools, Memory).

Why add levels

  • Span of control - one supervisor cannot usefully track 20 workers
  • Domain ownership - leads keep context local
  • Permission zones - different tool policies per subtree
  • Escalation clarity - who decides when a leaf fails

Flat vs hierarchical

Start flat. Promote a lead only when a cluster of workers shares a subdomain that needs its own plan/join cycle.

Flat supervisor-worker versus hierarchical MAS with mid leads
Hierarchy earns its keep when mid-levels own real subdomains — not vanity titles.
  • Flat - one planner, many leaves, one join
  • Hierarchical - managers of managers, local joins, then rollup
  • Cost - each level adds latency and tokens
  • Rule - depth ≤ 3 for most products unless proven otherwise

Levels and responsibilities

  • Top manager - global goal, budgets, cross-domain plan, human interface
  • Domain leads - subdomain plans, dispatch workers, local integrate
  • Workers - scoped tools, structured reports, no silent scope expand
  • Shared contracts - job schemas, status enums, escalation codes

Information flow

  • Down - goals, contracts, allowlists, budgets, deadlines
  • Up - progress, results, risks, blocked reasons
  • Sideways - rare; prefer go-up-then-across via leads to avoid chat meshes
  • Rollup - leads summarize; tops should not ingest raw worker traces by default

Escalation path

Handle failures at the lowest level that has authority. Escalation is a feature, not a panic button for every warning.

Worker to lead to top manager to human escalation path
Local retry → lead replan → top cross-domain decision → human on risk/ethics/budget.
  • Worker - retry within contract / report blocked
  • Lead - reassign, replan subdomain, adjust local budget
  • Top - resolve cross-domain conflicts, reallocate spend
  • Human - risk, ethics, legal, or exhausted automated budget

Failure modes

  • Hierarchy theater - empty mid-levels with no schemas or authority
  • God top - still holds all write tools; defeats isolation
  • Report floods - tops drowning in raw worker logs
  • Escalation storms - everything bubbles up; define severity gates
  • Deep trees - latency and lost context; prefer shallow wide where possible

Program / implementation notes

Model an org tree: Node { role, parent_id, allowlist, children[] }. Each non-leaf runs a supervisor loop over its children. Cap depth and fan-out in config.

  • Compose: leads can run debate or evaluator loops inside a domain
  • Trace parent_job_id → child_job_id for every assign
  • Module 07 next: LangChain Fundamentals (Chains, Agents, Tools, Memory)

Advantages and limitations

  • Advantage: scales ownership across nested domains
  • Advantage: clearer escalation and permission zones
  • Advantage: local joins reduce top-level noise
  • Limitation: more moving parts than flat crews
  • Limitation: bad mid-level plans waste whole subtrees
  • Limitation: over-depth kills latency budgets

Key points

  • Hierarchical MAS = stacked authority; goals down, reports up.
  • Flat supervisor–worker is depth-one hierarchy — start there.
  • Add mid-leads only for real subdomain ownership.
  • Keep tops thin on write tools; summarize upward.
  • Escalation follows severity: worker → lead → top → human.
  • Cap depth and fan-out; avoid hierarchy theater.

FAQs

Is hierarchical MAS the same as a company org chart copy?

Only if each level has real contracts, tools, and join duties. Copying job titles without authority is hierarchy theater.

How deep should the tree be?

Usually 2–3 levels. Deeper trees need strong justification on span-of-control and domain nesting.

Can leaf workers talk across domains?

Prefer escalation to leads who coordinate. Unrestricted cross-talk recreates a chat mesh and loses hierarchy benefits.

How does this relate to Module 05 hierarchical patterns?

Same idea. Module 05 framed the design pattern; this lesson covers systems concerns — levels, rollups, escalation, and when to stay flat.

Interview questions

  1. What is a hierarchical multi-agent system?

    Answer A MAS organized in authority levels where higher agents assign goals downward and lower agents report results and escalate upward by policy.

  2. How does it differ from flat supervisor–worker?

    Answer Flat has one planner over leaf workers. Hierarchy adds mid-level leads that own subdomains, run local joins, then roll up.

  3. When do you introduce mid-level leads?

    Answer When span of control is too wide or distinct domains need their own plans, tool policies, and local integration.

  4. Describe a healthy escalation path.

    Answer Worker retries/reports → lead replans/reassigns → top resolves cross-domain issues → human on risk, ethics, or budget exhaustion.

  5. Name a hierarchy failure mode.

    Answer Hierarchy theater — mid-levels with titles but no schemas/authority — or a god top that still holds every write tool.

  6. What should flow up the tree?

    Answer Structured status, results, risks, and blocked reasons — summarized by leads — not raw worker traces by default.

Related topics

Practice task

Complete each numbered practice step in a notebook or doc before opening the next lesson.

  1. Sketch a 3-level hierarchy for an e-commerce ops agent (top, 2 leads, 4 workers); name each node.
  2. List tools per level (top should be thinnest on writes).
  3. Write escalation rules for “payment failure” vs “missing product copy.”
  4. Justify in 3 bullets why this should not stay flat — or why it should.
  5. Answer interview questions 1, 2, and 4 in two sentences each.