feat(guardrails): add decorator framework to uipath-platform [AL-288]#1537
Open
apetraru-uipath wants to merge 1 commit intomainfrom
Open
feat(guardrails): add decorator framework to uipath-platform [AL-288]#1537apetraru-uipath wants to merge 1 commit intomainfrom
apetraru-uipath wants to merge 1 commit intomainfrom
Conversation
b2f477d to
7fab058
Compare
Move @guardrail decorator, validators, actions, and adapter registry from uipath-langchain into uipath-platform as a framework-agnostic subpackage. Includes PIIValidator, PromptInjectionValidator, CustomValidator, BlockAction, LogAction, and GuardrailTargetAdapter Protocol. Bump version to 0.1.18. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7fab058 to
cc560ff
Compare
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.
What changed?
Moves the
@guardraildecorator framework fromuipath-langchainintouipath-platformas a framework-agnostic subpackage, making it available to any Python agent framework — not just LangChain.New subpackage:
uipath.platform.guardrails.decorators@guardraildecorator — wraps tools, LLMs, and state graphs; dispatches to registered framework adapters via an adapter/registry patternPIIValidator,PromptInjectionValidator,CustomValidator(withRuleFunctiontype alias)LogAction(log violations without blocking),BlockAction(raiseGuardrailBlockException)GuardrailBlockException— framework-agnostic exception raised byBlockAction; framework adapters (e.g. LangChain) catch and convert to their own error typeGuardrailTargetAdapterProtocol +register_guardrail_adapter()— allows downstream packages to teach the decorator how to wrap their objectsGuardrailExecutionStageenum (PRE/POST),PIIDetectionEntityTypeenum,PIIDetectionEntitymodeluipath.platform.guardrailsVersion bumped:
0.1.15→0.1.16How has this been tested?
packages/uipath-platform/tests/services/test_guardrails_decorators.py(74 tests)_DummyTarget/_DummyAdapter/_WrappedDummyTargetpattern to exercise the full decorator pipeline without any LangChain dependency_evaluate_rulessemantics (empty rules, exception in rule, mixed pass/fail), lazyUiPath()initialization, adapter registry priority, stacked decorators, and 9 joke-agent integration scenariosAre there any breaking changes?