---
title: "The Coordinator/Specialist Pattern: Dynamic Sub-Agent Delegation with sub_agents"
date: "2026-11-29T08:55:14+07:00"
description: "Implement hierarchical multi-agent delegation in Google ADK using the Coordinator/Specialist pattern and sub_agents routing."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/adk-coordinator-specialist-sub-agents-delegation.jpg"
alt: "Google ADK Coordinator Specialist Multi-Agent Delegation Architecture"
tags: ['google-adk', 'multi-agent', 'coordinator-pattern', 'delegation', 'python']
---

As enterprise AI assistants expand in scope, stuffing dozens of unrelated tools into a single agent prompt causes significant degradation: the model suffers from tool confusion, hallucinated arguments, and bloated context costs.

The industry-standard solution is the **Coordinator/Specialist Pattern** (also known as the Supervisor/Worker pattern). In this architecture, a front-facing Coordinator agent listens to user queries and dynamically delegates execution to focused Specialist sub-agents (e.g., Billing, Technical Support, Reservations).

In Google Agent Development Kit (ADK), this is accomplished natively by supplying specialist agents to the `sub_agents` parameter of a coordinator `Agent`.

In this tutorial, we will explore how ADK coordinates sub-agent handoffs, why the `description` attribute is critical for delegation, and how to build a production customer service concierge.

---

## 1. How Dynamic Sub-Agent Delegation Works

In ADK, when an agent has other agents listed in its `sub_agents` array, ADK automatically exposes transfer actions to the parent LLM:

```
                      [User Inquiry]
                            │
                            ▼
           ┌─────────────────────────────────┐
           │        Coordinator Agent        │
           │  (Front door, intent routing)   │
           └─────────────────────────────────┘
                     /             \
    Delegation Turn /               \ Delegation Turn
                   ▼                 ▼
   ┌───────────────────────┐   ┌────────────────────────┐
   │ Billing Specialist    │   │ Tech Support Specialist│
   │ - Tools: refund, check│   │ - Tools: reset, logs   │
   └───────────────────────┘   └────────────────────────┘
```

When Gemini determines that an incoming request matches a specialist's domain, it emits a transfer event. Control shifts to that specialist, which executes its specialized tools and formulates the response.

---

## 2. The Critical Importance of the `description` Field

When configuring sub-agents, the `description` string is not just for documentation—**it is the exact semantic prompt text Gemini uses to decide when to delegate**.

If your description is vague:
```python
# POOR: Gemini will not know when to transfer!
billing_agent = Agent(name="billing", description="Handles stuff.")
```

If your description is precise:
```python
# EXCELLENT: Unambiguous routing signal!
billing_agent = Agent(
    name="billing_specialist",
    description="Handles invoice questions, credit card payment disputes, subscription upgrades, and refund processing."
)
```

---

## 3. Implementing the Multi-Agent Customer Support Fleet

Let's build a working coordinator with two distinct specialists: a **Billing Specialist** with financial tools and a **DevOps Specialist** with system health tools.

```python
import asyncio
from typing import Dict, Any
from pydantic import BaseModel, Field
from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService

# --- Specialist 1 Tools & Agent ---

class RefundInput(BaseModel):
    transaction_id: str = Field(description="Order or invoice ID, e.g. 'TX-10992'")
    amount_usd: float = Field(description="Refund amount in USD.")

def process_customer_refund(inp: RefundInput) -> Dict[str, Any]:
    """Processes an authorized credit card refund."""
    return {
        "status": "processed",
        "transaction_id": inp.transaction_id,
        "refunded_amount": inp.amount_usd,
        "reference_code": "REF-99812",
    }

billing_agent = Agent(
    name="billing_specialist",
    model="gemini-3.8-flash",
    description="Handles customer invoice questions, subscription charges, payment failures, and refund requests.",
    instruction="""
    You are an expert customer billing representative.
    Help the user resolve invoice issues and process refunds with `process_customer_refund`.
    Always confirm the transaction ID and dollar amount clearly.
    """,
    tools=[process_customer_refund],
)

# --- Specialist 2 Tools & Agent ---

class ServiceHealthInput(BaseModel):
    service_name: str = Field(description="Name of the backend service, e.g., 'auth', 'database', 'cdn'")

def check_service_status(inp: ServiceHealthInput) -> Dict[str, Any]:
    """Queries cluster monitoring for microservice health."""
    mock_health = {
        "auth": {"status": "healthy", "latency_ms": 12},
        "database": {"status": "degraded", "active_connections": 998, "latency_ms": 420},
        "cdn": {"status": "healthy", "latency_ms": 5},
    }
    return mock_health.get(inp.service_name.lower(), {"status": "unknown"})

tech_support_agent = Agent(
    name="tech_support_specialist",
    model="gemini-3.8-flash",
    description="Handles technical issues, system outages, API errors, server status, and service latency checks.",
    instruction="""
    You are a Senior Technical Support Engineer.
    Investigate user reports of slow services or API downtime using `check_service_status`.
    Explain the underlying cause in clear, reassuring terms.
    """,
    tools=[check_service_status],
)

# --- Coordinator Agent ---

coordinator_agent = Agent(
    name="support_coordinator",
    model="gemini-3.8-flash",
    instruction="""
    You are the frontline Concierge for CloudCorp Support.
    Greet the user courteously. Listen to their inquiry.
    Dynamically delegate to `billing_specialist` for anything financial or payment-related.
    Dynamically delegate to `tech_support_specialist` for server errors or performance complaints.
    If the inquiry is general chit-chat, answer directly without delegating.
    """,
    sub_agents=[billing_agent, tech_support_agent],
)
```

---

## 4. Running the Multi-Turn Conversation

Let's test how the coordinator seamlessly transfers control across different turns:

```python
async def main():
    session_service = InMemorySessionService()
    runner = Runner(agent=coordinator_agent, session_service=session_service)
    session = await session_service.get_or_create("user_ticket_42")

    turns = [
        "Hi, is your database experiencing high latency right now?",
        "Also, I was double billed on transaction TX-10992 for $49.00. Can I get a refund?",
    ]

    for turn in turns:
        print(f"\nUser: {turn}")
        print("Response: ", end="")
        async for event in runner.run_async(session=session, message=turn):
            if event.content:
                for part in event.content.parts:
                    if hasattr(part, "text") and part.text:
                        print(part.text, end="")
        print()

if __name__ == "__main__":
    asyncio.run(main())
```

### Execution Trace Analysis
1. In Turn 1, the user asks about database latency. The Coordinator reviews its `sub_agents` descriptions, matches `tech_support_specialist`, transfers control, and invokes `check_service_status(service_name='database')`.
2. In Turn 2, the user changes topics to an overcharge. The Coordinator detects the billing intent, immediately routes to `billing_specialist`, and triggers `process_customer_refund`.

---

## 5. Architectural Benefits of the Pattern

1. **Context Window Hygiene:** Specialist agents only receive the instructions and tools pertinent to their domain, keeping token usage tight and responses fast.
2. **Team Ownership:** Different engineering teams can maintain different specialist agent codebases without modifying the central coordinator logic.
3. **Auditability:** Event histories explicitly record which agent handled which portion of the conversation, making compliance auditing straightforward.

**Takeaway:** The Coordinator/Specialist pattern organizes multi-domain enterprise applications into clean, maintainable, and highly accurate agent fleets.

## Sources
- Google ADK Documentation: https://adk.dev/
- Google GenAI SDK: https://github.com/googleapis/python-genai
- Google Agents CLI Docs: https://github.com/google/agents-cli
