---
title: "What Is a Subagent?"
description: "A subagent is a specialised AI agent a main agent delegates a task to, running in its own context window with its own prompt and tools, returning a summary."
type: "glossary"
locale: "en"
term: "Subagent"
canonical: "https://agenticschool.dev/glossary/subagent"
dateModified: "2026-06-13"
---

# What Is a Subagent?

- Definition: Subagent
- Updated: 2026-06-13
- Keywords: subagent, what is a subagent, subagent definition, claude code subagents, ai agent delegation
- Canonical URL: https://agenticschool.dev/glossary/subagent
- Locale: en

> A subagent is a specialised AI agent a main agent delegates a task to, running in its own context window with its own prompt and tools, returning a summary.

A subagent is a specialised AI agent that a main agent delegates a focused task to, running in its own separate context window with its own system prompt and its own scoped set of tools. Instead of one agent doing everything in a single conversation, the main agent hands off a job (review this code, research this topic, run these tests) to a subagent, which does the work in isolation and returns only a clean summary. This keeps the main conversation uncluttered and lets each subagent be tuned to do one thing well.

## How subagents work

When the main agent spawns a subagent, the subagent starts fresh: it sees only its own system prompt and the delegation message, not the entire history of the main session. It works with a narrow toolset and permissions, completes its task, and passes back a short result. Because its context is isolated, all the noisy intermediate work (search results, logs, file dumps) stays out of the main agent context window.

- Separate context window: the subagent does not inherit the whole main conversation.
- Custom system prompt: a short, focused brief tuned to its single job.
- Scoped tools and permissions: only what that task needs, often read-only.

## Why subagents help

The big win is context hygiene. A side task that would flood your main session with output (reading dozens of files, scanning logs) instead happens in the subagent and returns just the summary, so the main agent stays focused and the context window does not fill up. A focused brief also makes the subagent more reliable on its specialised task than a single agent juggling everything.

## A concrete example

In Claude Code you can define a "code reviewer" subagent with a read-only toolset and a short review brief. After the main agent writes a feature, it delegates the review to that subagent, which inspects the diff in its own context and returns a concise list of issues. The main agent then fixes them, never having loaded the full review reasoning into its own window.

## FAQ

### What is a subagent in AI?

A subagent is a specialised AI agent that a main agent delegates a focused task to. It runs in its own context window with its own system prompt and scoped tools, does the work in isolation, and returns a short summary.

### Why use a subagent instead of one agent?

To keep the main context window clean and to specialise. A subagent does noisy side work (reading files, searching, reviewing) in its own context and returns only the result, so the main agent stays focused and behaves more reliably.

### Does a subagent share the main agent context?

No. A subagent runs in a separate context window and sees only its own system prompt and the delegation message, not the full main conversation. That isolation is the whole point: it prevents context bloat.

### How is a subagent different from a tool call?

A tool call runs a single function and returns data. A subagent is a full agent: it can reason, make many tool calls of its own and iterate, all in its own context, before handing a summary back to the main agent.
