Skip to content

Conversation

@giuliastf
Copy link
Collaborator

@giuliastf giuliastf commented Oct 21, 2025

This pull request introduces a new GuardrailsService for validating and enforcing guardrails on agent input, integrates guardrail support into agent models, and improves the handling of metadata during human-in-the-loop (HITL) escalation flows. Additionally, it expands test coverage for these new behaviors. The most important changes are summarized below:

Guardrails Service and Enforcement:

  • Added a new GuardrailsService class (src/uipath/_services/guardrails_service.py) that provides methods to evaluate, execute, and process guardrails for agent input, including support for escalation, blocking, logging, and filtering actions. This service is now available throughout the codebase. [1] [2] [3]

  • Introduced the GuardrailViolationError exception and logic for handling escalation via HITL, including re-evaluation and rejection flows.

Agent Model Integration:

  • Updated agent models to support guardrails by adding a guardrails field to BaseAgentDefinition, and refactored escalation recipient types to use the shared models in uipath.models.guardrails. [1] [2] [3]

Human-in-the-Loop (HITL) Improvements:

  • Enhanced the HITL resume trigger flow to support an include_metadata flag, allowing the full action object to be returned when requested. This is controlled via the payload and propagated through the CreateAction and WaitAction models. [1] [2]

Testing Enhancements:

  • Added a new test to verify that when include_metadata=True is set during interruption, the full action object is returned as expected. [1] [2]

These changes collectively enable robust guardrail processing and escalation handling for agent-based workflows, with improved test coverage and model consistency.

Development Package

  • Add this package as a dependency in your pyproject.toml:
[project]
dependencies = [
  # Exact version:
  "uipath==2.1.100.dev1007512054",

  # Any version from PR
  "uipath>=2.1.100.dev1007510000,<2.1.100.dev1007520000"
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath = { index = "testpypi" }

@giuliastf giuliastf self-assigned this Oct 21, 2025
@giuliastf giuliastf added the build:dev Create a dev build from the pr label Oct 21, 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 21, 2025
@giuliastf giuliastf force-pushed the feat/guardrails_service branch from 4926438 to ef97d78 Compare October 21, 2025 23:28
@giuliastf giuliastf changed the title Feat/guardrails service feat(guardrails_service): complete flow Oct 21, 2025
app_folder_key: Optional[str] = None
app_key: Optional[str] = None
app_version: Optional[int] = 1
include_metadata: bool = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's delay this change

@giuliastf giuliastf force-pushed the feat/guardrails_service branch 11 times, most recently from 6bc5423 to e617479 Compare October 22, 2025 12:55
@giuliastf giuliastf force-pushed the feat/guardrails_service branch 2 times, most recently from cd61aef to 7b0e658 Compare October 22, 2025 15:36
@giuliastf giuliastf force-pushed the feat/guardrails_service branch from 7b0e658 to 6171265 Compare October 22, 2025 16:26
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.

2 participants