Skip to content

Commit 86653ab

Browse files
feat: resolve ArgumentEmail and ArgumentGroupName recipients at runtime
Updates resolve_recipient_value() in escalation_tool to handle the two new argument-driven recipient types. Each type carries an argument_name that is looked up in the tool's runtime kwargs to produce a concrete email or group-name TaskRecipient. Follows the same pattern as AssetRecipient resolution. Backward compatible -- input_args defaults to None. Depends on uipath-python adding ArgumentEmailRecipient and ArgumentGroupNameRecipient to uipath.agent.models.agent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6e11d22 commit 86653ab

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/uipath_langchain/agent/tools/escalation_tool.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
AgentEscalationRecipient,
1212
AgentEscalationRecipientType,
1313
AgentEscalationResourceConfig,
14+
ArgumentEmailRecipient,
15+
ArgumentGroupNameRecipient,
1416
AssetRecipient,
1517
StandardRecipient,
1618
)
@@ -49,6 +51,7 @@ class EscalationAction(str, Enum):
4951

5052
async def resolve_recipient_value(
5153
recipient: AgentEscalationRecipient,
54+
input_args: dict[str, Any] | None = None,
5255
) -> TaskRecipient | None:
5356
"""Resolve recipient value based on recipient type."""
5457
if isinstance(recipient, AssetRecipient):
@@ -60,6 +63,18 @@ async def resolve_recipient_value(
6063
type = TaskRecipientType.GROUP_NAME
6164
return TaskRecipient(value=value, type=type, displayName=value)
6265

66+
if isinstance(recipient, ArgumentEmailRecipient):
67+
value = (input_args or {}).get(recipient.argument_name)
68+
return TaskRecipient(
69+
value=value, type=TaskRecipientType.EMAIL, displayName=value
70+
)
71+
72+
if isinstance(recipient, ArgumentGroupNameRecipient):
73+
value = (input_args or {}).get(recipient.argument_name)
74+
return TaskRecipient(
75+
value=value, type=TaskRecipientType.GROUP_NAME, displayName=value
76+
)
77+
6378
if isinstance(recipient, StandardRecipient):
6479
type = TaskRecipientType(recipient.type)
6580
if recipient.type == AgentEscalationRecipientType.USER_EMAIL:
@@ -160,7 +175,7 @@ class EscalationToolOutput(BaseModel):
160175

161176
async def escalation_tool_fn(**kwargs: Any) -> dict[str, Any]:
162177
recipient: TaskRecipient | None = (
163-
await resolve_recipient_value(channel.recipients[0])
178+
await resolve_recipient_value(channel.recipients[0], input_args=kwargs)
164179
if channel.recipients
165180
else None
166181
)

0 commit comments

Comments
 (0)