---
title: "ADK Design Patterns: Single Agent, Pipeline, and Swarm Topologies"
date: "2026-11-25T08:12:00+07:00"
description: "How to choose and implement the right multi-agent topology in ADK — when one agent wins, when a pipeline fits, and when a supervisor swarm earns its complexity."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/adk-design-patterns-single-pipeline-swarm.jpg"
alt: "Three agent topologies side by side: single node, linear pipeline, and hub-and-spoke swarm"
tags: ['google-adk', 'design-patterns', 'multi-agent', 'workflows', 'architecture']
---

Every multi-agent system faces the same first decision: *how many agents, and wired how?* The wrong answer is almost never "too few" in the documentation sense — it's "too many, too early." Topology choice determines your latency, your token bill, your debugging surface, and how gracefully the system degrades. ADK gives you primitives for each shape; the craft is matching shape to problem.

The three canonical topologies — **single agent**, **pipeline**, and **swarm** — cover most real systems. Here's how each works in ADK, what it costs, and how to know when to move to the next one.

## Pattern 1: The single agent (start here)

One `LlmAgent` with tools and sub-agents available for transfer. This is ADK's default and, for a surprising number of production use cases, the correct final answer.

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

root_agent = Agent(
    model="gemini-flash-latest",
    name="support_assistant",
    instruction=SUPPORT_INSTRUCTION,
    tools=[search_kb, lookup_order, escalate_to_human],
)
```

Why it holds up so well:

- **One context, no handoffs.** Nothing is lost between agents — every token the model sees is in one place.
- **Lowest latency.** One model round-trip per step, no routing decisions.
- **Easiest to evaluate.** One prompt, one behavior surface, one regression suite.

The single agent struggles when: the system prompt exceeds a comfortable context budget, unrelated tools confuse tool selection (a known failure mode — the model picks the plausible-but-wrong tool), or distinct subtasks need distinct models or guardrails.

**Upgrade trigger:** tool-selection accuracy drops, or your instruction file needs three unrelated sections to describe three unrelated jobs.

## Pattern 2: The pipeline (sequential processing)

Fixed-order processing where stage *N* prepares input for stage *N+1*. Classic examples: retrieve → compose → critique; or intake → classify → route → draft.

In ADK 2.0, sequential composition is expressed with **graph workflows** — declarative nodes and edges (the older `SequentialAgent` is deprecated in Python/TS in favor of graphs). The conceptual shape:

```
intake ──▶ classify ──▶ draft ──▶ review ──▶ output
```

Design rules that make pipelines reliable:

1. **Each stage has one job and a typed output.** Pass structured data (`output_schema` / `output_key`) between stages rather than free-form prose — the next stage's input is then a contract, not a hope.
2. **Fail fast at the cheapest stage.** Validation belongs as early as possible, where a failure costs one model call instead of six.
3. **Decide what happens on review rejection.** Loop back to draft with the critique as input, or emit the critique to a human? A pipeline without an explicit rejection path invents one at runtime.

```python
# Conceptual graph: nodes with typed handoffs
intake  -> classify -> draft -> review
                           ^        |
                           └─reject─┘     review.approve -> output
```

Pipelines shine for *deterministic process knowledge* — you already know the steps. They're poor fits when the number of steps varies per request; that's swarm territory.

**Upgrade trigger:** different requests need different routes, or parallel work would cut latency.

## Pattern 3: The swarm (supervisor + workers)

A coordinator agent delegates to specialist workers, typically in parallel, then synthesizes. In ADK this maps to a supervisor `LlmAgent` whose sub-agents are the workers, plus `ParallelAgent`-style fan-out (or graph fan-out nodes in 2.0):

```
              ┌─▶ research_worker ─┐
supervisor ───┼─▶ analyst_worker ──┼──▶ synthesizer ──▶ output
              └─▶ critic_worker ───┘
```

```python
supervisor = Agent(
    model="gemini-pro-latest",
    name="supervisor",
    instruction="Delegate each subtask to the best worker, then merge results.",
    sub_agents=[researcher, analyst, critic],
)
```

What earns the complexity:

- **True parallelism** — three workers at once cuts wall-clock latency for fan-out-shaped tasks.
- **Per-worker specialization** — distinct prompts, distinct tools, distinct models (cheap model for retrieval, premium for synthesis).
- **Contained context** — each worker sees only its slice; the supervisor sees summaries.

What it costs:

- **More model calls per request** — a supervisor round *plus* each worker. Latency can improve while token spend doubles.
- **Handoff lossy-ness** — anything not explicitly passed in the delegation message is lost; the worker starts nearly cold.
- **Harder evaluation** — you now test routing decisions as well as outputs.

**Discipline required:** give workers `output_schema`s so the supervisor receives structured results, cap delegation depth (a supervisor that can spawn supervisors can recurse), and instrument which worker failed before blaming the model.

## Choosing: a decision table

| Situation | Pattern |
|---|---|
| One coherent job, moderate tool count | **Single agent** |
| Fixed multi-step process with quality gates | **Pipeline** |
| Varied requests, parallelizable subtasks | **Swarm** |
| Fixed steps *and* parallel fan-out inside a step | Pipeline of swarms (hierarchy) |
| Need different models per subtask | Swarm (or routed models at one agent) |
| Latency budget < 2s | Single agent, always |

Two practical notes. First, **the cheapest upgrade is almost always prompt/tool hygiene** — split an oversized instruction, prune unused tools, add few-shot examples — before adding an agent. Second, **mix patterns deliberately**: a pipeline for the main flow with a swarm at one stage is a common, stable production shape; unbounded nesting of both is where debugging goes to die.

## Migration path

Most systems evolve the same way: single agent → *split out the one genuinely different concern* (a critic, a retriever, a domain expert) → notice the split points repeat → formalize as pipeline or swarm. Keep the migration cheap by defining handoff contracts early (structured outputs, `output_key`s) and keeping each extracted agent independently testable. The [package anatomy](/blog/google-adk-package-anatomy-modules) tells you which module hosts which primitive as you go.

## Where to go next

Topology decisions interact with everything else: swarms multiply [cost and reliability concerns](/blog/enterprise-adk-assistants-reliability-latency-cost), pipelines need [deadlines per stage](/blog/adk-global-timeouts-execution-deadlines), and workers should expose typed results via [Pydantic `output_schema`s](/blog/adk-pydantic-response-schema-structured-outputs). When one topology needs more or less capability per node, [dynamic model routing](/blog/adk-dynamic-model-routing-task-complexity) is the next lever.

## References

- [Multi-agent workflow patterns](https://adk.dev/workflows/patterns/)
- [Simple agents with `LlmAgent`](https://adk.dev/agents/llm-agents/)
- [Technical Overview](https://adk.dev/get-started/about/)
- [google/adk-python](https://github.com/google/adk-python)
