The Sub-Agent Pattern: Delegating to Specialized Gemini 3 Workers
Single-LLM workflows suffer context saturation. Learn the sub-agent pattern: coordinator plus specialized Gemini 3 workers with scoped context, routing, and model tiering.
Published on • August 1, 2026
AI Assistant

A single-LLM workflow — one model, one giant system prompt, one context window — has a ceiling. As you add tools and instructions, the agent suffers context saturation: instructions get lost, tool selection gets sloppy, and reasoning becomes unstable on complex tasks.
The Sub-Agent pattern fixes this by decomposing an objective into isolated, specialized workers. A root agent (the orchestrator) keeps long-term state, delegates work to sub-agents with scoped context windows and restricted tools, and aggregates the results.
In this tutorial, you will learn when to delegate, how to build a coordinator-plus-workers system with Google ADK, and how to tier models across workers so complex reasoning runs on Gemini 3 Pro while simple extraction runs on Flash.
The Problem: Single-LLM Context Saturation
Traditional single-LLM workflows give one model everything: every tool, every edge case, every instruction. The result:
- Context overload: one long window that can’t preserve instructions across steps.
- Serial execution: one reasoning chain at a time, no parallelism.
- Unstable reasoning: the model loses the thread in complex logic chains.
The Sub-Agent pattern replaces this with a micro-agent architecture — a hub-and-spoke model where a central router maintains state and delegates work to ephemeral specialized workers.
The Pattern: Coordinator + Specialized Workers
flowchart TD
A["Root Coordinator<br/>(orchestrator)"]
B["Research Worker<br/>(gemini-3-flash)"]
C["Code Review Worker<br/>(gemini-3-flash)"]
D["Deep Analysis Worker<br/>(gemini-3-pro)"]
A -->|"delegate"| B
A -->|"delegate"| C
A -->|"delegate"| D
B -->|"result"| A
C -->|"result"| A
D -->|"result"| A
classDef root fill:#e0f2fe,stroke:#0284c7,color:#0f172a;
classDef worker fill:#fef3c7,stroke:#d97706,color:#0f172a;
class A root;
class B,C,D worker;
The benefits:
- Scoped context: the root keeps long-term state and passes clean, concise prompts to workers.
- Specialization: each worker has its own model, instructions, and tools.
- Parallelism: workers run concurrently, cutting latency (scatter-gather).
- Cost efficiency: cheap models handle simple steps; the reasoning model only runs when needed.
When to Delegate vs. When to Do It Yourself
| Condition | Single agent | Sub-agents |
|---|---|---|
| Few tools, linear task | ✅ | — |
| One fixed pipeline | ✅ | — |
| Diverse intents / domains | — | ✅ |
| Parallelizable subtasks | — | ✅ |
| Model tiering desired | — | ✅ |
| Context approaching limit | — | ✅ |
If the task fits one model and one short context, don’t over-engineer. Reach for sub-agents when complexity, breadth, or scale demands isolation and parallelism.
Implementation 1: Automatic Delegation with sub_agents
ADK’s simplest sub-agent pattern uses the sub_agents parameter. The root agent evaluates incoming requests against each sub-agent’s description and automatically transfers control (AutoFlow):
from google.adk.agents import Agent
research_worker = Agent(
name="research_worker",
model="gemini-3-flash",
description="Searches the web and summarizes sources on a given topic.",
instruction="You gather evidence for topics. Return a concise summary with citations.",
)
code_review_worker = Agent(
name="code_review_worker",
model="gemini-3-flash",
description="Reviews Python code for bugs, security issues, and style.",
instruction="You review code. Output a prioritized list of issues.",
)
coordinator = Agent(
name="coordinator",
model="gemini-3-pro",
description="Routes work to specialized workers and synthesizes results.",
instruction=(
"You are the root coordinator. Delegate web research to "
"'research_worker' and code review to 'code_review_worker'. "
"Never perform those tasks yourself. Synthesize the final answer."
),
sub_agents=[research_worker, code_review_worker],
)
Routing contract: each worker’s description is what the coordinator uses to decide delegation. Write descriptions as precise capability statements — they are the routing table.
Implementation 2: Explicit Agent-as-a-Tool
For hierarchical decomposition where the parent needs a specific output and continues reasoning afterward, wrap a sub-agent as a tool:
from google.adk.agents import Agent
from google.adk.tools import AgentTool
deep_analysis_worker = Agent(
name="deep_analysis_worker",
model="gemini-3-pro",
instruction="Perform rigorous multi-step analysis and return a structured report.",
)
coordinator = Agent(
name="coordinator",
model="gemini-3-pro",
instruction=(
"Break the user's goal into subtasks. Use the 'deep_analysis_worker' "
"tool for any step requiring deep reasoning. Continue after it returns."
),
tools=[AgentTool(agent=deep_analysis_worker)],
)
Treating a sub-agent as a tool lets the parent call it explicitly — the worker’s entire workflow becomes a single function call. This is ideal when the parent breaks down a complex goal and delegates just part of it.
Parallel Fan-Out/Gather for Speed
When subtasks are independent, run them concurrently to cut total latency. ADK’s ParallelAgent fans out work and gathers results into shared state:
from google.adk.agents import ParallelAgent, Agent
security_review = Agent(name="security_review", model="gemini-3-flash",
instruction="Find security issues in the PR diff.")
style_review = Agent(name="style_review", model="gemini-3-flash",
instruction="Find style and readability issues.")
performance_review = Agent(name="performance_review", model="gemini-3-flash",
instruction="Find performance issues.")
parallel_reviews = ParallelAgent(
name="parallel_pr_reviews",
sub_agents=[security_review, style_review, performance_review],
)
The three reviews run in parallel, and a follow-on agent consolidates their reports — turning what would be a serial pipeline into a scatter-gather.
Model Tiering Across Workers
The Sub-Agent pattern makes model routing explicit:
- Gemini 3 Flash / Nano: extraction, classification, formatting, simple lookups.
- Gemini 3 Pro: orchestration, deep reasoning, synthesis, complex judgment.
This is where the token efficiency strategies compound: workers hold scoped context, so the expensive reasoning model never pays to re-read the full history.
Guarding Delegation: Safety and the Routing Contract
- Descriptions are security-relevant: a sloppy description routes sensitive work to the wrong worker. Review them like code.
- Scope worker tools: each worker only sees its own tools, reducing tool-misuse blast radius.
- Validate outputs: treat worker output as data flowing into the coordinator — verify schema and policy before acting on it.
Summary
The Sub-Agent pattern is the antidote to single-LLM context saturation:
- A coordinator keeps long-term state and routes work.
- Specialized workers hold scoped context, dedicated models, and restricted tools.
- Delegation is either automatic (via
sub_agentsdescriptions) or explicit (agent-as-a-tool). - Parallel agents fan out independent subtasks for speed.
- Model tiering keeps expensive reasoning for the steps that need it.
Start with a coordinator and two specialists; scale horizontally by adding workers as new domains appear. Modularity, specialization, and efficiency come from the same structural choice.