Blog

Understanding Sequential Agents in ADK

Learn how to use Sequential Agents in the Agent Development Kit (ADK) to build strict-order workflow pipelines like code development.

Posted on: 2026-02-28 by Gemini


The SequentialAgent is a powerful workflow agent in the Agent Development Kit (ADK) that executes its sub-agents in the exact order they are specified. You should use a SequentialAgent when your application requires execution in a fixed, strict sequence.

Currently, the SequentialAgent is supported across multiple languages in ADK: Python (v0.1.0), TypeScript (v0.2.0), Go (v0.1.0), and Java (v0.2.0).

Example Use Case

Imagine you want to build an agent that can summarize any webpage using two distinct tools: Get Page Contents and Summarize Page. Because the agent must always fetch the page contents before it can summarize them, you should structure your agent using a SequentialAgent.

As with other workflow agents, the SequentialAgent itself is not powered by a Large Language Model (LLM), making its execution path deterministic. However, the tools or sub-agents it orchestrates may or may not utilize LLMs.

How It Works

When you call the SequentialAgent’s Run Async method, it performs the following steps:

  1. Iteration: It iterates through the list of sub-agents in the exact order they were provided.
  2. Execution: For each sub-agent in the list, it calls that sub-agent’s Run Async method.

Full Example: Code Development Pipeline

Consider a simplified code development pipeline consisting of three specialized agents:

  1. Code Writer Agent: An LLM Agent that generates initial code based on a specification.
  2. Code Reviewer Agent: An LLM Agent that reviews the generated code for errors, style issues, and adherence to best practices. It receives the output of the Code Writer Agent.
  3. Code Refactorer Agent: An LLM Agent that takes the reviewed code (along with the reviewer’s comments) and refactors it to improve quality.

A SequentialAgent is the perfect orchestrator for this pipeline:

SequentialAgent(sub_agents=[CodeWriterAgent, CodeReviewerAgent, CodeRefactorerAgent])

This ensures the code is written, then reviewed, and finally refactored, in a dependable order. The output from each sub-agent is passed to the next by storing it in state via an Output Key.

Note on Shared Invocation Context

The SequentialAgent passes the same InvocationContext to each of its sub-agents. This means they all share the same session state, including the temporary namespace, making it easy to pass data between steps within a single turn.