99from uipath .agent .models .agent import (
1010 AgentEscalationChannel ,
1111 AgentEscalationRecipient ,
12+ AgentEscalationRecipientType ,
1213 AgentEscalationResourceConfig ,
1314 AssetRecipient ,
1415 StandardRecipient ,
1516)
1617from uipath .eval .mocks import mockable
1718from uipath .platform import UiPath
19+ from uipath .platform .action_center .tasks import TaskRecipient , TaskRecipientType
1820from uipath .platform .common import CreateEscalation
1921from uipath .runtime .errors import UiPathErrorCode
2022
@@ -32,13 +34,24 @@ class EscalationAction(str, Enum):
3234 END = "end"
3335
3436
35- async def resolve_recipient_value (recipient : AgentEscalationRecipient ) -> str | None :
37+ async def resolve_recipient_value (
38+ recipient : AgentEscalationRecipient ,
39+ ) -> TaskRecipient | None :
3640 """Resolve recipient value based on recipient type."""
3741 if isinstance (recipient , AssetRecipient ):
38- return await resolve_asset (recipient .asset_name , recipient .folder_path )
42+ value = await resolve_asset (recipient .asset_name , recipient .folder_path )
43+ type = None
44+ if recipient .type == AgentEscalationRecipientType .ASSET_USER_EMAIL :
45+ type = TaskRecipientType .EMAIL
46+ elif recipient .type == AgentEscalationRecipientType .ASSET_GROUP_NAME :
47+ type = TaskRecipientType .GROUP_NAME
48+ return TaskRecipient (value = value , type = type )
3949
4050 if isinstance (recipient , StandardRecipient ):
41- return recipient .value
51+ type = TaskRecipientType (recipient .type )
52+ if recipient .type == AgentEscalationRecipientType .USER_EMAIL :
53+ type = TaskRecipientType .EMAIL
54+ return TaskRecipient (value = recipient .value , type = type )
4255
4356 return None
4457
@@ -86,21 +99,21 @@ async def create_escalation_tool(
8699 async def escalation_tool_fn (** kwargs : Any ) -> dict [str , Any ]:
87100 task_title = channel .task_title or "Escalation Task"
88101
89- assignee : str | None = (
102+ recipient : TaskRecipient | None = (
90103 await resolve_recipient_value (channel .recipients [0 ])
91104 if channel .recipients
92105 else None
93106 )
94107
95- # Assignee requires runtime resolution, store in metadata after resolving
108+ # Recipient requires runtime resolution, store in metadata after resolving
96109 if tool .metadata is not None :
97- tool .metadata ["assignee " ] = assignee
110+ tool .metadata ["recipient " ] = recipient
98111
99112 result = interrupt (
100113 CreateEscalation (
101114 title = task_title ,
102115 data = kwargs ,
103- assignee = assignee ,
116+ recipient = recipient ,
104117 app_name = channel .properties .app_name ,
105118 app_folder_path = channel .properties .folder_name ,
106119 app_version = channel .properties .app_version ,
0 commit comments