88from langchain_core .messages import AIMessage , AnyMessage , BaseMessage , ToolMessage
99from langgraph .types import Command , interrupt
1010from uipath ._utils import UiPathUrl
11+ from uipath .agent .models .agent import AgentEscalationRecipient
1112from uipath .platform .common import CreateEscalation , UiPathConfig
1213from uipath .platform .guardrails import (
1314 BaseGuardrail ,
1718
1819from ...exceptions import AgentTerminationException
1920from ...react .types import AgentGuardrailsGraphState
21+ from ...tools .escalation_tool import resolve_recipient_value
2022from ..types import ExecutionStage
2123from ..utils import _extract_tool_args_from_message , get_message_content
2224from .base_action import GuardrailAction , GuardrailActionNode
@@ -35,20 +37,20 @@ def __init__(
3537 app_name : str ,
3638 app_folder_path : str ,
3739 version : int ,
38- assignee : str ,
40+ recipient : AgentEscalationRecipient ,
3941 ):
4042 """Initialize EscalateAction with escalation app configuration.
4143
4244 Args:
4345 app_name: Name of the escalation app.
4446 app_folder_path: Folder path where the escalation app is located.
4547 version: Version of the escalation app.
46- assignee: User or role assigned to handle the escalation .
48+ recipient: Recipient object (StandardRecipient or AssetRecipient) .
4749 """
4850 self .app_name = app_name
4951 self .app_folder_path = app_folder_path
5052 self .version = version
51- self .assignee = assignee
53+ self .recipient = recipient
5254
5355 def action_node (
5456 self ,
@@ -74,6 +76,9 @@ def action_node(
7476 async def _node (
7577 state : AgentGuardrailsGraphState ,
7678 ) -> Dict [str , Any ] | Command [Any ]:
79+ # Resolve recipient value (handles both StandardRecipient and AssetRecipient)
80+ assignee = await resolve_recipient_value (self .recipient )
81+
7782 # Validate message count based on execution stage
7883 _validate_message_count (state , execution_stage )
7984
@@ -134,7 +139,7 @@ async def _node(
134139 app_folder_path = self .app_folder_path ,
135140 title = "Agents Guardrail Task" ,
136141 data = data ,
137- assignee = self . assignee ,
142+ assignee = assignee ,
138143 )
139144 )
140145
0 commit comments