Introduction to ADK 2.0 Workflows: Why Graph-Based Execution Matters
ADK 2.0 adds graph, dynamic, and collaborative workflows. Learn why moving orchestration out of prompts and into deterministic node-and-edge execution pays off.
Published on • November 30, 2026
AI Assistant

Ask a single LLM agent to “follow our refund process, check policy, then escalate anything over $100” and you get a process that usually follows your process. Sometimes it skips the policy check. Sometimes it invents an escalation path. Every step it re-decides costs a model call, a few seconds, and a handful of tokens — and none of it shows up in a diagram you can hand to a compliance reviewer.
Google’s Agent Development Kit (ADK) 2.0 answers this with workflows: an explicit way to compose multiple agents and executable nodes into a controlled execution structure. The headline addition is the graph-based workflow — a directed graph of nodes and edges where routing happens in code, not in a prompt.
This post introduces the ADK 2.0 workflow landscape, shows what a graph actually looks like in Python, and explains why graph-based execution changes the reliability and cost profile of an agent application.
1. The Problem: Control Flow Written in Prose
Prompt-based agents encode their process as instructions: “First check the inventory, then verify the customer’s plan, then if the plan is expired, ask for an upgrade.” As procedures grow, three things break:
- Reliability degrades. Longer instructions mean more guidelines the model has to hold in context simultaneously. Compliance steps buried in paragraph four get skipped under time pressure.
- Cost scales with indecision. If every transition is a model decision, a ten-step process pays for ten extra reasoning turns that a
forloop could have executed deterministically. - Nothing is auditable. You cannot point a reviewer at “what happens after step three” because there is no step three — only prose.
ADK’s own framing is that workflows bring predictability (controlled task execution using templated or graph-based mechanisms), reliability (tasks run in the required order consistently), and structure (separated responsibilities and limited data contexts per task).
2. The ADK 2.0 Workflow Family
ADK 2.0 does not ship one workflow mechanism — it ships a small family, and picking the right member matters more than any syntax:
| Workflow type | Who decides what runs next | Best for |
|---|---|---|
| Graph-based workflows | The graph you declare in code | Processes you can draw before the input arrives |
| Dynamic workflows | Your own Python code at runtime | Shape depends on input: runtime fan-out, recursion |
| Collaborative workflows | A single coordinator agent choosing among sub-agents | A known team where each request picks the subset |
| Template workflows | Fixed structures (SequentialAgent, ParallelAgent, LoopAgent) | Common linear/parallel/iterating patterns |
The templates predate 2.0 and remain perfectly good tools for simple shapes. Graphs are the new default recommendation when you need branching, joins, or non-agent nodes. Dynamic workflows are the escape hatch when the control flow itself is too iterative or recursive for any static graph. Collaborative workflows let one agent act as a dynamic coordinator over sub_agents.
The three 2.0 styles compose: a graph node can call a collaborative coordinator, and a specialist can launch a dynamic workflow.
3. Anatomy of a Graph: Nodes, Edges, and START
A graph workflow is a directed graph. Nodes are execution units; edges connect them and define the order and conditions of execution. A node can be an AI agent, an ADK tool, a human-input task, or a plain Python function you wrote.
Here is the smallest interesting graph — generate a city, look up its time in code, report it:
from google.adk import Agent, Workflow, Event
from pydantic import BaseModel
city_generator_agent = Agent(
name="city_generator_agent",
model="gemini-flash-latest",
instruction="Return the name of a random city. Return only the name.",
)
class CityTime(BaseModel):
time_info: str
city: str
def lookup_time_function(node_input: str):
"""Deterministic code — no model call."""
return CityTime(time_info="10:10 AM", city=node_input)
city_report_agent = Agent(
name="city_report_agent",
model="gemini-flash-latest",
input_schema=CityTime,
instruction="You receive a CityTime. Reply with one sentence stating "
"that it is that time in that city right now.",
)
root_agent = Workflow(
name="root_agent",
edges=[
("START", city_generator_agent, lookup_time_function, city_report_agent),
],
)
The edges list is the whole program. The string "START" is the built-in entrypoint sentinel; a row beginning with it runs each listed node once, in order, passing every node’s return value to the next node as its input. Only one node in the chain — the last one — ever calls a model.
┌──────────────────────┐
"START" ─────▶│ city_generator_agent │ LLM node
└──────────┬───────────┘
▼
┌──────────────────────┐
│ lookup_time_function │ FunctionNode (no AI)
└──────────┬───────────┘
▼
┌──────────────────────┐
│ city_report_agent │ LLM node
└──────────────────────┘
4. Why Graph-Based Execution Matters
Four properties fall out of moving control flow into the graph:
Deterministic routing
Branching is a Python function returning an Event(route=...), dispatched by a dict on the next edge:
def router(node_input: str):
if amount_over_threshold(node_input):
return Event(route="RUN_TASK_C")
return Event(route="RUN_TASK_B")
root_agent = Workflow(
name="routing_workflow",
edges=[
("START", process_message, router),
(router, {"RUN_TASK_B": task_b, "RUN_TASK_C": task_c}),
],
)
The model may classify; the graph decides. A hallucinated approval path is now impossible because the approval threshold is a Python comparison, and the code is unit-testable in isolation.
Chains of functions without AI
The docs list this as a first-class advantage: “Run chains of functions without AI — call agent tools and your own code without invoking a generative model.” Database lookups, Stripe calls, and CRM updates become fast, free, zero-variance steps.
Tight data contexts
Each node receives only the previous node’s output. The email-drafting agent never sees the policy corpus the analysis agent loaded — smaller prompts, fewer distractions, lower token bills.
A map reviewers can audit
Node names, routes, and event history line up with the diagram you drew. Where a free-running loop only shows what happened to happen, a graph shows what was supposed to happen, and the trace proves it did.
5. How Data Moves: Events, Not Chat History
Inside a graph, nodes pass data through events rather than through accumulated conversation history:
output— the value handed to the next node. A plainreturnof any serializable value is enough; ADK wraps it for you.message— text intended for the user, which the runtime renders but does not forward to the next node.state— session-scoped persistence (app:,user:,temp:prefixes) for values that must outlive a single edge or be read by tools and{key}instruction templating.
Schemas make the contract explicit: give a producing node an output_schema or a consuming agent an input_schema (a Pydantic BaseModel) and the payload is validated at the boundary instead of blowing up three nodes downstream.
from google.adk import Event
def my_function_node(node_input: str):
return Event(output=node_input.upper())
Two rules worth memorizing: a node may emit many events, but only one of them may carry output, and Event.route is independent of output, so a single event can both pick a branch and forward a payload to it.
6. Graphs vs. Templates vs. Free-Running Agents
| Free-running agent | Template workflow | Graph workflow | |
|---|---|---|---|
| Who picks the next step | The model | Fixed structure | Your edge list |
| Branching | Unbounded, probabilistic | Loop exit conditions only | Routes, back-edges, joins |
| Non-agent steps | Tool calls inside a turn | Sub-agents only | Functions, tools, HITL, agents |
| Cost ceiling | None | max_iterations | Per-node retries/timeouts |
| Audit artifact | Event log | Event log | Graph + event log |
The pragmatic rule: if a prebuilt SequentialAgent / ParallelAgent / LoopAgent does the job, use it. Reach for a graph when you need routing, a join, or nodes that are not agents. Reach for a dynamic workflow when the shape of the work only becomes known at runtime.
7. Known Limitations
The graph page is candid about the trade-offs:
- Some third-party integrations are not compatible with graph-based workflows.
- Agent modes are constrained inside a graph: an agent node defaults to
single_turn, and achat-mode agent is only allowed directly afterSTART, because it consumes conversational history rather than node input. - A workflow must end in a single terminal output node. Two parallel branches that both produce output cause a
ValueError— merge them with aJoinNodefirst. - Cycles need a routed edge. A loop built only from unconditional edges is rejected when the
Workflowis constructed.
8. Checklist: Is a Graph Workflow the Right Call?
- The process can be drawn as a diagram before the input arrives → graph.
- Steps that always happen in the same order are functions, not agent turns.
- Only genuinely ambiguous decisions are delegated to a model node.
- Branch conditions live in Python and have unit tests.
- Node outputs are typed with
input_schema/output_schema. - The graph has exactly one terminal node producing output.
- Loops carry a routed exit and a retry/iteration budget.
- The shape of the work is only known at runtime → use a dynamic workflow instead.
Graph-based workflows are not about replacing models with code — they are about spending model calls only where reasoning actually buys something. In the next posts in this series we zoom into the primitives themselves: nodes, edges, and the built-in START entrypoint.