Skip to content

Commit 54f3293

Browse files
feat: add ArgumentEmail and ArgumentGroupName escalation recipient types (#1521)
1 parent a99fc06 commit 54f3293

File tree

4 files changed

+85
-4
lines changed

4 files changed

+85
-4
lines changed

packages/uipath/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"
3-
version = "2.10.48"
3+
version = "2.10.49"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath/src/uipath/agent/models/agent.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class AgentEscalationRecipientType(str, CaseInsensitiveEnum):
135135
ASSET_USER_EMAIL = "AssetUserEmail"
136136
GROUP_NAME = "GroupName"
137137
ASSET_GROUP_NAME = "AssetGroupName"
138+
ARGUMENT_EMAIL = "ArgumentEmail"
139+
ARGUMENT_GROUP_NAME = "ArgumentGroupName"
138140

139141

140142
class AgentContextRetrievalMode(str, CaseInsensitiveEnum):
@@ -481,6 +483,8 @@ class AgentA2aResourceConfig(BaseAgentResourceConfig):
481483
5: AgentEscalationRecipientType.GROUP_NAME,
482484
"staticgroupname": AgentEscalationRecipientType.GROUP_NAME,
483485
6: AgentEscalationRecipientType.ASSET_GROUP_NAME,
486+
7: AgentEscalationRecipientType.ARGUMENT_EMAIL,
487+
8: AgentEscalationRecipientType.ARGUMENT_GROUP_NAME,
484488
}
485489

486490

@@ -536,8 +540,37 @@ class AssetRecipient(BaseEscalationRecipient):
536540
folder_path: str = Field(..., alias="folderPath")
537541

538542

543+
class ArgumentEmailRecipient(BaseEscalationRecipient):
544+
"""Argument email recipient resolved from a named input argument.
545+
546+
The argument_path supports dot-notation for nested input fields (e.g. "user.email").
547+
"""
548+
549+
type: Literal[AgentEscalationRecipientType.ARGUMENT_EMAIL,] = Field(
550+
..., alias="type"
551+
)
552+
argument_path: str = Field(..., alias="argumentName")
553+
554+
555+
class ArgumentGroupNameRecipient(BaseEscalationRecipient):
556+
"""Argument group name recipient resolved from a named input argument.
557+
558+
The argument_path supports dot-notation for nested input fields (e.g. "team.groupName").
559+
"""
560+
561+
type: Literal[AgentEscalationRecipientType.ARGUMENT_GROUP_NAME,] = Field(
562+
..., alias="type"
563+
)
564+
argument_path: str = Field(..., alias="argumentName")
565+
566+
539567
AgentEscalationRecipient = Annotated[
540-
Union[StandardRecipient, AssetRecipient],
568+
Union[
569+
StandardRecipient,
570+
AssetRecipient,
571+
ArgumentEmailRecipient,
572+
ArgumentGroupNameRecipient,
573+
],
541574
Field(discriminator="type"),
542575
BeforeValidator(_normalize_recipient_type),
543576
]

packages/uipath/tests/agent/models/test_agent.py

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Any
22

33
import pytest
4-
from pydantic import TypeAdapter
4+
from pydantic import TypeAdapter, ValidationError
55

66
from uipath.agent.models.agent import (
77
AgentA2aResourceConfig,
@@ -43,6 +43,8 @@
4343
AgentUnknownToolResourceConfig,
4444
AgentWordOperator,
4545
AgentWordRule,
46+
ArgumentEmailRecipient,
47+
ArgumentGroupNameRecipient,
4648
AssetRecipient,
4749
BatchTransformFileExtension,
4850
BatchTransformWebSearchGrounding,
@@ -3789,3 +3791,49 @@ def test_a2a_resource_case_insensitive(self):
37893791
]
37903792
assert len(a2a_resources) == 1
37913793
assert isinstance(a2a_resources[0], AgentA2aResourceConfig)
3794+
3795+
3796+
class TestArgumentRecipientDeserialization:
3797+
def test_argument_email_recipient_by_type_int(self):
3798+
payload = {"type": 7, "argumentName": "assigneeEmail"}
3799+
recipient: AgentEscalationRecipient = TypeAdapter(
3800+
AgentEscalationRecipient
3801+
).validate_python(payload)
3802+
assert isinstance(recipient, ArgumentEmailRecipient)
3803+
assert recipient.argument_path == "assigneeEmail"
3804+
assert recipient.type == AgentEscalationRecipientType.ARGUMENT_EMAIL
3805+
3806+
def test_argument_group_name_recipient_by_type_int(self):
3807+
payload = {"type": 8, "argumentName": "assigneeGroup"}
3808+
recipient: AgentEscalationRecipient = TypeAdapter(
3809+
AgentEscalationRecipient
3810+
).validate_python(payload)
3811+
assert isinstance(recipient, ArgumentGroupNameRecipient)
3812+
assert recipient.argument_path == "assigneeGroup"
3813+
assert recipient.type == AgentEscalationRecipientType.ARGUMENT_GROUP_NAME
3814+
3815+
def test_argument_email_recipient_by_type_string(self):
3816+
payload = {"type": "ArgumentEmail", "argumentName": "emailArg"}
3817+
recipient: AgentEscalationRecipient = TypeAdapter(
3818+
AgentEscalationRecipient
3819+
).validate_python(payload)
3820+
assert isinstance(recipient, ArgumentEmailRecipient)
3821+
assert recipient.argument_path == "emailArg"
3822+
3823+
def test_argument_group_name_recipient_by_type_string(self):
3824+
payload = {"type": "ArgumentGroupName", "argumentName": "groupArg"}
3825+
recipient: AgentEscalationRecipient = TypeAdapter(
3826+
AgentEscalationRecipient
3827+
).validate_python(payload)
3828+
assert isinstance(recipient, ArgumentGroupNameRecipient)
3829+
assert recipient.argument_path == "groupArg"
3830+
3831+
def test_argument_email_recipient_missing_argument_name_raises(self):
3832+
payload = {"type": 7}
3833+
with pytest.raises(ValidationError):
3834+
TypeAdapter(AgentEscalationRecipient).validate_python(payload)
3835+
3836+
def test_argument_group_name_recipient_missing_argument_name_raises(self):
3837+
payload = {"type": 8}
3838+
with pytest.raises(ValidationError):
3839+
TypeAdapter(AgentEscalationRecipient).validate_python(payload)

packages/uipath/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)