Repository navigation
feat(guardrails): send the scope, stage and action of agent-defined guardrail checks [AL-696] - #1992
Merged
andreizdrali-uipath merged 7 commits intoNov 17, 2026
Conversation
…rdrail checks [AL-696] The guardrail service publishes the evaluation span of a built-in check an agent defines, but the request does not say where in the run the check guards or what the agent does on a violation. So the span cannot carry the uipath_governance.* contract (hook, mode, action_applied) that centralized guardrail checks already carry. evaluate_guardrail takes an optional GuardrailGovernanceContext (hook, mode, version, action_on_violation) and sends it as a camelCase "governance" object. Without it the request body is unchanged. uipath-platform 0.3.7 -> 0.3.8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andreizdrali-uipath
marked this pull request as ready for review
November 13, 2026 15:16
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the optional guardrail governance-context support.
No open issues 🎉
What changed in this PR
Adds optional governance context to the UiPath SDK’s guardrail validation requests so the backend can annotate evaluation spans with the agent’s governance decision. Request bodies remain unchanged when context is omitted.
Changes:
- Introduces and exports
GuardrailGovernanceContext, and forwards it throughevaluate_guardrail. - Adds tests for camelCase serialization and omission when no context is supplied.
- Bumps
uipath-platformto 0.3.8 and updates both lockfiles.
| File | Description |
|---|---|
packages/uipath/uv.lock |
Updates the platform package version to 0.3.8. |
packages/uipath-platform/uv.lock |
Aligns the platform lockfile with version 0.3.8. |
packages/uipath-platform/tests/services/test_guardrails_service.py |
Tests governance serialization and omission. |
packages/uipath-platform/src/uipath/platform/guardrails/guardrails.py |
Defines the governance context model and wire-field alias. |
packages/uipath-platform/src/uipath/platform/guardrails/_guardrails_service.py |
Accepts optional governance context and includes it in validation requests. |
packages/uipath-platform/src/uipath/platform/guardrails/__init__.py |
Exports the new public model. |
packages/uipath-platform/pyproject.toml |
Bumps the platform package version to 0.3.8. |
Review effort: Balanced
…s [AL-696] Review: hook, mode and the action on a violation make sense outside governance, so the /validate request should not wrap them in a governance object. evaluate_guardrail takes hook, mode and action_on_violation and sends them as top-level hook, mode and actionOnViolation, next to guardrailName and terminationMode. GuardrailGovernanceContext is gone; the backend stamps the contract version itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andreizdrali-uipath
added a commit
to UiPath/uipath-langchain-python
that referenced
this pull request
Nov 16, 2026
…lain fields [AL-696] Review: hook, mode and the action on a violation make sense outside governance, so evaluate_guardrail takes them as plain keyword arguments (UiPath/uipath-python#1992) instead of a GuardrailGovernanceContext. - governance.py keeps the scope/stage -> hook and action -> decision mapping; guardrail_check_context() builds a GuardrailCheckContext (hook, mode, action_on_violation) that the node splats into evaluate_guardrail. - The subgraph passes each node check_context= instead of governance=. - Fakes of evaluate_guardrail take the SDK's new keywords. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
valentinabojan
approved these changes
Nov 17, 2026
…-696] Review: the runtime should send what it knows about a check, not uipath_governance strings; the guardrail service maps them for its span. evaluate_guardrail takes scope (GuardrailScope), execution_stage (preExecution or postExecution) and action_type (Block, Filter, Log or Escalate) instead of hook, mode and action_on_violation, and sends them as scope, executionStage and actionType, each only when given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main published 0.3.8 in #1994, so this change needs its own version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andreizdrali-uipath
added a commit
to UiPath/uipath-langchain-python
that referenced
this pull request
Nov 17, 2026
…lain fields [AL-696] Review: hook, mode and the action on a violation make sense outside governance, so evaluate_guardrail takes them as plain keyword arguments (UiPath/uipath-python#1992) instead of a GuardrailGovernanceContext. - governance.py keeps the scope/stage -> hook and action -> decision mapping; guardrail_check_context() builds a GuardrailCheckContext (hook, mode, action_on_violation) that the node splats into evaluate_guardrail. - The subgraph passes each node check_context= instead of governance=. - Fakes of evaluate_guardrail take the SDK's new keywords. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-governance-context
main published 0.3.9 in #1929 without the guardrail check fields, so this change needs the next version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
andreizdrali-uipath
deleted the
feat/al-696-guardrail-governance-context
branch
November 17, 2026 15:24
andreizdrali-uipath
added a commit
to UiPath/uipath-langchain-python
that referenced
this pull request
Nov 17, 2026
…lain fields [AL-696] Review: hook, mode and the action on a violation make sense outside governance, so evaluate_guardrail takes them as plain keyword arguments (UiPath/uipath-python#1992) instead of a GuardrailGovernanceContext. - governance.py keeps the scope/stage -> hook and action -> decision mapping; guardrail_check_context() builds a GuardrailCheckContext (hook, mode, action_on_violation) that the node splats into evaluate_guardrail. - The subgraph passes each node check_context= instead of governance=. - Fakes of evaluate_guardrail take the SDK's new keywords. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Part of AL-696.
What
evaluate_guardrailtakes optionalscope,execution_stageandaction_typekeyword arguments and sends them as top-level fields to/agentsruntime_/api/execution/guardrails/validate, next toguardrailNameandterminationMode:{ "validator": "pii_detection", "guardrailName": "PII Detection", "scope": "Tool", "executionStage": "preExecution", "actionType": "Escalate", ... }scopeGuardrailScope:Agent,Llm,Toolexecution_stagepreExecution,postExecutionaction_typeBlock,Filter,Log,EscalateWithout them the body is byte-identical to today.
Why
For a built-in guardrail an agent defines, the Agents guardrail service publishes the
guardrailEvaluationspan, but the request doesn't say what the check guards, when, or what the agent does on a violation. The span then can't carry theuipath_governance.*contract (hook,mode,action_applied) that centralized (AI Trust Layer) checks already carry.The SDK sends what the caller knows about the check, not governance strings (review); the service maps them for its span (UiPath/Agents#7004).
Rollout
uipath-platform0.3.8 → 0.3.10 (main published 0.3.8 in fix(business-rules): leave the input size to the service #1994 and 0.3.9 in feat(documents): support DU Framework v2 with DocumentsServiceV2 #1929). UiPath/Agents#7004 reads the fields and merges first; then feat(guardrails): send the scope, stage and action of each built-in guardrail check [AL-696] uipath-langchain-python#1210 requires 0.3.10 and passes them.Tests
TestGuardrailCheckContext: sent camelCase when supplied, keys absent when not.test_guardrails_service.py61 passed; ruff, ruff format, mypy clean.🤖 Generated with Claude Code