Pattern
How AI sub-agents split work and run tasks in parallel
Sub-agents are helper agents that a lead agent starts for one well-defined piece of a larger job, each with its own fresh context, instructions and tools. Several can run at once and report back short findings, which makes broad tasks faster, at the price of more model usage.
Explained from public sources. Mai has not built this yet.
On this page
In plain English
When a manager has a big piece of research to do, they do not read every file themselves. They give three people a clear brief each (“you check the contracts, you check the invoices, you check the emails”), let them work at the same time, and read the three short reports that come back. Sub-agents are the same idea for AI. A lead agent splits a job into pieces, starts a helper agent for each, and puts the results together. The helpers work in parallel and keep their working notes to themselves, so the lead only sees what matters.
How it works
A fresh context per helper. The main benefit of a sub-agent is not that it is cleverer; it is that it starts clean. It gets its own instructions and its own context window, does a lot of reading and tool calls, and returns a condensed result. Claude Code’s documentation describes exactly this: each sub-agent runs in its own context, can be limited to a chosen set of tools, and only its summary comes back to the main conversation. The lead agent’s context stays clear for the decision it has to make.
Two shapes of parallel work. Anthropic’s guide to building agents separates fixed parallel steps from dynamic delegation:
- Sectioning and voting. The split is known in advance. Check a contract for payment terms, liability and termination clauses in three parallel calls; or ask the same question three times and compare answers.
- Orchestrator and workers. The split depends on the input. The lead agent reads the task, decides what pieces it needs, starts a worker for each and combines what they return.
The brief is everything. Anthropic’s write-up of its multi-agent research system found that vague delegation caused sub-agents to misread the task or repeat each other’s work. Their advice is that each sub-agent needs a clear objective, an output format, guidance on which tools and sources to use, and boundaries on what is out of scope. In practice the brief looks like a short ticket, and the output format is a fixed structure the lead can merge.
Task. Then Lead agent. Then Worker A, Worker B, Worker C. Then Combine and check. Then Run log.
Effort should match the task. A simple lookup needs one agent and a few tool calls; a broad review across many records might justify several workers. Anthropic’s team built that scaling into their prompts after finding their system spawned too many sub-agents for simple questions.
Sub-agents are not the same as specialists. A specialist agent is a standing role with its own area and permissions. A sub-agent is temporary: created for one piece of work and gone when it reports back. A specialist may well start sub-agents of its own.
Where it goes wrong
- Cost. Each worker makes its own model calls. Anthropic reports multi-agent runs using many times the tokens of a chat, and concludes the approach suits high-value, broad tasks. For routine work, one agent is usually better. See agent cost control.
- Dependent work split badly. Parallelism helps when pieces are independent. Tasks where every step depends on the last, which Anthropic notes is true of most coding, gain little and risk workers contradicting each other.
- Duplicated effort and gaps. Thin briefs lead two workers to cover the same ground and nobody to cover the rest.
- Lost detail. The summary is the point, but a worker can drop the one fact that mattered. Asking for sources and confidence in the output format helps the lead check.
- Permissions that spread. A worker should never have more access than the agent that started it. Tool lists for workers should be narrower, not wider.
- Hard to debug. Many agents running at once produce interleaved activity. Without a trace that links every worker to its parent run, nobody can explain the result (see traces and audit logs).
How Mai AI uses it
In a Mai AI system, I reach for sub-agents when a job is broad, read-heavy and splits cleanly: reviewing a batch of documents, gathering facts from several systems before a decision, or checking a draft from more than one angle. I keep them out of routine requests, where a single specialist does the job for less.
I design each worker’s brief as structured data (objective, sources, output fields, limits) rather than free text, and give workers read-only tools by default. Writing and sending stay with the agent that owns the task, so anything that matters still goes through human approval gates. Every worker run is recorded under its parent, so the audit trail shows who looked at what.
For work that stretches over days rather than minutes, the lead hands over to a long-running job instead. If you want to know where parallel work would actually save time in your operation, that comes out of designing your custom AI operations system.
Questions and answers
What is a sub-agent in AI?
A sub-agent is an agent started by another agent to handle one part of a task. It works in its own context with its own instructions and tools, and returns a summary of its result to the agent that started it.
Can AI agents work in parallel?
Yes. A lead agent can start several sub-agents at once on independent parts of a task, such as checking different sources, then combine what they find. This only helps when the parts do not depend on each other.
What is the orchestrator-worker pattern?
An orchestrator agent breaks a task into subtasks it decides on at run time, hands each to a worker, and combines the results. It differs from fixed parallel steps because the split depends on the input.
Do multi-agent systems cost more?
Usually, yes. Each sub-agent makes its own model calls, so total usage rises. Anthropic reports that its multi-agent research system uses far more tokens than a single chat, which is worth it only for valuable, broad tasks.
Harnesses known for this
- Harness profileClaude Code and Agent SDK
Claude Code is Anthropic's agentic coding tool that reads a codebase, edits files and runs commands from the terminal, IDE, desktop app or browser. The Claude Agent SDK packages the same agent loop and tools as a Python and TypeScript library, for building your own agents on Claude.
- Harness profileHermes Agent
Hermes Agent is an open-source AI agent from Nous Research that runs on a server or your own machine, talks to you through the terminal or chat apps, and writes reusable skills from the work it does. It suits people who want a long-lived agent that remembers, runs scheduled jobs and improves with use, on any model provider.
- Harness profileDeepSeek Harness
DeepSeek Harness (dsh) is DeepSeek's open-source agent harness, in public preview, built on the idea that every feature is a plugin. It suits developers who want a self-hosted coding and task agent they can reshape, running DeepSeek models or any provider that speaks a supported API.
- Harness profileOpenAI Agents SDK
The OpenAI Agents SDK is an open-source library, in Python and TypeScript, for building agents that use tools, hand work to each other and pause for approval. It suits teams that want a light agent loop with tracing built in, rather than a full orchestration platform.
- Harness profileCrewAI
CrewAI is an open-source Python framework for building teams of agents, each with a role, a goal and tools, that work through tasks together. It is best for work that splits naturally into roles, wrapped in event-driven Flows that keep the overall process under control.
- Harness profileMicrosoft Agent Framework
Microsoft Agent Framework is Microsoft’s open-source framework for agents and multi-agent workflows in .NET and Python, and the direct successor to both AutoGen and Semantic Kernel. It is best for teams on Azure or .NET that want typed, checkpointed workflows with approvals and OpenTelemetry tracing.
Related entries
- PatternRouting and specialist agents
Routing means one agent reads each request and hands it to the specialist best placed to handle it, such as finance, operations or sales. Each specialist has its own instructions, tools and permissions, which keeps answers sharper and access tighter than one agent trying to do everything.
- PatternLong-running jobs
An AI agent can follow a task for days or weeks only if the task lives outside the agent, as a saved record of goal, progress and next step that survives restarts. The agent wakes, reads the record, does one step, writes it back and sleeps, so nothing depends on one long conversation.
- PatternAgent cost control
You control AI agent costs by sending routine work to small, cheap models and saving large ones for hard steps, caching repeated prompt content, and putting hard budgets and caps on every key, agent and job. Clients can then pay providers directly on their own keys or use a managed allowance.
- PatternTraces and audit logs
You see what an AI agent did and why by recording a trace of every run, each model call, tool call and decision as a timed step, plus a separate audit log of every action that changed something and who approved it. Traces are for debugging; the audit log is the permanent record.