adk-go icon indicating copy to clipboard operation
adk-go copied to clipboard

Session Time Travel and Forking

Open verdverm opened this issue 1 month ago • 4 comments

I'm working on a custom coding agent and this is a feature I want to have. It is unclear where this support should live. Some thoughts and questions

  1. Having this feature in ADK generally seems really useful across every downstream application
  2. It could facilitate making better testing data for evals, synth or hand crafted
  3. It would have implications for how this is supported in the other services (like Artifacts), namespacing, but also linking?
  4. Sessions should ideally remain accurate when loading later on. This would mean having a snapshot of the app & user state at the time they were created would be needed, if they use or modify, for their inputs and deltas to remain stable long term
  5. Is this possible today without changes to ADK? I think so, but requires some forethought for said namespacing to avoid collision with users and/or sessions. I'll let you know what I learn!

At some point it starts to sound like git, container layers, crdt, deltadb on a per-session basis, OCI intrigues me in this regard

verdverm avatar Nov 22 '25 22:11 verdverm

Thanks for reaching out!

Our current focus for ADK Go is on the upcoming 1.0 release, and while session snapshotting/rewind is an interesting concept, it isn't on our immediate roadmap.

Having said that, we are exploring similar ideas for state management in ADK Python, and this will eventually land in ADK Go as well, after the 1.0 release. We'd be open to community contributions in this area for ADK Go, especially any approaches that might align with the Python explorations.

mazas-google avatar Nov 24 '25 16:11 mazas-google

I have some ideas for how to do this without changes to the framework, mainly through clone + event trimming to a snapshot, unless the user wants it on the current session

Should be doable, and with Dagger in the mix, I should be able to accomplish this for both the session history / state, plus the file system and execution environment.

One goal would be able to replay a session, mocking in the LLM responses and tool calls, arriving at the same point. I think one will have to capture user changes to files in the middle of the session, which I think can be done by doing all the R/W against a container layer and then having a way to call that out

verdverm avatar Nov 25 '25 07:11 verdverm

@mazas-google I want to link in this other command / PR #318 | https://github.com/google/adk-go/pull/318#discussion_r2573208858 (Abstractions over Batteries)

In that regard, I don't think there should be a concept of function "Timetravel", "Rewind", or the like. I've been able to do that with what's already available in the interfaces today. A few tweeks might be needed, but a first class concept probably not. What might be better is having a Clone, Fork, Prune on Sessions, and some other QoL around event editing / management outside of the core chat loop. In this sense, aim for an API and Abstraction that supports many use cases rather than anything named tied to a specific user experience.

Can you link me to the Python explorations? Are most of the API design discussions happening through the Python project and forums therein?


Some more links / refs:

  • https://github.com/google/adk-python/discussions/3187

verdverm avatar Nov 29 '25 22:11 verdverm

Some other capabilities to use-cases

  1. queuing and squashing a number of user events into one, maybe via parts?
  2. pausing / continuing conversations with agents or agents with subagents
  3. mailboxs / channels / labels

use-case:

  1. coding agent, user edits generated code before sending next message. It would be nice if ADK had some concepts / interfaces for bundling these up
  2. my coding agent uses a context collector subagent, having the primary return to the subagent with clarification or followup, in the same turn or long term
  3. Follows on from that I might need multiple channels for both of these when we have teams of agents running around and up to no good :]

verdverm avatar Nov 30 '25 00:11 verdverm