How to cancel or stop an in-flight agent invocation and remove it from context #4156
Replies: 1 comment
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: ADK provides mechanisms to cancel in-flight requests and manage session context. For standard Hello! Thank you for the detailed questions. Here are the recommended patterns for handling invocation cancellation and context management in ADK based on your use case. 1. Canceling a
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using ADK to handle user queries that can take a non-trivial amount of time to process.
Use case
A user submits a query.
The agent starts processing the query.
Before the agent finishes, the user realizes the query needs to be edited.
The user wants to:
The user then resubmits a modified query.
Questions
Does ADK support cancellation of an in-flight invocation (for example via request ID, session ID, or cancellation token)?
If using
streamQuery, is there a supported way to terminate the stream such that the agent execution is also stopped on the backend?If a client disconnects early, does ADK automatically stop execution or does the agent continue running?
What is the recommended pattern to prevent cancelled queries from being added to context?
Context
queryandstreamQueryAny guidance on supported APIs, lifecycle hooks, or best practices for cancellation and context management would be very helpful.
Beta Was this translation helpful? Give feedback.
All reactions