---
title: "Subagents"
description: "Split complex work across parallel agents."
---

A single agent works linearly and wastes time on parallelizable subtasks. Subagents let them start together.

## How it works

The main agent uses `spawn_agent` to hand a subtask to a fresh agent instance, carries on with something else, then consolidates the results.

## When it helps

- The task splits into independent pieces (research three libraries at once)
- You want several separate outputs (a summary per module)
- A broad search where fan-out meaningfully cuts the wait

## Keep in mind

Each subagent costs its own tokens and context. They work within their own boundaries, and the main agent integrates their output rather than handing you a pile of fragments.
