Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit c1f1fa5

Browse files
feat: add chat interrupt models
1 parent a462494 commit c1f1fa5

4 files changed

Lines changed: 44 additions & 14 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-core"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
description = "UiPath Core abstractions"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/core/chat/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@
7979
UiPathConversationExchangeStartEvent,
8080
)
8181
from .interrupt import (
82-
UiPathConversationInterruptEndEvent,
82+
InterruptTypeEnum,
83+
UiPathConversationGenericInterruptStart,
8384
UiPathConversationInterruptEvent,
8485
UiPathConversationInterruptStartEvent,
86+
UiPathConversationToolCallConfirmationInterruptStart,
87+
UiPathConversationToolCallConfirmationValue,
8588
)
8689
from .message import (
8790
UiPathConversationMessage,
@@ -122,9 +125,12 @@
122125
"UiPathConversationMessageEvent",
123126
"UiPathConversationMessage",
124127
# Interrupt
128+
"InterruptTypeEnum",
125129
"UiPathConversationInterruptStartEvent",
126-
"UiPathConversationInterruptEndEvent",
127130
"UiPathConversationInterruptEvent",
131+
"UiPathConversationToolCallConfirmationValue",
132+
"UiPathConversationToolCallConfirmationInterruptStart",
133+
"UiPathConversationGenericInterruptStart",
128134
# Content
129135
"UiPathConversationContentPartChunkEvent",
130136
"UiPathConversationContentPartStartEvent",

src/uipath/core/chat/interrupt.py

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,50 @@
11
"""Interrupt events for human-in-the-loop patterns."""
22

3-
from typing import Any
3+
from enum import Enum
4+
from typing import Any, Literal, Union
45

56
from pydantic import BaseModel, ConfigDict, Field
67

78

8-
class UiPathConversationInterruptStartEvent(BaseModel):
9-
"""Signals the start of an interrupt - a pause point where the agent needs external input."""
9+
class InterruptTypeEnum(str, Enum):
10+
"""Enum of known interrupt types."""
11+
12+
TOOL_CALL_CONFIRMATION = "uipath_cas_tool_call_confirmation"
13+
14+
15+
class UiPathConversationToolCallConfirmationValue(BaseModel):
16+
"""Schema for tool call confirmation interrupt value."""
17+
18+
tool_call_id: str = Field(..., alias="toolCallId")
19+
tool_name: str = Field(..., alias="toolName")
20+
input_schema: Any = Field(..., alias="inputSchema")
21+
input_value: Any | None = Field(None, alias="inputValue")
22+
23+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
24+
25+
26+
class UiPathConversationToolCallConfirmationInterruptStart(BaseModel):
27+
"""Tool call confirmation interrupt start event with strong typing."""
28+
29+
type: Literal["uipath_cas_tool_call_confirmation"]
30+
value: UiPathConversationToolCallConfirmationValue
31+
32+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
33+
34+
35+
class UiPathConversationGenericInterruptStart(BaseModel):
36+
"""Generic interrupt start event for custom interrupt types."""
1037

1138
type: str
1239
value: Any
1340

1441
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
1542

1643

17-
class UiPathConversationInterruptEndEvent(BaseModel):
18-
"""Signals the interrupt end event with the provided value."""
19-
20-
# Can be any type
21-
model_config = ConfigDict(
22-
validate_by_name=True, validate_by_alias=True, extra="allow"
23-
)
44+
UiPathConversationInterruptStartEvent = Union[
45+
UiPathConversationToolCallConfirmationInterruptStart,
46+
UiPathConversationGenericInterruptStart,
47+
]
2448

2549

2650
class UiPathConversationInterruptEvent(BaseModel):

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)