Skip to content

refactor: remove emit_interrupt_event from chat protocol [JAR-8666]#104

Closed
JoshParkSJ wants to merge 2 commits intomainfrom
josh/cas-tool-confirm
Closed

refactor: remove emit_interrupt_event from chat protocol [JAR-8666]#104
JoshParkSJ wants to merge 2 commits intomainfrom
josh/cas-tool-confirm

Conversation

@JoshParkSJ
Copy link
Copy Markdown
Contributor

Summary

  • Remove emit_interrupt_event from UiPathChatProtocol and its call in the runtime loop
  • Tool confirmation is now driven by startToolCall with requireConfirmation: true — the runtime no longer needs to emit a separate startInterrupt event

Companion PRs:

"""
...

async def emit_interrupt_event(
Copy link
Copy Markdown
Member

@cristipufu cristipufu Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove this, we'll need it in the future. There are multiple types of interrupt, not just tool call confirmation. The runtime contract is fine even if you decide to handle tool call confirmations in another way

Copy link
Copy Markdown
Contributor Author

@JoshParkSJ JoshParkSJ Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to remove interrupts from conversational agents and only support tool confirmation because interrupts are too much a low-level abstraction and has no use case for convo agents other than tool confirmation

Here is the relevant thread but this is the general consensus amongst other conversational agent SDK as well

resume_map: dict[str, Any] = {}

for trigger in api_triggers:
await self.chat_bridge.emit_interrupt_event(trigger)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line reacts to the interruption in the runtime code (be it tool call confirmation or another type of interrupt)

Copy link
Copy Markdown
Contributor Author

@JoshParkSJ JoshParkSJ Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have another interrupt type. We assumed there would be other interrupt use case with convo agents but there isn't

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm saying is that you don't need to make any changes to the runtime contracts right now. You can simply leave this code as it is (change the CAS bridge implementation of emit_interrupt_event to no-op).

I want us to be flexible, in case we change our mind again, or decide that we actually need an interrupt event (for coded agents there's nothing preventing the user from doing interrupt("Do you want to continue?") in the coded agent's code. This is something that we'll probably have to handle gracefully at some point

Comment thread src/uipath/runtime/chat/runtime.py Outdated
await self.chat_bridge.emit_interrupt_event(trigger)

resume_data = (
await self.chat_bridge.wait_for_resume()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line waits for the runtime interruption. You can't wait_for_resume without having emit_interrupt_event before. The contract wouldn't make sense

Copy link
Copy Markdown
Contributor Author

@JoshParkSJ JoshParkSJ Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed it for clarity. The new pairing is wait_for_tool_confirmation and startToolCall + requireConfirmation: true

@JoshParkSJ
Copy link
Copy Markdown
Contributor Author

Will leave interrupt/resume for future flexibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants