Google ADKgoogle-adk 2.8 · Python 3.10+
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
28 small wins to finish your pathNext lesson

Workflows, and which shape to use

The three agents in the last three lessons are on their way out. ADK 2.0 added a Workflow, which does the same jobs and more.

Every one of those lessons printed the same warning: deprecated in favour of Workflow, and Workflow cannot yet be used as a sub agent of an LlmAgent. Both halves matter.

A workflow is a graph

python
from google.adk import Workflow

draft = LlmAgent(
    name="draft",
    model=PretendModel(replies=[say("dear customer, sorry")]),
    instruction="Write a first reply.",
)

An ordinary agent, with no output key this time. A workflow passes each node's result to the next one directly.

python
def shout(node_input):
    """An ordinary function, as a step in the workflow."""
    return str(node_input).upper()

This is the part the template agents could not do: a plain function as a step. No model is called for it, so it costs nothing.

python
polish = LlmAgent(
    name="polish",
    model=PretendModel(replies=[say("Dear customer, we are sorry.")]),
    instruction="Fix the tone.",
)

writer = Workflow(name="writer", edges=[("START", draft, shout, polish)])

One edge, listing what follows what. Instead of nesting agents inside a sequence, you say the route.

Example
await run(writer, "The order was late")

Same result as the sequence in lesson 17, with a function in the middle that no model had to be asked about.

  • Functions are first class nodes. No wrapping string handling in an agent.
  • Routing is explicit. Edges say what follows what, including branches.
  • Fewer model calls. A deterministic step costs nothing at all.

ADK also offers dynamic workflows, where the control flow is ordinary Python with loops and conditions, and collaborative workflows, where one agent coordinates others.

The catch, said plainly

A Workflow cannot yet be a sub agent of an LlmAgent. So if your design is an agent that hands work to a fixed sequence, the deprecated SequentialAgent is still what does that today. That is why this course teaches both.

ADK also offers dynamic workflows, where you write the control flow as ordinary Python with loops and conditions, and collaborative workflows, where one agent coordinates others. Those are the two ends of the same idea: as much or as little structure as the job needs.

The catch, said plainly

A Workflow cannot yet be used as a sub agent of an LlmAgent. So if your design is an agent that hands work to a fixed sequence, the deprecated SequentialAgent is still the thing that does that today. That is why this course teaches both, and why the last three lessons were not a waste of your time.

Which shape to use

ShapeWho decides the orderUse when
One LlmAgent with toolsThe model, per turnThe job is a model choosing tools in a loop
Sub agents and transferThe model, onceDifferent kinds of problem, different specialists
WorkflowYou, as a graphThe steps are fixed, and some of them are plain code
SequentialAgent and friendsYouThe same, when it has to sit under an LlmAgent
A custom agentYou, in PythonControl flow none of the above can express

The first two are model-driven and flexible. The rest are code-driven and predictable. Prefer the predictable one wherever the order is genuinely fixed, and prefer a workflow over the template agents in new code.

A worked decision

  • Answering order questions: one LlmAgent with tools. The model decides which lookup to run.
  • Billing: a sub agent with a transfer. Different problem, different tools.
  • The monthly summary: a workflow. Gather, count, write, with the counting as a function rather than an agent.
Reading older material
When you read older ADK tutorials, and there are a lot of them, they will use SequentialAgent and its two siblings everywhere. That code still runs. Knowing it is deprecated, and why it is still needed under an LlmAgent, is the thing those tutorials cannot tell you.
Try it yourself
  • Rewrite the sequence from lesson 17 as a workflow and delete the polish agent's template.
  • Put a function node between two agents that does something a model should never be asked to do, like arithmetic.

Every expert started right here.