Sequential Workflow
Explore how to build sequential workflows with Google ADK by refactoring an AI system to use a SequentialAgent. Understand designing clear two-step pipelines, passing shared state between agents, and ensuring deterministic, reliable execution. This lesson helps you implement and orchestrate agents in a predictable sequence for more robust AI applications.
We have explored the principles of deterministic orchestration and the role of workflow agents in building predictable, production-grade AI systems. Now, we will put this theory into practice. In this lesson, we will apply these concepts by refactoring our Research Assistant to use the SequentialAgent.
This change represents a significant shift in our design philosophy. We will move from relying on an LLM’s dynamic reasoning to control the workflow to defining a hard-coded, explicit process. By doing so, we will create a system where the sequence of operations is guaranteed, making our agent more robust and its behavior perfectly predictable every time it runs.
Redesigning our research process as a pipeline
To begin, we will restructure our multi-agent system into a clear, two-step pipeline. This simplified structure is perfectly suited for the SequentialAgent and will allow us to focus on the mechanics of building a deterministic workflow.
Our new pipeline will consist of two distinct stages:
Research: This stage is responsible for gathering the foundational information on a given topic.
Write: This stage will take the information gathered in the first step, synthesize it into a coherent report, and save the final output to a file.
This design has a clear and logical dependency: a report cannot be written without the research notes. This strict, ordered dependency is the ideal use case for a SequentialAgent, which will act as the orchestrator to enforce this exact sequence of operations. For this lesson, we will focus ...