From 67ed93d28bca6c20392aaeafc4d809e39b1f70d4 Mon Sep 17 00:00:00 2001 From: GabrielVasilescu04 Date: Mon, 16 Feb 2026 10:04:52 +0200 Subject: [PATCH] feat: add generic chat interrupts --- pyproject.toml | 2 +- src/uipath/_cli/_chat/_bridge.py | 36 ++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 33d7179d6..e5cfb9d7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.8.31" +version = "2.8.32" description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools." readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/src/uipath/_cli/_chat/_bridge.py b/src/uipath/_cli/_chat/_bridge.py index 26e85a0c6..8f4030b20 100644 --- a/src/uipath/_cli/_chat/_bridge.py +++ b/src/uipath/_cli/_chat/_bridge.py @@ -8,10 +8,13 @@ from typing import Any from urllib.parse import urlparse +from pydantic import ValidationError + from uipath.core.chat import ( UiPathConversationEvent, UiPathConversationExchangeEndEvent, UiPathConversationExchangeEvent, + UiPathConversationGenericInterruptStartEvent, UiPathConversationInterruptEndEvent, UiPathConversationInterruptEvent, UiPathConversationMessageEvent, @@ -264,6 +267,32 @@ async def emit_interrupt_event(self, resume_trigger: UiPathResumeTrigger): "Cannot emit interrupt event: api_resume is None" ) + # Try to parse as tool call confirmation first + try: + start_event = UiPathConversationToolCallConfirmationInterruptStartEvent( + type="uipath_cas_tool_call_confirmation", + value=UiPathConversationToolCallConfirmationValue( + **resume_trigger.api_resume.request + ), + ) + except Exception: + logger.info( + "Failed to parse as tool call confirmation, using generic interrupt" + ) + + # Wrap request in JSON if it's not already a dict + request_value = resume_trigger.api_resume.request + if not isinstance(request_value, dict): + request_value = {"value": request_value} + + # Extract type from request + interrupt_type = request_value.get("type", "uipath_cas_generic") + + start_event = UiPathConversationGenericInterruptStartEvent( + type=interrupt_type, + value=request_value, + ) + interrupt_event = UiPathConversationEvent( conversation_id=self.conversation_id, exchange=UiPathConversationExchangeEvent( @@ -272,12 +301,7 @@ async def emit_interrupt_event(self, resume_trigger: UiPathResumeTrigger): message_id=self._current_message_id, interrupt=UiPathConversationInterruptEvent( interrupt_id=self._interrupt_id, - start=UiPathConversationToolCallConfirmationInterruptStartEvent( - type="uipath_cas_tool_call_confirmation", - value=UiPathConversationToolCallConfirmationValue( - **resume_trigger.api_resume.request - ), - ), + start=start_event, ), ), ),