---
name: coordinator-subagent-pattern
description: >
  Use this skill to design an ADK 2.0 coordinator agent with multiple
  subagents — the canonical multi-agent pattern. Triggers on: "ADK
  coordinator", "ADK subagents", "build an ADK agent team", "parent agent
  with sub_agents", "delegating ADK agent", "ADK collaborative agents",
  "agent that routes to specialists". Generates a coordinator LlmAgent with
  sub_agents=[...] containing N specialist agents, plus instruction text
  that teaches the coordinator when to delegate to each.
---

# coordinator-subagent-pattern

The most common multi-agent ADK 2.0 layout: one coordinator routes user input to specialist subagents.

## When to use

- Different user requests need different specialists (billing vs technical)
- You want a single root entry-point that delegates intelligently
- Specialists have distinct tools, instructions, or models

## Template

```python
from google.adk.agents import LlmAgent

greeter = LlmAgent(
    name="greeter",
    model="gemini-2.5-flash",
    description="Handles greetings, small talk, and onboarding.",
    instruction="Greet the user warmly. Ask how you can help.",
)

task_executor = LlmAgent(
    name="task_executor",
    model="gemini-2.5-pro",
    description="Executes concrete tasks: search, calculations, file ops.",
    instruction="Carry out the user's task. Cite sources where relevant.",
)

coordinator = LlmAgent(
    name="coordinator",
    model="gemini-2.5-flash",
    description="Routes user requests to greeter or task_executor.",
    instruction=(
        "You coordinate two specialists:\n"
        "  - greeter: small talk, intros\n"
        "  - task_executor: concrete tasks\n"
        "Inspect the user's message and delegate to the right specialist. "
        "Do not answer directly unless neither specialist fits."
    ),
    sub_agents=[greeter, task_executor],
)

root_agent = coordinator
```

## How delegation works

ADK exposes each subagent's `name` and `description` to the coordinator's LLM. The coordinator decides via tool-call which subagent receives the next turn.

## Best practices

- Give each subagent a **distinctive `description`** — that's what the coordinator reads
- Keep coordinator instruction terse; let descriptions do the routing work
- Use cheaper models for routing (flash) and heavier models for execution (pro)
- One layer of nesting is usually enough; avoid coordinator-of-coordinators

## Validation

- Each subagent has unique `name`
- Each subagent has a clear `description` (≤ 1 sentence is ideal)
- Coordinator instruction lists every subagent
- Test routing with prompts that should hit each specialist
