Skip to main content

Module 16: Collaborative Teams - Modes and Hand-offs

๐Ÿงญ Where We Are in Part 3: In Module 15, your router_agent handed off the conversation to a specialist (sub_agents), and that specialist stayed active afterward (mode="chat"). Here in Module 16, we complete Chapter A (LLM-Driven Agent Teams) by learning how mode="single_turn" and mode="task" automatically return control to your coordinator so multiple specialists can collaborate on one plan!

Collaborative Teams Hero (Light) Collaborative Teams Hero (Dark) Figure: Native conversational hand-offs and collaboration modes between primary triage agents and specialized domain experts.

Theoryโ€‹

When a coordinator needs input from two or more specialists to fulfill a single user request โ€” for example, scouting an event venue and customizing a catering menu โ€” a plain one-way hand-off isn't enough. You need a guarantee that each specialist finishes its job and hands the microphone back to the coordinator.

ADK 2.0 solves this declaratively with Collaboration Modes.

1. Collaboration Modes (chat, single_turn, task)โ€‹

When you register a sub-agent, the mode parameter controls who holds the microphone and when control returns to the coordinator:

ModeBehaviorBest For
"chat" (default)Full hand-off. The sub-agent takes over the conversation and keeps control until it decides to transfer elsewhere. No automatic return.One-way triage transfers (like Module 15's Greeting Router or transferring permanently to a billing desk).
"single_turn"Quick call-and-return. The sub-agent never talks directly to the user; it runs one reasoning step, returns the result, and the coordinator stays in control.Fast background lookups (e.g., checking venue capacity, querying a database) so the coordinator can combine multiple results.
"task"Interactive sub-task with guaranteed return. The sub-agent can ask the user clarifying questions across as many turns as needed. Once finished, it calls ADK's built-in finish_task tool and control automatically returns to the coordinator in that same turn.Multi-turn sub-tasks (e.g., gathering dietary preferences for catering before handing back to the main event coordinator).

2. Using mode="task" and rerun_on_resume=Trueโ€‹

When a task-mode sub-agent pauses to ask the user a question and resumes on the next turn, ADK wakes up the dispatch chain. Because of this, every agent in a sub_agents chain using task mode must set rerun_on_resume=True:

from google.adk import Agent
from google.adk.tools import google_search

# Specialist in 'task' mode: can ask the user questions, ground answers via Search, and return control automatically
researcher = Agent(
name="researcher",
model="gemini-3.8-flash",
mode="task",
rerun_on_resume=True,
tools=[google_search],
instruction="Research the topic using google_search, ask clarifying questions if needed, and summarize.",
)

# Coordinator: delegates to researcher and automatically regains control afterward
root_agent = Agent(
name="coordinator",
model="gemini-3.8-flash",
rerun_on_resume=True,
sub_agents=[researcher], # ADK automatically injects delegation tools
instruction="Delegate research to the specialist, then write a final conclusion.",
)

Note (google_search Grounding): Equipping specialists with ADK's built-in google_search tool lets single_turn and task sub-agents retrieve live real-world facts (such as current weather forecasts or flight schedules) before handing control back to the coordinator. Using google_search requires a valid GOOGLE_API_KEY or an authenticated Vertex AI Google Cloud project.

3. How Hand-offs Work Under the Hoodโ€‹

Collaboration Native Hand-Off Pipeline (Light) Collaboration Native Hand-Off Pipeline (Dark) Figure: Seamless control transfer pipeline preserving session memory, context serialization, and telemetry.

When you list specialists in sub_agents=[...], ADK automatically injects delegation tools (such as transfer_to_agent or request_task_<agent_name>) into the coordinator:

  • With default mode="chat", control transfers to the sub-agent; local sub-agents can choose to transfer back, but the framework does not enforce it.
  • With mode="task" or mode="single_turn", returning control to the coordinator is guaranteed by the framework โ€” so a coordinator can reliably consult multiple specialists in sequence and synthesize their answers.

Alternative Tool Wrapper (AgentTool): ADK also provides AgentTool(agent=...) (from google.adk.tools.agent_tool), which wraps an agent inside tools=[...]. For local Python agents, ADK recommends preferring sub_agents with mode="single_turn" (and reserving AgentTool for external service proxies covered in Module 21).

๐ŸŽฏ Knowledge CheckSelect Best Answer

Which Collaboration Mode allows a specialist sub-agent to ask the user follow-up questions across multiple turns and then automatically return control to the coordinator as soon as the sub-task is complete?

Why Use Collaborative Teams?โ€‹

  • Predictability: single_turn and task modes guarantee when and how control returns to your coordinator.
  • Natural Conversation: Context and session history are preserved seamlessly across hand-offs.
  • Cleaner Prompts: You don't need fragile prompt hacks telling sub-agents to "transfer back when done."

Key Takeawaysโ€‹

  • Collaboration Modes (chat, single_turn, task) control who holds the conversation and whether control returns automatically.
  • Use mode="single_turn" for fast, non-interactive lookups and mode="task" for multi-turn sub-tasks with guaranteed return (finish_task).
  • Set rerun_on_resume=True on every agent in a task-mode sub_agents chain.
๐Ÿ“–

16: Collaborative Teams(Theory & Overview)

Part 3: Multi-Agent Systems โ€ข Module 16

Overall Course Progress:
0%(0/98)
Next Step: Challenge Lab ๐Ÿงช โ†’