# Useful but Little-Known Features of ADK 2.0
๐ What if a long-running agent workflow could pick up right where it left off after a failure, instead of starting over from scratch?
ADK 2.0's ResumabilityConfig records workflow execution state as event logs, allowing you to resume from the point of failure by specifying an invocation_id.
๐ Title: Workflow Resumption (ResumabilityConfig)
๐ URL:
๐งฉ Overview
Setting ResumabilityConfig(is_resumable=True) on an App causes completed tasks to be logged as events during workflow execution. On failure, you can resume by providing the same invocation_id, and built-in agents automatically restore their state. SequentialAgent resumes from current_sub_agent, LoopAgent preserves times_looped and runs remaining iterations, and ParallelAgent executes only uncompleted sub-agents. This eliminates the waste of re-running completed steps when part of a large pipeline fails.
๐ How to use it
Set ResumabilityConfig on the App and pass invocation_id when resuming.
```python
from adk import App, ResumabilityConfig
app = App(
agent=my_workflow,
resumability_config=ResumabilityConfig(is_resumable=True)
)
# Initial run
result = await "process data")
invocation_id = result.invocation_id
# Resume after failure (same invocation_id)
resumed_result = await
input="process data",
invocation_id=invocation_id
)
```
For custom agents that need resumability, extend BaseAgentState to persist your custom intermediate state.
๐ Building it into production
ใปStore invocation_id in a database or message queue so it can be referenced during retries
ใปEnsure tool idempotency โ tools run at least once and may re-run on resume
ใปFor custom agents, extend BaseAgentState and explicitly define the intermediate state needed for resumption
ใปIn long-running workflows, insert checkpoint steps at regular intervals to enable finer-grained resumption
๐ก Use cases
๐ Efficiently recovering from mid-pipeline failures in large-scale data processing with dozens of steps
๐ฐ Avoiding wasted API billing by not re-calling expensive external APIs on retry
๐ Improving reliability of long-running agent execution in unstable network environments
๐ญ Continuing batch processing when some items fail, without reprocessing completed ones
โ ๏ธ Watch out
Tools may re-execute on resume (they run at least once), so any tool with side effects (database writes, external API calls, etc.) must be designed to be idempotent โ the same input should always produce the same result regardless of how many times it runs. Also note that ParallelAgent resume granularity is at the sub-agent level; intermediate state within a sub-agent is not preserved.
โจ ResumabilityConfig dramatically simplifies the operation of long-running workflows. The ROI is especially high for pipelines that include expensive or time-consuming steps.
#
ADK# #
AIAgent#