Skip to content

Commit d43a786

Browse files
committed
fix: move interrupt offset to hitl
1 parent 2aaee74 commit d43a786

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/uipath_langchain/agent/tools/tool_node.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
extract_current_tool_call_index,
2323
find_latest_ai_message,
2424
)
25-
from uipath_langchain.agent.tools.durable_interrupt import add_interrupt_offset
2625
from uipath_langchain.chat.hitl import request_conversational_tool_confirmation
2726

2827
# the type safety can be improved with generics
@@ -90,7 +89,6 @@ def _func(self, state: AgentGraphState) -> OutputType:
9089
if conversational_confirmation.cancelled:
9190
# tool confirmation rejected
9291
return self._process_result(call, conversational_confirmation.cancelled)
93-
add_interrupt_offset() # HITL consumed 1 interrupt slot
9492

9593
try:
9694
if self.wrapper:
@@ -128,7 +126,6 @@ async def _afunc(self, state: AgentGraphState) -> OutputType:
128126
if conversational_confirmation.cancelled:
129127
# tool confirmation rejected
130128
return self._process_result(call, conversational_confirmation.cancelled)
131-
add_interrupt_offset() # HITL consumed 1 interrupt slot
132129

133130
try:
134131
if self.awrapper:

src/uipath_langchain/chat/hitl.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
UiPathConversationToolCallConfirmationValue,
1313
)
1414

15+
from uipath_langchain.agent.tools.durable_interrupt import add_interrupt_offset
16+
1517
CANCELLED_MESSAGE = "Cancelled by user"
1618

1719
CONVERSATIONAL_APPROVED_TOOL_ARGS = "conversational_approved_tool_args"
@@ -127,6 +129,9 @@ def request_approval(
127129
input_value=tool_args,
128130
)
129131
)
132+
# Workaround for langgraph#6792 — remove when subgraph @task + interrupt()
133+
# checkpoint caching is fixed upstream
134+
add_interrupt_offset()
130135

131136
# The resume payload from CAS has shape:
132137
# {"type": "uipath_cas_tool_call_confirmation",
@@ -145,6 +150,7 @@ def request_approval(
145150
)
146151

147152

153+
# for conversational low code agents
148154
def request_conversational_tool_confirmation(
149155
call: ToolCall, tool: BaseTool
150156
) -> ConfirmationResult | None:
@@ -176,6 +182,7 @@ def request_conversational_tool_confirmation(
176182
)
177183

178184

185+
# for conversational coded agents
179186
def requires_approval(
180187
func: Callable[..., Any] | None = None,
181188
*,

0 commit comments

Comments
 (0)