All skills
google avatar

/adk-architecture

@f7a1cd4
by googlegoogle/adk-python22k stars
4,084

Explains how the ADK runtime fits together: the node and graph execution model, Context and Event flow, checkpoint and resume, tracing, and the rules governing the public API surface. Use when answering "how does X work" about ADK internals, tracing where an event or a piece of state comes from, deciding where a new capability belongs, reviewing a change to BaseNode, Workflow, Runner, Agent, Event or Context, working out why a node re-ran or stayed waiting after a resume, or judging whether a change breaks the public API. Don't use for assembling an agent from existing pieces (use adk-agent-builder), diagnosing one failing run or test (use adk-debug), or formatting and naming conventions (use adk-style).

Use this Skill: https://skilld.dev/gh/google/adk-python/adk-architecture

This session only. Nothing lands on disk.

referencesarchitecture-checkpoint-resume.md

≈663 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Checkpoint and Resume Lifecycle

HITL (Human-in-the-Loop) follows this pattern:

  1. Interrupt: Node yields an event with long_running_tool_ids. Each ancestor propagates the interrupt upward via ctx.interrupt_ids.
  2. Persist: Only the leaf node's interrupt event is persisted to session. Workflow sets ctx._interrupt_ids directly (no internal event needed).
  3. Resume: User sends a FunctionResponse message. The Runner scans session events to find the matching invocation_id, then reconstructs node state from persisted events.
  4. Continue: The interrupted node receives the FR and continues execution. Downstream nodes receive the resumed node's output.

run_id on resume

Resumed nodes reuse the same run_id from the original execution. From the node's perspective, the execution never paused — events before and after the resume share the same run_id.

Fresh dispatches (first run, loop re-trigger) get a new run_id.

Resume behavior by rerun_on_resume

A node with multiple interrupt IDs may receive partial FRs (only some resolved). The behavior depends on rerun_on_resume:

rerun_on_resume=True (Workflow, orchestration nodes):

FRs received Status Behavior
Partial PENDING Re-execute immediately with partial resume_inputs. Node handles remaining interrupts internally (e.g., Workflow dispatches resolved children, keeps unresolved as WAITING).
All PENDING Re-execute with all resume_inputs.

This is critical for Workflow — when one child's FR arrives, it re-runs immediately to dispatch that resolved child. It doesn't wait for all children's FRs.

rerun_on_resume=False (leaf nodes, simple HITL):

FRs received Status Behavior
Partial WAITING Stay waiting. Need all FRs.
All COMPLETED Auto-complete. Output = aggregated resolved_responses. No re-execution.

Resume with prior output and interrupts

A node can produce output AND interrupt in the same execution (e.g., a Workflow where child A completes with output and child B interrupts). On resume:

  • Some interrupt IDs are resolved (provided in resume_inputs)
  • Remaining interrupt IDs carry forward via prior_interrupt_ids
  • Prior output carries forward via prior_output
  • NodeRunner pre-populates ctx with these values before re-executing
runner = NodeRunner(
    node=node, parent_ctx=ctx,
    run_id=prior_run_id,  # reuse
    prior_output=cached_output,
    prior_interrupt_ids={'fc-2'},  # still unresolved
)
child_ctx = await runner.run(
    node_input=input,
    resume_inputs={'fc-1': response},
)

Source: SKILL.md on GitHub

No alerts7d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    This skill consists of comprehensive architectural documentation for the Agent Development Kit (ADK). It provides technical guidance on the framework's node execution model, context scoping, and observability patterns. No security considerations were identified as the content is purely informational and follows standard developer documentation practices.

  • Socket7d

    No alerts

  • Snyk7d

    Risk: LOW · No issues

Signed by skilld at f7a1cd4. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last week

README badge

README badge for google/adk-python/adk-architecture