Skip to content
Blog

Resuming Interrupted Workflows: rerun_on_resume and Idempotency Guarantees

Understand re-entry vs handoff semantics with rerun_on_resume, how ADK checkpoints completed child nodes, and how to write node bodies that stay correct across crash and human-input resumes.

Published on • December 2, 2026

AI Assistant

A payment-enrichment workflow has run for four minutes when the API server restarts. Twelve of fifteen nodes finished. Should the resume re-run node three — charging a card a second time — or skip straight to where it stopped? That single question is answered by one flag: rerun_on_resume. Get it wrong in the True direction and you re-execute side effects; get it wrong in the False direction and your orchestrator never receives the child results it needs to continue.

ADK’s resume story has three moving parts: the rerun_on_resume mode on each node (re-entry vs handoff), automatic checkpointing of completed child executions, and your job of writing node bodies that are safe to run again. This post covers all three, plus the custom execution IDs that control how checkpoints are keyed.

Prerequisites

  • ADK 2.0 dynamic workflows: @node, ctx.run_node, and the Workflow(edges=[...]) shell. Our earlier graph workflow posts cover the basics.
  • Familiarity with human-in-the-loop pauses (RequestInput) helps, since human input is the most common resume trigger.

1. The two resume modes

When a workflow pauses — a human input node, a long-running confirmation, a crash — every node has to decide what to do when execution restarts. rerun_on_resume picks between exactly two behaviors:

from google.adk import Context
from google.adk.workflow import node


@node(rerun_on_resume=True)          # re-entry
async def my_workflow(ctx: Context, node_input: str) -> str:
    result = await ctx.run_node(my_node, node_input="hello")
    return result
  • rerun_on_resume=True (re-entry). The node body re-runs from the top. This is mandatory for any orchestrator that calls ctx.run_node(), because re-entering the body is how the engine hands back the cached results of children that already finished — they are skipped, not re-executed, and the body continues from the point it was interrupted.
  • rerun_on_resume=False (handoff — the leaf default). The node body does not re-run. The resume payload is routed directly to the node’s successor as its input, bypassing the interrupted node entirely.

The handoff default is exactly what you want for a leaf human-input node:

from google.adk import Context
from google.adk.events import RequestInput
from google.adk.workflow import node


@node(rerun_on_resume=False)         # leaf default, stated for clarity
async def get_user_approval(ctx: Context, node_input):
    yield RequestInput(message="Please approve this request (Yes/No)")


@node(rerun_on_resume=True)          # orchestrator: must re-enter
async def handle_process(ctx: Context, node_input):
    user_response = await ctx.run_node(get_user_approval)
    if user_response.lower() == "yes":
        return "Approved"
    return "Denied"

The approval node emits RequestInput, pauses, and never runs again — the human’s reply becomes its output and flows to the next step. The orchestrator that called it does re-run from the top, so it can collect that reply from the checkpointed child.

The one-line rule: if the body calls ctx.run_node(), it must set rerun_on_resume=True. A re-entry orchestrator is the vehicle that delivers cached child results; without re-entry, those results have nowhere to land.

2. Automatic checkpointing: what actually gets re-run

Dynamic workflows track each node execution individually. On resume:

  • Completed child activations are skipped automatically. The engine recognizes a child by its execution ID and replays its recorded result instead of executing it again.
  • Only failed or interrupted nodes re-execute — including parallel workers fanned out with asyncio.gather. If 20 workers were running and 7 finished before the pause, resume runs the other 13.
  • The orchestrator body itself re-executes top-to-bottom, but every ctx.run_node() call inside it resolves from the checkpoint for children that already succeeded.

This is what makes the pattern below safe — the loop re-enters, but the work doesn’t:

@node(rerun_on_resume=True)
async def code_workflow(ctx: Context, node_input: str):
    code = await ctx.run_node(coder_agent, node_input)
    check_resp = await ctx.run_node(compile_lint_check, code)

    while check_resp.findings:
        code = await ctx.run_node(fixer_agent,
                                  {"code": code, "findings": check_resp.findings})
        check_resp = await ctx.run_node(compile_lint_check, code)

    return code

Resume in the middle of iteration 4 and the coder_agent and the first three compile_lint_check runs come back from their checkpoints; the in-flight fixer_agent run restarts. Values live in local variables — the re-entered body rebuilds them from the checkpointed outputs, so you don’t need to stash loop state in session state by hand.

Enabling durable resume

Checkpointing inside a run is automatic; surviving a process restart requires opting in at the app level:

# App and ResumabilityConfig come from the google.adk package
app = App(
    name='my_resumable_agent',
    root_agent=root_agent,
    resumability_config=ResumabilityConfig(is_resumable=True),
)

You then resume by supplying the invocation ID of the stopped run — visible in the session’s event history — either through the API server:

curl -X POST http://localhost:8000/run_sse \
 -H "Content-Type: application/json" \
 -d '{
   "app_name": "my_resumable_agent",
   "user_id": "u_123",
   "session_id": "s_abc",
   "invocation_id": "invocation-123"
 }'

