What happens when user interrupts agent while ther...
# ask-ai
b
What happens when user interrupts agent while there is an ongoing tool call? Does the agent invoke another tool call?
t
Thanks for reaching out, Masayuki. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m replying about what happens when a user interrupts an agent during an ongoing tool call, and whether that causes the agent to invoke another tool. Short answer • When interrupted, the ongoing tool call is canceled and removed from the agent’s history; its result is ignored. • The agent does not automatically invoke another tool as a direct result of the interruption. What happens next depends on the agent’s logic and the user’s new input. Details you can rely on • Default behavior: Tools can be interrupted by user speech. On interruption, the tool is canceled and any result it would have produced is disregarded. • Conversation history: The agent truncates its conversation to reflect only what was spoken before the interruption (the tool call is removed from history). • Next actions: After truncating history and stopping the tool, the agent begins processing the user’s new input. Any further tool calls happen only if the agent’s decision logic (given the new input) decides to call a tool. • Preventing interruptions: If a tool performs external actions that must not be interrupted, developers can disable interruptions for that tool by calling
run_ctx.disallow_interruptions()
at the start of execution. If you want, I can: • Show an example flow of interruption and subsequent agent behavior. • Explain how to change interruption behavior for specific tools in your agent code. Which would be more helpful? Sources: Tool definition and use | LiveKit Documentation