feat: add entitlements support for guardrails #1092
Merged
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.
Summary
This PR adds support for entitlements checks in the guardrails service, enabling the SDK to handle cases where guardrail features are disabled or entitlements are missing. The implementation includes support for the new
resultenum anddetailsfields inGuardrailValidationResult.Changes
Core Changes
Updated Guardrails Service (
src/uipath/platform/guardrails/_guardrails_service.py):resultenum field (passed/failed/skipped)detailsfield with the same value asreasonskip=True, the result is set to "skipped"Updated Tests (
tests/sdk/services/test_guardrails_service.py):resultanddetailsfieldsVersion Bump (
pyproject.toml):2.4.10to2.4.11API Changes
Response Handling
The service now handles the
skipfield in API responses:skip=True: Result is set to"skipped"(indicates entitlements were triggered)skip=Falseandvalidation_passed=True: Result is set to"passed"skip=Falseandvalidation_passed=False: Result is set to"failed"The
detailsfield is populated with the same value as thereasonfield.Entitlements Scenarios
The implementation handles two entitlements scenarios:
skip=Truewith reason "Guardrail feature is disabled"skip=Truewith reason "Guardrail entitlement is missing"In both cases,
validation_passed=Trueandresult="skipped"to indicate the validation was skipped due to entitlements.Testing
Breaking Changes
None. This is a backward-compatible enhancement that adds new fields to the response model.
Related Issues
N/A
Checklist