or programmatically via runner.run_async(user_id=..., session_id=..., invocation_id=...). Two caveats from the docs: resuming from the ADK Web UI or CLI is not currently supported, and you must not modify a stopped workflow (adding or removing agents) before resuming it.

3. Writing node bodies that survive re-entry

Checkpointing skips completed children — it does not make an interrupted child’s side effects disappear. The restartable unit is the node body, so the body must be correct when run a second time:

  1. Make external writes idempotent. ADK’s own resume guidance is blunt: tools and steps are guaranteed to run at least once and may run more than once on resume. Use idempotency keys — INSERT ... ON CONFLICT DO NOTHING, upserts, natural keys — so a repeat is a no-op rather than a duplicate charge.
  2. Split “check” from “commit.” Put the unreliable read (model call, API fetch) in one node and the side effect in a later node. On resume the read re-runs cheaply; the write runs only after it succeeds.
  3. Order operations so an interruption lands between safe points. If a node must do A then B, and A is destructive, write a checkpoint (an event, a state key) after A so resume logic can tell “A done, B pending” from “nothing done.”
  4. Don’t assume you’re running exactly once. Any if not already_done: guard that reads local variables is worthless after a restart — guards must read durable state (session state, events, your database), not the call stack.
  5. Remember retry budgets reset. Attempt counts for retries are kept in memory for the current run; a resumed node starts at attempt 1. Don’t rely on “we already retried twice” as a permanent failure signal.
@node
async def charge_card(node_input: Order):
    # Idempotency key derived from the order, not from this run:
    # a duplicate execution charges the same key, never twice.
    return payments_client.charge(
        amount=node_input.total,
        idempotency_key=f"order-{node_input.order_id}",
    )

4. Execution IDs: how checkpoints are keyed

ADK generates a deterministic execution ID for each child node run from the parent’s ID plus a counter. These IDs are how the engine decides “this child already ran, replay its result.” Because they are derived from the order of ctx.run_node() calls, keeping your orchestrator’s call order stable across runs is what keeps checkpoints matching up.

In rare cases — typically processing a reorderable list — positional IDs don’t line up with logical work, and you can supply your own:

@node(rerun_on_resume=True)
async def process_all_orders(ctx: Context, node_input):
    orders = await get_orders()
    tasks = [
        ctx.run_node(process_order, order, run_id=f"order-{order.order_id}")
        for order in orders
    ]
    return await asyncio.gather(*tasks)

Rules and warnings:

  • Custom run_id values must contain at least one non-numeric character. Auto-generated IDs are sequential integers ("1", "2", …), and a numeric custom ID would collide with them.
  • The docs explicitly warn against custom execution IDs. They are used to determine execution order, and a bad custom ID can break re-runs. Only reach for them when the mapping from call order to logical work is genuinely unstable — and when you do, make the ID deterministic for a given input, so the same order always produces the same ID.
  • Prefer stable ordering in your code (sort the list) over custom IDs; it solves the same problem without touching the checkpoint key space.

5. Resume after a crash vs resume after a human pause

The same machinery serves both, but the trigger differs:

Human pause (RequestInput)Crash / restart
TriggerNode yields RequestInput; workflow stops cleanlyProcess dies, network drops, system goes offline
Paused nodeLeaf: handoff — reply becomes its outputInterrupted node re-runs (or is skipped if it had completed)
OrchestratorRe-enters via rerun_on_resume=TrueRe-enters via rerun_on_resume=True
How you resumeSupply the human’s response through the clientRestart the server, supply the invocation_id
CheckpointsCompleted children skippedCompleted children skipped

The key insight is that both paths converge on the same contract: re-enter orchestrators, checkpoint children, treat side effects as at-least-once.

One TS-side detail worth knowing if you check child results: ctx.run_node() does not throw when a child interrupts — it returns normally with the interrupt recorded and the output still empty. Python’s documented examples treat the returned value as the child’s output directly, so make sure a pause actually resolved before you branch on the value; an orchestrator that treats a missing output as an answer will act on a reply the user never gave.

Checklist

  • Every node whose body calls ctx.run_node() sets rerun_on_resume=True.
  • Leaf nodes that only emit RequestInput keep the False handoff default.
  • All external writes are idempotent (idempotency keys / upserts).
  • Side effects live in separate nodes from unreliable reads.
  • App has ResumabilityConfig(is_resumable=True) if you need crash recovery.
  • Invocation IDs are captured from event history for later resume.
  • Custom run_ids are avoided unless the list is reorderable — and then contain a non-numeric character.
  • No workflow changes are made between stopping and resuming.

rerun_on_resume is not a performance setting; it is a statement about where your node’s authority lies. Re-entry says “my body is the orchestrator and it must run again to collect what it started.” Handoff says “my output was already delivered; get out of the way.” Choose deliberately, checkpoint the rest, and write every node body as if it might run twice — because, at-least-once, it will.

References