66from pydantic import BaseModel , ConfigDict , Discriminator , Field , Tag , field_validator
77
88from uipath .models import Connection
9+ from uipath .models .guardrails import AgentEscalationRecipient , Guardrail
910
1011
1112class AgentResourceType (str , Enum ):
@@ -305,39 +306,6 @@ class AgentMcpResourceConfig(BaseAgentResourceConfig):
305306 )
306307
307308
308- class AgentEscalationRecipientType (str , Enum ):
309- """Enum for escalation recipient types."""
310-
311- USER_ID = "UserId"
312- GROUP_ID = "GroupId"
313- USER_EMAIL = "UserEmail"
314-
315-
316- class AgentEscalationRecipient (BaseModel ):
317- """Recipient for escalation."""
318-
319- type : Union [AgentEscalationRecipientType , str ] = Field (..., alias = "type" )
320- value : str = Field (..., alias = "value" )
321- display_name : Optional [str ] = Field (default = None , alias = "displayName" )
322-
323- @field_validator ("type" , mode = "before" )
324- @classmethod
325- def normalize_type (cls , v : Any ) -> str :
326- """Normalize recipient type from int (1=UserId, 2=GroupId, 3=UserEmail) or string. Unknown integers are converted to string."""
327- if isinstance (v , int ):
328- mapping = {
329- 1 : AgentEscalationRecipientType .USER_ID ,
330- 2 : AgentEscalationRecipientType .GROUP_ID ,
331- 3 : AgentEscalationRecipientType .USER_EMAIL ,
332- }
333- return mapping .get (v , str (v ))
334- return v
335-
336- model_config = ConfigDict (
337- validate_by_name = True , validate_by_alias = True , extra = "allow"
338- )
339-
340-
341309class AgentEscalationChannelProperties (BaseResourceProperties ):
342310 """Agent escalation channel properties."""
343311
@@ -508,6 +476,9 @@ class BaseAgentDefinition(BaseModel):
508476 output_schema : Dict [str , Any ] = Field (
509477 ..., alias = "outputSchema" , description = "JSON schema for output arguments"
510478 )
479+ guardrails : Optional [List [Guardrail ]] = Field (
480+ None , description = "List of agent guardrails"
481+ )
511482
512483 model_config = ConfigDict (
513484 validate_by_name = True , validate_by_alias = True , extra = "allow"
@@ -569,4 +540,4 @@ class UnknownAgentDefinition(BaseAgentDefinition):
569540 model_config = ConfigDict (extra = "allow" )
570541
571542
572- AgentDefinition = Union [KnownAgentDefinition , UnknownAgentDefinition ]
543+ AgentDefinition = Union [KnownAgentDefinition , UnknownAgentDefinition ]
0 commit comments