Sub-agents

Summary

  • A sub-agent is a delegated AI worker that handles one focused subtask under a main agent.

Key Points

  • Main agent coordinates the full task; sub-agents execute scoped pieces (for example tests, docs, refactor, research).
  • Benefits: clearer scope, possible parallel execution, and easier result review before merge.
  • Sub-agent support is usually a product/runtime capability, not only a model capability.
  • The same model may have sub-agent support in one client and no explicit sub-agent feature in another.
  • If explicit sub-agents are unavailable, use a single agent with phase-based prompts to simulate delegation.

Examples

  • Pattern: main agent creates workers for tests, docs, and bugfix, then combines outputs.
  • In toolchains with agent orchestration: planner agent delegates independent tasks in parallel.
  • In toolchains without sub-agents: run sequential phases (analyze implement validate) in one session.
  • AI/General/Skills
  • AI/OpenAI/Usage of OpenAI
  • AI/Claude Code/Usage of Claude Code