Glossary

Subagents

An AI agent that another agent starts to handle one part of a larger task, working in its own context and returning a short result.

A subagent is an AI agent that another agent starts to handle one part of a larger task. The parent, often called the lead or orchestrator, writes the subagent a brief, gives it a fresh context window and a set of tools, and waits for a short result. The subagent does its work in isolation, so the reading, searching and dead ends it goes through never land in the parent’s context. Only the answer comes back.

How subagents work

The pattern has four steps, and most frameworks follow them in roughly the same order. First the parent breaks the task down and decides that some piece of it is self-contained enough to hand off. A coding agent might decide that finding every caller of a function is a separate job from changing it. A research agent might split a question into five sub-questions that can be answered independently.

Second, the parent writes a brief. This is the single most important input the subagent receives, because it starts with nothing else: no conversation history, no memory of what the parent has already tried, no idea why the task matters. A good brief states the goal, the scope, what “done” looks like, the format of the answer and anything the subagent must not do. A vague brief such as “look into the billing bug” produces a vague result.

Third, the subagent runs its own agent loop. It reasons, calls tools through function calling, reads results and repeats until it has an answer or hits a limit. It may read fifty files or run twenty searches. All of that stays inside its own context.

Fourth, the subagent returns a summary, and the parent carries on. The parent sees a few hundred tokens of findings instead of the tens of thousands of tokens the subagent consumed to produce them. In most implementations the subagent then ends and its context is discarded.

Claude Code is a widely used example. Its subagents are defined as files with their own system prompt, tool list and model setting, and the main agent can delegate to them by name. The OpenAI Agents SDK offers a similar shape through agents exposed as tools, and LangGraph lets you build the same structure as a graph with a supervisor node (the LangGraph vs OpenAI Agents SDK comparison sets the two side by side). The vocabulary differs from one agent framework to the next, but the mechanics are the same, and the best AI agent frameworks roundup covers which ones support subagents directly.

Why use subagents

The main reason is context. Every model has a limit on how much it can hold, and long before that limit, quality drops: context rot and the lost in the middle effect both mean that a model with 150,000 tokens of accumulated search results reasons worse than the same model with 5,000 tokens of relevant findings. A subagent is a way of doing context engineering structurally. The messy exploration happens somewhere disposable, and the parent’s context stays clean enough to make good decisions.

The second reason is parallelism. Independent sub-tasks can run at the same time. A deep research agent that sends four subagents to investigate four angles finishes sooner than one agent working through them in sequence, and each subagent can go deeper because it is not competing with the others for context. This is the usual shape of research agents, and increasingly of coding assistants that send a subagent to map a codebase before the main agent edits it.

The third reason is specialisation. A subagent can have a narrower system prompt, a smaller tool set and even a different model from its parent. A cheap, fast model can do file search or classification while a stronger model plans and writes, which is a simple form of model routing. Narrow tool sets also make guardrails easier: a subagent that only needs to read should only be given read tools, in line with least privilege.

Subagents compared with related patterns

Subagents sit inside the broader family of multi-agent systems, and the terms overlap. The table below shows how they differ in practice.

Pattern

Who is in control

Context

Typical use

Subagent

The parent keeps control and gets a result back

Fresh and isolated per subagent

Search, research, review, isolated sub-tasks

Agent handoff

Control moves to the new agent, which talks to the user

Usually passed along in full

Triage to a specialist, such as billing support

Supervisor agent

A supervisor routes work between a fixed team of workers

Shared state managed by the supervisor

Structured workflows with known roles

Hierarchical agents

Several layers of parents and subagents

Isolated at each level

Very large tasks split more than once

Agent swarm

No single controller; agents coordinate as peers

Often shared

Exploration, simulation, open-ended work

Tool call

The agent itself; no second agent

No new context

Deterministic operations like a database query

The key line is between a subagent and a tool. A tool does one deterministic thing. A subagent makes its own decisions about which tools to use and when to stop, which is why it needs a brief rather than a set of arguments. The key line between a subagent and a handoff is who owns the conversation afterwards. With a subagent the parent stays in charge; with a handoff it does not.

The trade-offs

Subagents are not free. Each one rebuilds context from nothing, so the total token count of a task goes up even as the parent’s context goes down. A multi-agent research run can use several times the tokens of a single agent doing the same work, and Anthropic has written that its own multi-agent research system spends far more tokens than a chat. That cost is worth paying when the task is broad and the sub-tasks are independent. It is wasteful when the task is small or tightly coupled.

Information loss is the second cost. The parent only sees the summary, so anything the subagent noticed but did not report is gone. If the subagent misread the brief, the parent may not find out. This is why briefs should ask for evidence, such as file paths, page numbers or links, alongside conclusions, so that the parent can check the claims that matter.

