From 86653ab30fc5b627d25ec80b125d885342ff87dd Mon Sep 17 00:00:00 2001 From: Dushyant Pathak Date: Fri, 27 Mar 2026 15:35:33 +0530 Subject: [PATCH] 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 --- .../agent/tools/escalation_tool.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/uipath_langchain/agent/tools/escalation_tool.py b/src/uipath_langchain/agent/tools/escalation_tool.py index ead8fdef3..8ee07933e 100644 --- a/src/uipath_langchain/agent/tools/escalation_tool.py +++ b/src/uipath_langchain/agent/tools/escalation_tool.py @@ -11,6 +11,8 @@ AgentEscalationRecipient, AgentEscalationRecipientType, AgentEscalationResourceConfig, + ArgumentEmailRecipient, + ArgumentGroupNameRecipient, AssetRecipient, StandardRecipient, ) @@ -49,6 +51,7 @@ class EscalationAction(str, Enum): async def resolve_recipient_value( recipient: AgentEscalationRecipient, + input_args: dict[str, Any] | None = None, ) -> TaskRecipient | None: """Resolve recipient value based on recipient type.""" if isinstance(recipient, AssetRecipient): @@ -60,6 +63,18 @@ async def resolve_recipient_value( type = TaskRecipientType.GROUP_NAME return TaskRecipient(value=value, type=type, displayName=value) + if isinstance(recipient, ArgumentEmailRecipient): + value = (input_args or {}).get(recipient.argument_name) + return TaskRecipient( + value=value, type=TaskRecipientType.EMAIL, displayName=value + ) + + if isinstance(recipient, ArgumentGroupNameRecipient): + value = (input_args or {}).get(recipient.argument_name) + return TaskRecipient( + value=value, type=TaskRecipientType.GROUP_NAME, displayName=value + ) + if isinstance(recipient, StandardRecipient): type = TaskRecipientType(recipient.type) if recipient.type == AgentEscalationRecipientType.USER_EMAIL: @@ -160,7 +175,7 @@ class EscalationToolOutput(BaseModel): async def escalation_tool_fn(**kwargs: Any) -> dict[str, Any]: recipient: TaskRecipient | None = ( - await resolve_recipient_value(channel.recipients[0]) + await resolve_recipient_value(channel.recipients[0], input_args=kwargs) if channel.recipients else None )