feat(runners): stop a live agent and edit a previous prompt - #6841
Open
a2105z wants to merge 1 commit into
Open
Conversation
Users have had no way to abort a running invocation or replace an earlier user turn. cancel_async stops the live run; edit_message_async rewinds that turn and regenerates. REST endpoints expose both for adk web. Fixes google#3849
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
Summary
This issue has been open since December. Chat UIs still cannot stop a live agent or edit a previous prompt.
Stop.
Runner.cancel_async(user_id=, session_id=, invocation_id=None)aborts the live invocation: LLM loops seeend_invocation, blocked tool/model work is cancelled, and aninterrupted=Trueevent is persisted.POST /apps/{app}/users/{user}/sessions/{session}/cancelexposes it./run_ssealso cancels when the client disconnects, matching/run.Edit.
Runner.edit_message_async(...)cancels anything in flight on that session, rewinds to the targeted user turn (rewind_async), then regenerates with the new prompt.POST /apps/{app}/users/{user}/sessions/{session}/editexposes it.Testing Plan
Unit Tests:
Covers: cancel of a blocked BaseAgent and LlmAgent, idempotent cancel, edit of a completed earlier turn, edit of a live turn (cancel + rewind + regenerate), REST cancel/edit, existing
/run_ssedisconnect tests.Checklist
Additional context
cc @sertacakdogan @klateefa @wuliang229 @Jacksunwei @yeesian @xuanyang15 @steren @llalitkumarrr @GWeale — ready for review. This is the ChatGPT-class stop + edit-prompt flow requested on #3849 (open since Dec 2025).