Skip to content

Commit db2e07b

Browse files
fix: asset resolution error because of bindings overrides happening a… (#438)
1 parent acde588 commit db2e07b

4 files changed

Lines changed: 39 additions & 11 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.4.12"
3+
version = "0.4.13"
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: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ async def create_escalation_tool(
7676
input_model: Any = create_model(channel.input_schema)
7777
output_model: Any = create_model(channel.output_schema)
7878

79-
assignee: str | None = (
80-
await resolve_recipient_value(channel.recipients[0])
81-
if channel.recipients
82-
else None
83-
)
84-
8579
@mockable(
8680
name=resource.name,
8781
description=resource.description,
@@ -92,6 +86,16 @@ async def create_escalation_tool(
9286
async def escalation_tool_fn(**kwargs: Any) -> dict[str, Any]:
9387
task_title = channel.task_title or "Escalation Task"
9488

89+
assignee: str | None = (
90+
await resolve_recipient_value(channel.recipients[0])
91+
if channel.recipients
92+
else None
93+
)
94+
95+
# Assignee requires runtime resolution, store in metadata after resolving
96+
if tool.metadata is not None:
97+
tool.metadata["assignee"] = assignee
98+
9599
result = interrupt(
96100
CreateEscalation(
97101
title=task_title,
@@ -169,7 +173,7 @@ async def escalation_wrapper(
169173
"tool_type": "escalation",
170174
"display_name": channel.properties.app_name,
171175
"channel_type": channel.type,
172-
"assignee": assignee,
176+
"assignee": None,
173177
},
174178
)
175179
tool.set_tool_wrappers(awrapper=escalation_wrapper)

tests/agent/tools/test_escalation_tool.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,17 +261,41 @@ async def test_escalation_tool_metadata_has_channel_type(self, escalation_resour
261261
assert tool.metadata["channel_type"] == "actionCenter"
262262

263263
@pytest.mark.asyncio
264-
async def test_escalation_tool_metadata_has_assignee(self, escalation_resource):
264+
@patch("uipath_langchain.agent.tools.escalation_tool.interrupt")
265+
async def test_escalation_tool_metadata_has_assignee(
266+
self, mock_interrupt, escalation_resource
267+
):
265268
"""Test that metadata contains assignee when recipient is USER_EMAIL."""
269+
# Mock interrupt to return a result
270+
mock_result = MagicMock()
271+
mock_result.action = None
272+
mock_result.data = {}
273+
mock_interrupt.return_value = mock_result
274+
266275
tool = await create_escalation_tool(escalation_resource)
276+
277+
# Invoke the tool to trigger assignee resolution
278+
await tool.ainvoke({})
279+
267280
assert tool.metadata is not None
268281
assert tool.metadata["assignee"] == "user@example.com"
269282

270283
@pytest.mark.asyncio
284+
@patch("uipath_langchain.agent.tools.escalation_tool.interrupt")
271285
async def test_escalation_tool_metadata_assignee_none_when_no_recipients(
272-
self, escalation_resource_no_recipient
286+
self, mock_interrupt, escalation_resource_no_recipient
273287
):
274288
"""Test that assignee is None when no recipients configured."""
289+
# Mock interrupt to return a result
290+
mock_result = MagicMock()
291+
mock_result.action = None
292+
mock_result.data = {}
293+
mock_interrupt.return_value = mock_result
294+
275295
tool = await create_escalation_tool(escalation_resource_no_recipient)
296+
297+
# Invoke the tool to trigger assignee resolution
298+
await tool.ainvoke({})
299+
276300
assert tool.metadata is not None
277301
assert tool.metadata["assignee"] is None

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)