Skip to content

Conversation

giuliastf
Copy link
Collaborator

@giuliastf giuliastf commented Oct 15, 2025

Add Guardrails Models

Summary

Implements a comprehensive guardrails system for UiPath agents with configurable validation rules and actions.

Changes

Guardrails Models (src/uipath/models/guardrails.py)

Core Components

  • Field Selectors: AllFieldsSelector, SpecificFieldsSelector with discriminated unions
  • Validation Rules:
    • WordRule - Text validation with operators (contains, equals, startsWith, etc.)
    • NumberRule - Numeric validation with comparison operators
    • BooleanRule - Boolean field validation
    • UniversalRule - Always-apply rules for input/output/both
  • Actions:
    • BlockAction - Stop execution with reason
    • FilterAction - Remove specific fields
    • LogAction - Log events with severity levels
    • EscalateAction - Human-in-the-loop workflows
  • Guardrail Types:
    • CustomGuardrail - User-defined rules and logic
    • BuiltInValidatorGuardrail - Pre-built validators with parameters

Agent Integration (src/uipath/agent/models/agent.py)

  • Added guardrails: Optional[List[Guardrail]] to BaseAgentDefinition

Testing and Example Usage (tests/agent/models/test_agent.py)

  • JSON parsing validation for complex guardrail configurations : test_agent_config_loads_guardrails

@giuliastf giuliastf self-assigned this Oct 15, 2025
@github-actions github-actions bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Oct 15, 2025
@giuliastf giuliastf force-pushed the feat/guardrail_model branch from 471b3be to fb067ab Compare October 15, 2025 09:32
@giuliastf giuliastf changed the title feat(guardrail_model): add agent.json classes feat(guardrail_model): support guardrail policy configuration for agents Oct 15, 2025
@giuliastf giuliastf marked this pull request as ready for review October 15, 2025 09:37
@giuliastf giuliastf added the build:dev Create a dev build from the pr label Oct 17, 2025
@giuliastf giuliastf force-pushed the feat/guardrail_model branch from c490043 to 012112b Compare October 17, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:dev Create a dev build from the pr test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants