Skip to content

Commit 544977f

Browse files
authored
feat: Interrupt for low coded CAS agents [JAR-9208] (#641)
1 parent 6a078d9 commit 544977f

25 files changed

+743
-87
lines changed

src/uipath_langchain/agent/tools/durable_interrupt/__init__.py renamed to src/uipath_langchain/_utils/durable_interrupt/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
"""Durable interrupt package for side-effect-safe interrupt/resume in LangGraph."""
22

3-
from .decorator import _durable_state, durable_interrupt
3+
from .decorator import (
4+
_durable_state,
5+
durable_interrupt,
6+
)
47
from .skip_interrupt import SkipInterruptValue
58

69
__all__ = [

src/uipath_langchain/agent/tools/durable_interrupt/decorator.py renamed to src/uipath_langchain/_utils/durable_interrupt/decorator.py

File renamed without changes.

src/uipath_langchain/agent/tools/durable_interrupt/skip_interrupt.py renamed to src/uipath_langchain/_utils/durable_interrupt/skip_interrupt.py

File renamed without changes.

src/uipath_langchain/agent/tools/context_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from uipath.runtime.errors import UiPathErrorCategory
2727

2828
from uipath_langchain._utils import get_execution_folder_path
29+
from uipath_langchain._utils.durable_interrupt import durable_interrupt
2930
from uipath_langchain.agent.exceptions import AgentStartupError, AgentStartupErrorCode
3031
from uipath_langchain.agent.react.jsonschema_pydantic_converter import (
3132
create_model as create_model_from_schema,
@@ -40,7 +41,6 @@
4041
)
4142
from uipath_langchain.retrievers import ContextGroundingRetriever
4243

43-
from .durable_interrupt import durable_interrupt
4444
from .structured_tool_with_argument_properties import (
4545
StructuredToolWithArgumentProperties,
4646
)

src/uipath_langchain/agent/tools/escalation_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from uipath.runtime.errors import UiPathErrorCategory
2222

2323
from uipath_langchain._utils import get_execution_folder_path
24+
from uipath_langchain._utils.durable_interrupt import durable_interrupt
2425
from uipath_langchain.agent.react.jsonschema_pydantic_converter import create_model
2526
from uipath_langchain.agent.tools.static_args import (
2627
handle_static_args,
@@ -31,7 +32,6 @@
3132

3233
from ..exceptions import AgentRuntimeError, AgentRuntimeErrorCode
3334
from ..react.types import AgentGraphState
34-
from .durable_interrupt import durable_interrupt
3535
from .tool_node import ToolWrapperReturnType
3636
from .utils import (
3737
resolve_task_title,

src/uipath_langchain/agent/tools/internal_tools/batch_transform_tool.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
)
2727
from uipath.runtime.errors import UiPathErrorCategory
2828

29-
from uipath_langchain.agent.exceptions import AgentStartupError, AgentStartupErrorCode
30-
from uipath_langchain.agent.react.jsonschema_pydantic_converter import create_model
31-
from uipath_langchain.agent.react.types import AgentGraphState
32-
from uipath_langchain.agent.tools.durable_interrupt import (
29+
from uipath_langchain._utils.durable_interrupt import (
3330
SkipInterruptValue,
3431
durable_interrupt,
3532
)
33+
from uipath_langchain.agent.exceptions import AgentStartupError, AgentStartupErrorCode
34+
from uipath_langchain.agent.react.jsonschema_pydantic_converter import create_model
35+
from uipath_langchain.agent.react.types import AgentGraphState
3636
from uipath_langchain.agent.tools.internal_tools.schema_utils import (
3737
BATCH_TRANSFORM_OUTPUT_SCHEMA,
3838
add_query_field_to_schema,

src/uipath_langchain/agent/tools/internal_tools/deeprag_tool.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
)
2323
from uipath.runtime.errors import UiPathErrorCategory
2424

25-
from uipath_langchain.agent.exceptions import AgentStartupError, AgentStartupErrorCode
26-
from uipath_langchain.agent.react.jsonschema_pydantic_converter import create_model
27-
from uipath_langchain.agent.react.types import AgentGraphState
28-
from uipath_langchain.agent.tools.durable_interrupt import (
25+
from uipath_langchain._utils.durable_interrupt import (
2926
SkipInterruptValue,
3027
durable_interrupt,
3128
)
29+
from uipath_langchain.agent.exceptions import AgentStartupError, AgentStartupErrorCode
30+
from uipath_langchain.agent.react.jsonschema_pydantic_converter import create_model
31+
from uipath_langchain.agent.react.types import AgentGraphState
3232
from uipath_langchain.agent.tools.internal_tools.schema_utils import (
3333
add_query_field_to_schema,
3434
)

src/uipath_langchain/agent/tools/ixp_escalation_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
)
1919
from uipath.runtime.errors import UiPathErrorCategory
2020

21+
from uipath_langchain._utils.durable_interrupt import durable_interrupt
2122
from uipath_langchain.agent.react.types import AgentGraphState
2223
from uipath_langchain.agent.tools.tool_node import (
2324
ToolWrapperMixin,
2425
ToolWrapperReturnType,
2526
)
2627

2728
from ..exceptions import AgentRuntimeError, AgentRuntimeErrorCode
28-
from .durable_interrupt import durable_interrupt
2929
from .structured_tool_with_output_type import StructuredToolWithOutputType
3030
from .utils import (
3131
resolve_task_title,

src/uipath_langchain/agent/tools/process_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from uipath.platform.orchestrator import JobState
1414

1515
from uipath_langchain._utils import get_execution_folder_path
16+
from uipath_langchain._utils.durable_interrupt import durable_interrupt
1617
from uipath_langchain.agent.react.job_attachments import get_job_attachments
1718
from uipath_langchain.agent.react.jsonschema_pydantic_converter import create_model
1819
from uipath_langchain.agent.react.types import AgentGraphState
@@ -24,7 +25,6 @@
2425
ToolWrapperReturnType,
2526
)
2627

27-
from .durable_interrupt import durable_interrupt
2828
from .utils import sanitize_tool_name
2929

3030

src/uipath_langchain/agent/tools/tool_factory.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
LowCodeAgentDefinition,
1717
)
1818

19+
from uipath_langchain.chat.hitl import REQUIRE_CONVERSATIONAL_CONFIRMATION
20+
1921
from .context_tool import create_context_tool
2022
from .escalation_tool import create_escalation_tool
2123
from .extraction_tool import create_ixp_extraction_tool
@@ -54,6 +56,15 @@ async def create_tools_from_resources(
5456
else:
5557
tools.append(tool)
5658

59+
if agent.is_conversational:
60+
props = getattr(resource, "properties", None)
61+
if props and getattr(
62+
props, REQUIRE_CONVERSATIONAL_CONFIRMATION, False
63+
):
64+
if tool.metadata is None:
65+
tool.metadata = {}
66+
tool.metadata[REQUIRE_CONVERSATIONAL_CONFIRMATION] = True
67+
5768
return tools
5869

5970

0 commit comments

Comments
 (0)