What Are Sub-agents?

AI Summary

What it is: Sub-agents are smaller, task-focused AI agents that a main agent delegates specific work to — running in parallel or sequence, each with its own context, then reporting results back.

Who it’s for: Developers and AI-curious users who use agent frameworks (Claude Code, Cursor, LangGraph, etc.) and want to understand multi-agent architectures.

Best if: You’re building or using an AI agent and the task is too complex or too long for one agent to handle in one context window.

Skip if: You only use AI through a chat interface for one-off prompts — sub-agents are an agent-architecture concept.

What are sub-agents?

A sub-agent is a smaller AI agent that a main agent calls to handle a specific piece of a larger task. Think of the main agent as a project manager and sub-agents as specialists: the main agent reads the overall request, decides which parts need which specialist, dispatches each part to a sub-agent, collects the results, and assembles the final answer.

The key technical reason sub-agents exist: each sub-agent runs in its own context window. The main agent doesn’t have to load every detail of every sub-task into its own context — it just gets the summarized result. This lets one agent system handle tasks that no single agent could fit in one context.

When do you use sub-agents?

Three patterns where sub-agents are the right design:

  • Long research tasks. A main agent dispatches sub-agents to read each source in parallel, then synthesizes the results. Faster and less context-bloated than reading everything serially.
  • Multi-domain work. A main agent dispatches a coding sub-agent for the code part, a writing sub-agent for the prose part, a data-analysis sub-agent for the numbers part — each with prompts tuned to its domain.
  • Tasks that exceed one agent’s context window. When the full input is too big for one model, sub-agents handle chunks and return summaries that fit.

How are sub-agents different from tool calls?

A tool call invokes a specific function (search, calculator, code-runner) and returns a deterministic result. A sub-agent invokes another agent with its own model, system prompt, and reasoning process — and returns a generative result. Tool calls are mechanical; sub-agent calls are themselves intelligent.

Most real agent systems use both: sub-agents for intelligent delegation, tool calls inside each sub-agent for the mechanical work.

Where do you actually see sub-agents in practice?

Three places sub-agents are common in 2026:

  • Claude Code (Anthropic’s terminal coding tool) supports custom sub-agents you define with their own prompts, tools, and contexts. See our Claude Code hooks and plugins guide.
  • LangGraph and LlamaIndex agent frameworks in Python build multi-agent graphs where each node is a sub-agent.
  • Research and writing agents like the agents behind Perplexity Deep Research dispatch sub-agents to read source documents in parallel.

Frequently asked questions

Are sub-agents the same as multi-agent systems?
Closely related. A multi-agent system has multiple agents collaborating, often peer-to-peer. Sub-agents specifically refers to the hierarchical pattern where a main agent dispatches to subordinates.

Do sub-agents use the same model as the main agent?
They can, but often don’t. A common pattern is using a frontier model (Opus, GPT-5) as the main coordinator and cheaper, faster models (Haiku, Sonnet) for sub-agents that handle bounded sub-tasks.

How is this different from just prompting one agent with a long prompt?
Context isolation. Each sub-agent has its own context window, so the main agent doesn’t carry the full text of every sub-task. This lets agent systems scale to tasks that wouldn’t fit in a single context.

Get Smarter About AI Every Morning

Free daily newsletter — one story, one tool, one tip. Plain English, no jargon.

Free forever. Unsubscribe anytime.

Sources

You might also like

Two ways to go further

The AI Prompt Library

1,000+ ready-to-use prompts for Claude, ChatGPT, and Gemini. Stop staring at a blank box.

Get it for $39 →

2-Hour Live AI Crash Course

A private, beginner-friendly session across Claude, ChatGPT, Gemini, and the wider landscape.

Book for $125 →

Discover more from Beginners in AI

Subscribe now to keep reading and get access to the full archive.

Continue reading