Skip to content

Commit 8beb60f

Browse files
authored
fix: add missing field to EscalationToolOutput (#660)
1 parent 4e7c62e commit 8beb60f

4 files changed

Lines changed: 28 additions & 2 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-langchain"
3-
version = "0.8.2"
3+
version = "0.8.3"
44
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath_langchain/agent/tools/escalation_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def create_escalation_tool(
154154
class EscalationToolOutput(BaseModel):
155155
action: Literal["approve", "reject"]
156156
data: output_model
157+
is_deleted: bool = False
157158

158159
_bts_context: dict[str, Any] = {}
159160

tests/agent/tools/test_escalation_tool.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,31 @@ async def test_escalation_tool_raises_when_task_is_deleted(
623623
with pytest.raises(AgentRuntimeError):
624624
await tool.awrapper(tool, call, {}) # type: ignore[attr-defined]
625625

626+
@pytest.mark.asyncio
627+
@patch("uipath_langchain.agent.tools.escalation_tool.UiPath")
628+
@patch("uipath_langchain.agent.tools.durable_interrupt.decorator.interrupt")
629+
async def test_escalation_tool_dict_result_without_is_deleted_defaults_to_false(
630+
self, mock_interrupt, mock_uipath_class, escalation_resource
631+
):
632+
"""Test that a dict result without is_deleted is accepted and defaults to False."""
633+
mock_client = MagicMock()
634+
mock_client.tasks.create_async = AsyncMock(return_value=_make_mock_task())
635+
mock_uipath_class.return_value = mock_client
636+
637+
# Return a plain dict without is_deleted — exercises the TypeAdapter path
638+
mock_interrupt.return_value = {
639+
"action": "approve",
640+
"data": {"approved": True, "reason": "looks good"},
641+
}
642+
643+
tool = create_escalation_tool(escalation_resource)
644+
call = ToolCall(args={}, id="test-call", name=tool.name)
645+
646+
result = await tool.awrapper(tool, call, {}) # type: ignore[attr-defined]
647+
648+
assert result["outcome"] == "approve"
649+
assert result["output"] == {"approved": True, "reason": "looks good"}
650+
626651
@pytest.mark.asyncio
627652
@patch("uipath_langchain.agent.tools.escalation_tool.UiPath")
628653
@patch("uipath_langchain.agent.tools.durable_interrupt.decorator.interrupt")

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)