0PricingLogin
Claude Architect · Lesson

The Task Tool & allowedTools

Spawning subagents and granting the Task capability.

Why Subagents Exist

A single agent that does everything keeps too much in its head: history, half-finished subtasks, and verbose tool output all compete for attention. Subagents let a coordinator break a big job into focused pieces and hand each piece to a fresh worker.

The Agent SDK exposes this through one capability: the Task tool. When a coordinator calls Task, the SDK spins up a subagent with its own clean context to handle one delegated unit of work, then returns the result to the coordinator.

This is the foundation of the hub-and-spoke multi-agent pattern: one coordinator at the hub, many specialized subagents on the spokes.

The Coordinator's Job

In hub-and-spoke, the coordinator never does the detailed work itself. It owns five responsibilities:

  • Decompose the request into independent tasks
  • Delegate each task to a subagent via Task
  • Aggregate the returned results
  • Route follow-up work based on what came back
  • Handle errors, including partial results

To delegate at all, the coordinator must be allowed to use the Task tool. If Task is missing from its allowedTools, it cannot spawn anything and will try to do everything alone.

All lessons in this course

  1. Agent SDK Building Blocks
  2. Defining an Agent
  3. The Task Tool & allowedTools
  4. Principle of Least Privilege
← Back to Claude Architect