Core Graph Primitives: Nodes, Edges, and the Built-In START Entrypoint
A hands-on tour of ADK graph primitives: what counts as a node, how edge rows and routes work, and why the built-in START sentinel anchors every graph.
Published on • November 30, 2026
AI Assistant

Every ADK graph workflow is built from exactly three things: nodes (things that run), edges (connections that say what runs next), and a built-in START entrypoint (where execution begins). Everything else — branching, fan-out, loops, nested workflows — is a composition of those three.
The syntax is deliberately small, which means most “why doesn’t my graph work” bugs come from a misunderstanding of one of them. This tutorial walks each primitive in order, with the exact rules the ADK graph engine enforces.
from google.adk import Agent, Workflow, Event
from google.adk.workflow import START, JoinNode
1. Nodes: The Things That Execute
A node is any discrete unit of work in the graph. The docs are explicit about what can be one: agents, ADK tools, human-input tasks, and your own code functions. A Workflow is itself a node, so graphs nest.
The simplest node is a plain Python function:
from google.adk import Event
def my_function_node(node_input: str):
input_text_modified = node_input.upper()
return Event(output=input_text_modified)
What matters here is the contract:
node_inputis the previous node’s output, delivered as typed data.outputis what the next node receives. Returning a bare value works too — ADK wraps it in an event for you.- A node may
yieldmultiple events for progress reporting, but only one event per execution may carryoutput. - Node names must be valid Python identifiers and unique within the graph — the name is what joins, traces, and the audit log key off.
For anything beyond a bare function, the @node decorator (or node(...) function) is the generic wrapper. It accepts a BaseNode, an agent, a tool, or a callable and lets you override per-node behavior:
from google.adk.workflow import RetryConfig, node
@node(name="fetch_orders", timeout=10.0, retry_config=RetryConfig(max_attempts=3))
def fetch_orders(node_input: str) -> dict:
return {"orders": lookup_orders(node_input)}
Every node carries four knobs that matter in production: rerun_on_resume (does the node body re-run after a human-input interrupt?), retry_config, timeout, and input_schema / output_schema.
2. The Built-In START Entrypoint
Every graph needs an entry, and ADK gives you one for free. START is a sentinel node exported from google.adk.workflow (and accepted interchangeably as the string "START" in edge rows). Two properties explain most entrypoint confusion:
STARTis never executed. It is a marker. The workflow records your input and the branch under its name, then seeds triggers directly onto its successors.- You never define it. There is no “create a start node” step — you only reference it as the first element of an edge row.
from google.adk.workflow import START
root_agent = Workflow(
name="demo",
edges=[("START", task_A_node)],
)
A row beginning with START runs each listed node once, in order:
edges=[("START", task_A_node)] # one node
edges=[("START", task_A_node, task_B_node, task_C_node)] # three, in order
The catch: listing START in more than one row creates parallel paths, not a repeat run. That is how fan-out works, and it is also how you accidentally create two competing entry branches.
┌─── task_A ──┐
START ──────┼─── task_B ──┼─── join ───▶ final
└─── task_C ──┘
(three rows, each starting with "START")
3. Edges: Sequences, Branches, and Back-Edges
An edge row is either a sequence or a branch.
Sequence rows
A tuple whose first element is START (or any single source node) followed by node-like values runs them in order and forwards each output to the next. That is the whole story for linear pipelines.
Branch rows
A row whose first element is a node that emits route values, followed by a dict mapping route value → target node:
from google.adk import Event, Workflow
def router(node_input: str):
if condition(node_input):
return Event(route="RUN_TASK_C")
return Event(route="RUN_TASK_B")
task_B_node = Agent(name="task_B_agent")
def task_C_node(node_input: str):
return Event(output="Task C completed")
root_agent = Workflow(
name="routing_workflow",
edges=[
("START", task_A_node, router),
(router, {
"RUN_TASK_B": task_B_node, # target can be an agent...
"RUN_TASK_C": task_C_node, # ...or a function
}),
],
)
Rules that bite:
- Route values can be strings, numbers, or booleans. A route dict key that the router never emits is dead code.
DEFAULT_ROUTEcatches any value that no other branch on the same source node matched — always define it if your classifier is free-form.routeandoutputare independent: one event can select a branch and forward a payload to it.
Back-edges (loops)
Routing back to an earlier node makes a cycle. Two constraints are enforced at build time:
- A cycle must contain at least one routed (conditional) edge. An unconditional-only cycle is rejected when the
Workflowis constructed. - The router must have a terminal branch (
"DONE": final_task_node) or the loop never exits.
root_agent = Workflow(
name="looping_workflow",
edges=[
("START", task_A_node, router),
(router, {
"RETRY": task_A_node, # back-edge: another iteration
"DONE": final_task_node,
}),
],
)
4. Fan-Out and Fan-In with JoinNode
Parallelism is expressed by repeating START (or any shared source), and convergence is expressed with a JoinNode — the fan-in barrier that waits for every predecessor and then hands its successor a collection of outputs:
from google.adk.workflow import JoinNode
my_join_node = JoinNode(name="my_join_node")
edges = [
("START", research_A, my_join_node),
("START", research_B, my_join_node),
("START", research_C, my_join_node),
(my_join_node, final_D),
]
START ─┬─ research_A ─┐
├─ research_B ─┼─ join ─▶ final_D
└─ research_C ─┘
The join releases after all predecessors finish and passes a record keyed by predecessor node name. One documented trap: every node feeding a join must produce output of its own. A predecessor that finishes with no output leaves that branch of the join empty, and the failure surfaces downstream, far from the node that caused it. Attach a retry_config to any join feeder that can fail.
5. Nested Workflows and the Single-Terminal-Output Rule
Because a Workflow is a node, you can route to one:
root_agent = Workflow(
name="parent_workflow",
edges=[
("START", task_A1, router),
(router, {
"RUN_WORKFLOW_B": workflow_B,
"RUN_WORKFLOW_C": workflow_C,
}),
],
)
While the inner graph runs, each of its node events bubbles up to the parent for traceability. When it finishes, the output of its terminal node becomes the output of the nested-workflow node.
That produces the strictest rule in the whole system: a workflow must have at most one terminal node that produces output. If two parallel branches each end with an output, the workflow fails with a ValueError. Merge them with a JoinNode so the graph ends in a single terminal output.
6. A Diagnostic Checklist for Failing Graphs
When a graph refuses to build or stalls at runtime, check these in order:
WorkflowConfigurationErroron construction → you passed something that is not aBaseNode, agent, tool, or callable; or a cycle has no routed edge; ormax_parallel_workerswas set withoutparallel_worker=True.ValueErrorabout multiple outputs → two terminal nodes produce output; add aJoinNode.- Node stuck in
WAITING/ deadlock → await_for_outputnode never yielded an output or route. Completing without ever emitting output is treated as a configuration error. - Join fires with a missing branch → a predecessor finished without output.
- Dead branch → route values in the dict do not match what the router emits; add
DEFAULT_ROUTE. - Name collision or invalid identifier → rename the node; the name must be a valid Python identifier.
- Agent behaving oddly in a graph → agent nodes default to
single_turnmode inside graphs; achat-mode agent is only valid directly afterSTART.
7. Recap Checklist
- Every graph starts at
"START"/START, which you never execute yourself. - One
STARTrow = sequential run; multipleSTARTrows = parallel paths. - Nodes are agents, tools, human-input tasks, functions, or nested workflows.
- Branching = a router emitting
Event(route=...)+ a dict edge, withDEFAULT_ROUTEcovered. - Loops = back-edges, and every cycle needs at least one routed edge plus an exit.
- Fan-in =
JoinNode, and every join feeder must produce output. - Exactly one terminal node produces output in the whole graph.
- Node names are unique, valid Python identifiers — they are your audit keys.
With the primitives in hand, the next step is assembling a complete, runnable workflow from scratch.