Description
Scope
We are looking for a simple way to stop the generation loop mid-execution. A lot of agentic applications support this behavior (e.g., Microsoft Copilot), but there is no simple way of actually doing this with Microsoft Agent Framework.
Why is this useful
- Stopping long lasting/expensive/... generations (User might have sent the wrong query)
Our current custom implementation
Currently we iterate over a ResponseStream and check whether a variable is_canceled was set. If that is the case, we break from the ResponseStream loop.
Why this is not as easy as it sounds
When working with (custom) HistoryProvider instances, we are required to implement a before_run method that "repairs" the conversation history/context in some cases -> E.g. when the last element is a function_call element, we need to delete it, as continuing without any result is not possible right now
Code Sample
Language/SDK
Python
Description
Scope
We are looking for a simple way to stop the generation loop mid-execution. A lot of agentic applications support this behavior (e.g., Microsoft Copilot), but there is no simple way of actually doing this with Microsoft Agent Framework.
Why is this useful
Our current custom implementation
Currently we iterate over a ResponseStream and check whether a variable
is_canceledwas set. If that is the case, we break from the ResponseStream loop.Why this is not as easy as it sounds
When working with (custom) HistoryProvider instances, we are required to implement a before_run method that "repairs" the conversation history/context in some cases -> E.g. when the last element is a function_call element, we need to delete it, as continuing without any result is not possible right now
Code Sample
Language/SDK
Python