Skip to content
Blog

ADK Design Patterns: Single Agent, Pipeline, and Swarm Topologies

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.

Published on • November 25, 2026

AI Assistant

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.

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.
# 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 ───┘
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_schemas 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

SituationPattern
One coherent job, moderate tool countSingle agent
Fixed multi-step process with quality gatesPipeline
Varied requests, parallelizable subtasksSwarm
Fixed steps and parallel fan-out inside a stepPipeline of swarms (hierarchy)
Need different models per subtaskSwarm (or routed models at one agent)
Latency budget < 2sSingle 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_keys) and keeping each extracted agent independently testable. The package anatomy 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, pipelines need deadlines per stage, and workers should expose typed results via Pydantic output_schemas. When one topology needs more or less capability per node, dynamic model routing is the next lever.

References