F5.5 F5

Sub-Agents: Coordinator Delegates, Specialists Execute

Multi-agent systems in the Agent SDK follow a clear pattern: a coordinator decides what needs to happen, sub-agents do the actual work. The coordinator has the Task tool for delegation. Sub-agents have role-specific tools for execution.

AgentDefinition: the sub-agent blueprint

Sub-agents are defined through AgentDefinition objects with three key fields:

  • description — explains the agent’s purpose. The coordinator reads this to decide which sub-agent fits a given task.
  • system_prompt — behavioral instructions specific to this role. A researcher agent has different instructions than an analyst agent.
  • allowed_tools — capability restrictions. A researcher gets WebSearch + Read. An analyst gets Read + Grep. Each sub-agent has only the tools it needs.

Sub-agents do not inherit the coordinator’s configuration. Each AgentDefinition specifies its own system_prompt and allowed_tools independently. This is intentional — role-specific specialization requires role-specific configuration.

The Task tool: how delegation works

The coordinator needs "Task" in its allowed_tools to spawn sub-agents. Without Task, the coordinator cannot delegate, even if AgentDefinitions are provided.

The pattern:

  1. Coordinator has allowed_tools=["Task", ...] and a list of AgentDefinitions
  2. Coordinator analyzes the incoming request
  3. Coordinator uses the Task tool to delegate subtasks to the appropriate sub-agent
  4. Sub-agent executes with its own tools and returns results
  5. Coordinator synthesizes results

Why restrict sub-agent tools?

Giving every sub-agent every tool defeats the purpose. If both the researcher and analyst have WebSearch + Read + Grep, there’s no structural boundary between their roles. The researcher might start analyzing instead of searching. The analyst might start searching instead of analyzing.

Tool restrictions enforce role boundaries. The researcher cannot do detailed code analysis because it doesn’t have Grep. The analyst cannot do web searches because it doesn’t have WebSearch. This is structural specialization, not prompt-based suggestions that the model might ignore.

Coordinator vs sub-agent: the structural difference

The coordinator orchestrates through the Task tool — it decides what needs doing and who should do it. Sub-agents execute through role-specific tools — they do the specialized work. Same model can power both, but their tool configurations make their roles fundamentally different.

You don’t need a “more powerful” model for the coordinator. The difference is in configuration (Task tool vs specialized tools), not model capability.


One-liner: Sub-agents are defined through AgentDefinition with their own system_prompt and allowed_tools — the coordinator needs Task in its tools to delegate, and each sub-agent gets only the tools its role requires.