Ninja Builder Sign in Get started

AI agent teams and subagents, explained

What subagents and agent teams are, when splitting the work pays off, and what it really costs.

By Ninja Builder team5 min read
Title card reading AI agent teams and subagents, explained, beside a Ninja Builder chat with background work running

Key takeaways

  • A subagent is a helper with its own fresh context that returns only a summary.
  • Teams help with noisy, independent or review work, and hurt on small or tightly coupled edits.
  • Every helper uses tokens from the same plan; agent teams can use several times more than one session.
  • Start with a scout, a builder and a checker, and give helpers cheaper models where that is enough.

An AI agent team is a lead agent that splits a job into parts and hands them to helper agents, often called subagents. Each helper starts with its own fresh context, does one task (search the code, write the change, run the checks) and sends back a short summary. Teams help when the work is noisy, independent or needs a second pair of eyes. They cost more tokens, so for small tasks one agent is usually the better choice.

This explainer covers the terms, how it works in practice in Claude Code and similar tools, when a team pays off, and how to keep the cost under control.

Agent, subagent, team: the terms

  • Agent: a model working in a loop with tools. It reads files, runs commands, looks at the result and decides the next step, until the task is done or it needs you.
  • Subagent: an agent that another agent starts for a specific task. In Anthropic's words, each subagent "runs in its own context window with a custom system prompt, specific tool access, and your permission rules." When it finishes, only its result returns to the main chat.
  • Agent team or multi-agent workflow: several agents coordinated on one job, in parallel or one after another. Claude Code's experimental agent teams feature, for example, runs several full Claude Code sessions that a lead session supervises.

Different tools use different names (helpers, workers, background agents), but the idea is the same: split the work so each agent has a small, focused context.

Diagram: a lead agent in your chat hands tasks to three helpers, a scout that reads code and returns facts, a builder that makes the change, and a checker that runs tests and returns pass or fail, each with its own context window
A common shape: one lead, a scout, a builder and a checker.

Why split the work at all?

The main reason is context. A single agent that searches fifty files, reads a long test log and then writes code carries all of that in its context for the rest of the conversation. Every later turn rereads it, and the important details get buried. A helper can do the noisy part and return three lines.

The other reasons:

  • Parallel work. Independent tasks, such as researching two libraries or building two unrelated pages, can run at the same time.
  • Fresh eyes. A reviewer that did not write the code has no stake in it and is more likely to spot problems. Our guide on reviewing AI-generated code uses the same idea.
  • Limits per role. A search helper can be read-only. A reviewer does not need permission to push to Git.
  • Cheaper models where they are enough. A helper that only searches can run on a smaller, cheaper model.

How it works in Claude Code

Claude Code ships with built-in subagents, including Explore (a fast, read-only agent for searching a codebase), Plan (gathers context in plan mode) and a general-purpose agent. You can add your own as Markdown files in .claude/agents/ for one project or ~/.claude/agents/ for all of them. Only name and description are required:

---
name: test-runner
description: Runs the test suite and reports only the failures
tools: Read, Grep, Bash
model: haiku
---

Run the project's tests. Report each failing test with its file,
the assertion that failed and one line on the likely cause.
Do not edit any files.

The main agent decides when to delegate based on the description, or you can ask for a helper by name. The full list of fields is in Anthropic's subagent docs.

Agent teams go one step further: several separate sessions working together under a lead. At the time of writing they are disabled by default and switched on with the CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS setting. Other agents have similar ideas under their own names, so check your tool's docs for what it supports today.

What it costs

Helpers are not free. Each one starts from scratch, loads your rules files and tools, and reads whatever files it needs, even if the main agent already read them. Anthropic's docs say subagent requests count toward the same usage limits as your main conversation, and that agent teams use roughly seven times more tokens than a standard session when teammates run in plan mode.

So a team trades tokens for focus and speed. That trade is good on large, separable jobs and poor on small ones. A one-line fix done by a team of four costs several times more than the same fix done directly, with no better result.

Ninja Builder Activity panel, Agents tab, showing a four-agent workflow: a researcher done at 180k tokens, a developer building the pricing page at 410k tokens, a phone check at 96k tokens and a queued code reviewer
Per-agent token counts make the cost of each role visible while a workflow runs.

When a team helps, and when it hurts

Good fit for a teamBetter with one agent
A feature touching many files, with a clear planA small fix or a one-file change
Research across many sources or a large codebaseA question the agent can answer from one file
Independent pieces that can run in parallelEdits that all touch the same few files
An independent review or test pass at the endExploratory work where the goal keeps changing

Tightly coupled edits are the classic trap. Two agents changing the same file at the same time produce conflicts, and the lead spends more tokens merging than the split saved. Some tools reduce this by giving each builder its own Git worktree on a separate branch.

How to keep a team lean

  1. Start small. One scout, one builder and one checker covers most jobs. Add a role only when you can say in one line why it is needed.
  2. Write short briefs. Everything in a helper's brief sits in its context from the first turn. Give the goal, the files, and what "done" means.
  3. Pick the model per role. Searching and running tests rarely need the biggest model.
  4. Check once, at the end. A builder that runs the full test suite after every file pays for the same output again and again.
  5. Stop helpers that are done. An idle teammate can keep using tokens until it exits.
  6. Watch the numbers. Look at token use per agent, not just the total, and cut the roles that cost much and add little.

More ways to save are in how to reduce token usage when coding with AI.

Agent teams in Ninja Builder

Ninja Builder is built around this idea: a team of agents plans, builds and checks the work in your project folder. The Background work tray and the Activity panel show each running workflow and agent with its token count and status. A switch can run background and workflow agents on Sonnet while your chat keeps its own model, and the bell tells you once when a single workflow passes 10M tokens and again at 25M. Workflows start lean on purpose: one scout, one builder and one checker, and each agent has to state why its role is needed. The Watch background work docs explain the details, and the demo below shows it in action.

Ninja Builder: AI Agent Desktop App for Claude Code, ChatGPT & Gemini

It runs on Mac, Windows and Linux with the AI accounts you already have. Download Ninja Builder and try it free for 14 days.

Frequently asked questions

What is a subagent in Claude Code?

A specialised helper the main agent can start for one task. It runs in its own context window with its own prompt, tools and model, and returns only its result to your chat.

Do subagents use more tokens?

Yes. Each one loads its own context and reads files again, and Anthropic's docs say their requests count toward the same usage limits as your main conversation.

How do I create a custom subagent?

Add a Markdown file to .claude/agents/ in your project or ~/.claude/agents/ for all projects, with a name and description in the frontmatter and its instructions below.

When should I not use an agent team?

For small fixes, single-file changes and exploratory work where the goal keeps shifting. One agent is cheaper and avoids conflicts between helpers editing the same files.

Keep reading