Hierarchical coordination delegates bounded deliverables to workers while a manager preserves the overall goal. The manager owns decomposition, dependencies, shared constraints, plan revision, integration, acceptance, and the stop decision. Workers execute locally and return evidence or exceptions. section 8.5
Use a hierarchy when deliverables depend on one another and evidence may require the plan to change. It differs from fan-out/gather, where a coordinator merges comparable results from independent branches of one stage. A hierarchy can contain chains, parallel branches, and review loops within its larger plan. section 8.5 section 8.5.3
Make each delegation boundary explicit:
- Pass the shared objective, relevant interfaces, expected artifact, and acceptance criteria. Identify dependencies and permitted tools. section 8.5.2 section 8.5
- Have workers report deliverables, evidence, and exceptions. Validate artifacts before publishing them to shared state or allowing dependent work to proceed. section 8.5 section 8.5.3
- Enforce tool and permission limits in the runtime; role instructions alone do not bound a worker's actions. section 8.5.2
Listing 8.5 Manager-owned delegation and dependencies (patterns/hierarchical_delegation.py)
@dataclass(frozen=True)
class DelegationRequest:
task_id: str
description: str
depends_on: tuple[str, ...]
acceptance: str
tools: tuple[str, ...]
result_path: str
@dataclass(frozen=True)
class DelegationReceipt:
task_id: str
status: str
result_path: str = ""
reason: str = ""
class ManagerWorker:
"""The manager owns dependencies, replanning, and integration."""
def __init__(
self,
spawner: SubagentSpawner,
workspace: SharedWorkspace,
) -> None:
self.spawner = spawner
self.workspace = workspace
add_tool = self.spawner.add_tool
add_tool("delegate", self.delegate) #A
def delegate(
self,
request: DelegationRequest,
) -> DelegationReceipt:
task = ManagedTask(
request.task_id,
request.description,
request.depends_on,
request.acceptance,
result_path=request.result_path,
)
self.workspace.tasks[task.task_id] = task
incomplete = [
dependency
for dependency in task.depends_on
if self.workspace.tasks.get(dependency) is None
or self.workspace.tasks[dependency].status != "completed"
]
if incomplete: #B
task.status = "blocked"
return DelegationReceipt(
task.task_id,
task.status,
reason=f"Waiting for {', '.join(incomplete)}",
)
task.status = "running"
worker = AgentSpec(
name=f"worker-{task.task_id}",
instructions=(
"Produce the bounded deliverable and evidence for its "
"acceptance criterion."
),
tools=request.tools,
)
result = self.spawner.spawn(
worker,
task=task.description,
goal=task.description,
parent_id="manager",
payload={
"depends_on": task.depends_on,
"acceptance": task.acceptance,
"result_path": task.result_path,
},
)
self.workspace.write_file(task.result_path, result.text)
task.status = "completed"
return DelegationReceipt(
task.task_id,
task.status,
result_path=task.result_path,
)
def execute(self, goal: str) -> AgentResult:
manager_tools = ( #C
"delegate",
"read_board",
"read_file",
)
manager = AgentSpec(
name="manager",
instructions=(
"Keep the whole goal. Use delegate to create bounded "
"tasks, respect dependencies, inspect returns, and "
"integrate the accepted artifacts."
),
tools=manager_tools,
)
owner = "manager" #D
return self.spawner.spawn(
manager,
task=goal,
goal=goal,
parent_id="user",
payload={"integration_owner": owner},
)
The delegation request and receipt illustrate explicit dependencies, acceptance criteria, tool access, result paths, and status reporting. section 8.5.2
A manager with an incomplete view
In Manager Devin, managers could become overly prescriptive without repository context. Child agents sometimes assumed shared state, while discoveries did not automatically reach the manager or siblings. Explicit reporting keeps the evolving plan connected to worker evidence. section 8.5
A weak decomposition can direct capable workers toward the wrong goal; a locally successful task can still break another deliverable's interface. Inspect the plan before expensive work, validate integration boundaries, and let workers challenge assignment premises. Retry or replan failed nodes rather than passing weak artifacts downstream. section 8.5.3
Compare the hierarchy with a credible single-agent baseline. Measure task outcomes first, then inspect plan revisions, blocked tasks, invalid assumptions, integration rework, tokens, and critical-path latency. section 8.10 section 8.5


