Routing, sub-agents or direct tools: delegation in ADK
Compare routing, specialised sub-agents and direct tool calls, show when delegation adds cost, and keep handoff context narrow.
By Invicly Tech, , in Google ADK with Python for AI Agents. About 11 minutes to read.
In short
Delegation means one agent hands work to another agent. ADK offers three main shapes: sub-agents the model transfers control to, an agent wrapped as a tool with AgentTool, and one agent that simply has more tools. Every extra agent adds at least one model call and another place for context to leak, so delegate only when a specialist really needs its own instructions, tools or model.
Think of it like this: A coordinator with sub-agents is a receptionist who walks you to another desk; AgentTool is a colleague who phones a specialist and reports back; one agent with more tools is a clerk who can open more filing cabinets.
Explained simply
Multi-agent systems sound powerful, so it is tempting to start with a manager agent and a team of specialists. But each agent is another model call, another instruction to maintain and another place where things go wrong. For a small support assistant, one agent with a few good tools is usually the best starting point.
ADK gives you three ways to split work when you do need it. Sub-agents let the model hand the conversation to a specialist. AgentTool lets one agent ask another for an answer and keep control. Or you skip delegation and give one agent more tools.
Delegation earns its place when a specialist needs something different: its own long instructions, a different model, tools the main agent should never see, or a built-in tool such as Google Search grounding that cannot share an agent with other tools.
Whatever you choose, pass as little as possible. A specialist that checks a ticket needs the ticket ID, not the whole chat. Narrow handoffs are cheaper, faster and leak less private information.
Press Play on a diagram to walk through it one step at a time.
- Parent lists sub_agents
- Model calls transfer_to_agent
- Specialist talks to the user
- Hard to bring control back in chat mode
- Specialist wrapped as a tool
- Parent keeps control
- Gets one request string, returns a result
- Extra model calls on both sides
- Single instruction and model
- Fewest model calls
- Simplest to test and trace
- Gets harder as the tool list grows
- User to Coordinator: Is T-1001 fixed yet?1Is T-1001 fixed yet?
- Coordinator to Ticket specialist: Model call 1: request "status of T-1001"2Model call 1: request "status of T-1001"
- Ticket specialist to Ticket tool: Model call 2: get_ticket_status3Model call 2: get_ticket_status
- Ticket tool to Ticket specialist: status ok, open4status ok, open
- Ticket specialist to Coordinator: Model call 3: result text5Model call 3: result text
- Coordinator to User: Model call 4: reply to user6Model call 4: reply to user
- AgentTool: ticket_specialist
- get_ticket_status
- include_contents none
- AgentTool: web_facts
- google_search only
- Optional, paid
- Direct tool
- search_docs
- Direct tool
- create_handoff (dry run)
In depth
Sub-agents and transfer
You list specialists in the parent's sub_agents. ADK gives the parent's model a way to transfer control, and it picks a specialist by reading each one's name and description, so descriptions must be precise. In ADK 2.x a sub-agent also has a mode. chat is the default: the specialist talks with the user and control only goes back through another transfer. task lets the specialist ask clarifying questions and return automatically when it calls finish_task; such agents must be leaves without sub-agents of their own. single_turn means no user interaction: it runs, returns its result and may run in parallel. Settings disallow_transfer_to_parent and disallow_transfer_to_peers limit where control can move. Transfers are flexible but harder to test, because the model decides the path.
- Precise description on every sub-agent
- mode: chat, task or single_turn
- task and single_turn run in their own session branch
- Use disallow_transfer_* flags to fence movement
AgentTool: ask a specialist and keep control
AgentTool(agent=specialist) turns an agent into a tool. The parent's model calls it with a request string, the specialist runs with its own instruction and tools, and its final text comes back to the parent as the tool result. The parent then writes the reply, so the user always talks to one agent and your response format stays in one place. The cost is extra model calls: the specialist needs at least one call, often two if it uses a tool, and the parent needs a call after the result to write the reply. AgentTool is also the documented way to use built-in tools such as Google Search grounding next to your own function tools: put the built-in tool in its own small agent and wrap it.
- 1Different model or long instructions?
If no, keep it a tool
- 2Tools the parent must not see?
Separate agent helps
- 3Built-in tool that cannot share?
Wrap it in AgentTool
- 4Must the specialist chat with the user?
Yes: sub-agent; no: AgentTool
- 5Measure calls and latency
Keep it only if quality improves
Keeping handoff context narrow
By default an LLM agent sees the conversation history. A specialist rarely needs it. Set include_contents="none" so it only sees its instruction and the current input, such as the request string from AgentTool. Put the few facts it needs in the request itself or in state keys its instruction reads with {key} placeholders. Give the specialist only the tools it needs; a ticket specialist does not need doc search. This cuts tokens, so it cuts cost and latency, and it reduces the chance that private details from earlier in the chat end up in a log or another user's context. It also makes the specialist easy to test alone, because its input is small and fixed.
- include_contents="none" on specialists
- Request carries IDs, not history
- Minimum tool set per agent
Counting the extra model calls
Count model calls for the same question across designs, because cost and latency scale with them. A single agent with get_ticket_status typically needs two calls: one that requests the tool, one that writes the answer. A coordinator with an AgentTool specialist needs about four: the coordinator calls the specialist, the specialist calls the tool, the specialist answers, and the coordinator writes the reply. A chat-mode transfer needs at least three. A code route in a Workflow needs zero calls to decide. At a few hundred milliseconds to a few seconds per call, doubling the calls is visible to users. You can read the real counts from the trace in adk web, or count them with a small plugin, because the event stream your runner yields does not include the calls a specialist makes behind AgentTool. Compare the counts on the same fixture questions before choosing.
Learn it in 5 short steps
About 35m each. Track them with a timer in your plan.
- 1Route with a coordinator agent~35m
- 2Wrap an agent as a tool~35m
- 3Compare with one agent and more tools~35m
- 4Keep handoff context narrow~35m
- 5Count the extra model calls~35m
Key points
- Start with one agent and a few well-described tools; split only when a measured problem appears.
- With AgentTool the parent stays in charge and gets the specialist's answer back as a tool result.
- Sub-agents in ADK 2.x have a mode: chat (default), task (returns when it calls finish_task) or single_turn (no user interaction).
- Keep handoff context narrow: send a short request, use include_contents="none" on the specialist, and pass IDs rather than history.
- A code route in a Workflow costs no model call, so use it when the choice can be made with simple rules.
Key terms
Tap a card to flip it. 0/5 known
Examples
from google.adk import Agent
from google.adk.tools import AgentTool
ticket_specialist = Agent(
name="ticket_specialist", model="gemini-flash-latest",
description="Answers questions about the status of one ticket.",
instruction="Use get_ticket_status and answer in one sentence.",
tools=[get_ticket_status],
include_contents="none",
)
coordinator = Agent(
name="support", model="gemini-flash-latest",
instruction="Use ticket_specialist for ticket questions and search_docs for product questions.",
tools=[AgentTool(agent=ticket_specialist), search_docs],
)The specialist sees only the request the coordinator sends, not the whole chat.
Same question, two designs, counted
A small plugin counts every model call in the run, including calls made inside an AgentTool specialist, which the outer event stream does not show. With a scripted fake model, the single agent makes 2 calls and the coordinator version 4 for the same answer.
from google.adk import Runner
from google.adk.plugins import BasePlugin
class CountModelCalls(BasePlugin):
def __init__(self):
super().__init__(name="count_model_calls")
self.calls = 0
async def before_model_callback(self, *, callback_context, llm_request):
self.calls += 1
return None
counter = CountModelCalls()
runner = Runner(app_name="support", agent=coordinator,
session_service=session_service, plugins=[counter])A sub-agent that returns automatically
A single_turn specialist runs without talking to the user and hands its result back to the parent. It runs in its own branch, so it does not see sibling work.
from google.adk import Agent
summariser = Agent(
name="ticket_summariser",
model="gemini-flash-latest",
description="Summarises one ticket's history in two sentences.",
instruction="Summarise the ticket history you are given. No advice.",
mode="single_turn",
)
root_agent = Agent(name="support", model="gemini-flash-latest",
instruction="Delegate ticket summaries to ticket_summariser.",
tools=[get_ticket_status], sub_agents=[summariser])Quick reference
- Default: one agent, few precise tools. Split only after measuring a problem.
- AgentTool(agent=x): parent keeps control, gets the result back.
- sub_agents + mode: chat (default), task (finish_task), single_turn (no user turns).
- include_contents="none" keeps a specialist off the chat history.
- Built-in tools like google_search go in their own agent behind AgentTool.
- Code routes in a Workflow cost zero model calls.
- Compare designs by model calls per fixture question.
Common mistakes
- Adding a coordinator plus three specialists for a job one agent with three tools could do, doubling latency and cost.
- Vague description fields on sub-agents, so the coordinator transfers to the wrong one.
- Letting a specialist read the full conversation when it only needs a ticket ID, which raises token cost and leak risk.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Write a description for a ticket specialist and one for a docs specialist that make it impossible to confuse them.
- Exercise 2medium
Run the single-agent and AgentTool designs on five fixture questions and record model calls, total latency and whether the answer was correct.
- Exercise 3hard
Refactor the ticket specialist so it receives only a ticket ID: no chat history, no doc tools, and a request format enforced in its instruction. Show that a private note from earlier in the chat no longer reaches it.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is a multi-agent system more accurate?
- Not by default. It can help when specialists need very different instructions or tools, but it also adds handoff errors. Measure on the same test questions before deciding.
- What is the difference between AgentTool and a sub-agent?
- AgentTool returns a result to the parent, which keeps talking to the user. A chat-mode sub-agent takes over the conversation until control is transferred again.
- Can I route without a model at all?
- Yes. In a Workflow, a function node can return a route based on simple rules, such as a ticket ID pattern. That decision costs no model call.