Coordination is the third. Two subagents that both edit the same file, or that make contradictory assumptions, create work that the parent has to untangle. Most teams keep write operations with the parent, or give each subagent a clearly separate area to write to. Tasks that need constant back-and-forth between steps are usually better done by one agent; the single-agent vs multi-agent entry covers that decision in more depth.

Finally, subagents make debugging harder. A failure might sit in the parent’s plan, the brief, the subagent’s reasoning or the summary. Agent observability with traces that follow each subagent run, and agent evaluation that scores sub-tasks as well as final answers, make the difference between a system you can improve and one you can only restart.

A worked example

Suppose a team is building a support agent that has to answer “Why did this customer’s invoice double last month?” A single agent would read the account history, the billing logs, the plan change records and the relevant help articles all in one context, then try to reason across 80,000 tokens of mixed material.

With subagents, the lead agent writes three briefs. One subagent reads the billing logs for the account and reports every charge in the period with dates and amounts. A second reads the plan change history and reports any upgrades, downgrades or proration events. A third searches the help centre for articles on proration and double charges, and returns the two most relevant passages with links. Each runs in parallel, each sees only its own material, and each returns a short structured answer.

The lead agent now holds perhaps 2,000 tokens of findings. It can see that a mid-cycle upgrade triggered a prorated charge on top of the normal renewal, cite the help article that explains it and draft a reply. If one subagent returns something odd, the lead can send a follow-up brief rather than starting over. The same split works well for customer support agents generally, and for any job where several sources have to be read before one decision is made.

Where Exabase fits

Exabase does not run subagents; your framework does that. Exabase is the shared substrate those agents read from and write to, which matters most at the points where the pattern is weakest: briefs, results and state.

Subagents start with an empty context, so whatever they need has to come from somewhere they can reach. Putting the working material in a Base gives every agent in the system the same isolated agent workspace, scoped with one header, X-Exabase-Base-Id (about Bases). A subagent can then use Deep Search to pull the exact passage, page or timestamp it needs instead of loading whole files into its context, which keeps each subagent’s own context small too.

Results are the second gap. A summary returned in a tool result disappears when the parent’s session ends. A subagent that writes its findings as a note or file through Resources leaves agent artifacts that the parent, a later run or a person can open, search and audit. The parent can keep its own context light by reading only the summary and fetching the full artifact when it needs detail, a form of context offloading.

State across sessions is the third. Subagents forget everything when they end, and so does the parent unless something persists. Exabase Memory stores what the system learns about a user or project as structured facts, resolves contradictions as they change, and returns only what is relevant to a query. One parent can give each subagent the same scoped agent memory, so a subagent briefed today knows that the customer moved to the Scale plan last week (memory scoping). Replacing raw history with retrieved facts also reduces the token overhead that subagents add, which is the problem covered under reducing token costs.

If subagents have write access, turning on snapshots for the Base records how resources change over time, so you can see what a run renamed, moved or deleted and recover it, as described in agent undo. Snapshots record resource metadata rather than file content, and they do not reverse external actions such as emails a subagent sent. For scheduled upkeep of the shared material itself, Workers run agents inside a Base on a timetable, with their own built-in tools.

Frequently asked questions

What is the difference between a subagent and an agent?

A subagent is an agent that another agent starts and controls. It has the same parts as any AI agent, a model, tools and a loop, but it receives its task from a parent rather than a user, works in its own context and returns a result to the parent.

Do subagents share memory with the parent?

Not by default. Each subagent starts with a fresh context window and sees only the brief it was given. Sharing happens only through what you build in: a common store of files, a shared memory layer such as Exabase Memory, or extra context written into the brief.

Do subagents save tokens?

They save tokens in the parent’s context, but usually increase the total for the task. Each subagent rebuilds its own context, so a run with several subagents typically costs more than a single agent. The gain is better reasoning in the parent and the ability to work in parallel.

When should I not use subagents?

Avoid them for small tasks, for tightly coupled work where each step depends on the last, and for tasks where many agents would need to write to the same place. In those cases one well-managed agent with good context is cheaper and easier to debug.

Can subagents run in parallel?

Yes, and that is one of the main reasons to use them. Independent sub-tasks, such as researching separate questions or reviewing separate files, can run at the same time. Dependent steps still have to run in order.

How do subagents relate to MCP and A2A?

MCP connects an agent to tools and data, and the A2A protocol lets agents from different systems talk to each other. Subagents usually live inside one framework and are called directly, though a subagent can use MCP tools and an A2A call can be used to delegate to an agent elsewhere.

What should a subagent brief include?

State the goal, the scope, what a finished answer looks like, the output format and any limits on actions. Ask for evidence such as file paths, page numbers or links, so the parent can check the subagent’s claims without redoing the work.

Related pages: Multi-agent, Orchestration, Agent handoff, Supervisor agent, Task decomposition, Context engineering, Multi-agent coordination use case, CrewAI vs LangGraph, Bigger context windows are making agents worse, Agent memory solution, Agent state.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.