Is your feature request related to a specific problem?
When using adk run for development or long-running agent sessions, unexpected crashes cause complete session loss. Re-running adk run creates a fresh session with no context, forcing the agent to re-explain context and waste tokens on re-generation. This is especially painful for long multi-turn sessions.
Describe the Solution You'd Like
Add a --save-session-on-runtime flag (or config option) to adk run that periodically saves session state (tool call history, agent state, conversation context) to persistent storage during execution, not just on graceful exit.
On crash/re-run, the agent can resume from the last saved checkpoint rather than starting fresh. This mirrors the "session resume" pattern common in chat interfaces.
Describe Alternatives You've Considered
- Manual save — users periodically call a save tool manually. Works but requires discipline and is error-prone.
- Checkpointing via after_tool_callback — possible but requires custom user code, not built-in.
- Accepting crashes — just eat the token waste and re-run. Current behavior.
Proposed API / Implementation
adk run --save-session-on-runtime --checkpoint-interval 60
When enabled:
- Every N seconds (configurable), the session state is serialized to disk/SQLite
- On next
adk run with the same session_id, the agent loads the last checkpoint instead of starting fresh
- Checkpoint includes: conversation history, tool call log, agent memory state, turn count
Impact on your work
High impact — we run multi-hour agent sessions where a crash loses 30+ minutes of context. The token cost of re-explaining context is significant (50k+ tokens per recovery).
Willingness to contribute
Yes — I can implement this if the design is agreed upon.
Is your feature request related to a specific problem?
When using
adk runfor development or long-running agent sessions, unexpected crashes cause complete session loss. Re-runningadk runcreates a fresh session with no context, forcing the agent to re-explain context and waste tokens on re-generation. This is especially painful for long multi-turn sessions.Describe the Solution You'd Like
Add a
--save-session-on-runtimeflag (or config option) toadk runthat periodically saves session state (tool call history, agent state, conversation context) to persistent storage during execution, not just on graceful exit.On crash/re-run, the agent can resume from the last saved checkpoint rather than starting fresh. This mirrors the "session resume" pattern common in chat interfaces.
Describe Alternatives You've Considered
Proposed API / Implementation
When enabled:
adk runwith the same session_id, the agent loads the last checkpoint instead of starting freshImpact on your work
High impact — we run multi-hour agent sessions where a crash loses 30+ minutes of context. The token cost of re-explaining context is significant (50k+ tokens per recovery).
Willingness to contribute
Yes — I can implement this if the design is agreed upon.