Skip to content

feat(guardrails): add decorator framework to uipath-platform [AL-288]#1537

Open
apetraru-uipath wants to merge 1 commit intomainfrom
feat/guardrails_decorators_support
Open

feat(guardrails): add decorator framework to uipath-platform [AL-288]#1537
apetraru-uipath wants to merge 1 commit intomainfrom
feat/guardrails_decorators_support

Conversation

@apetraru-uipath
Copy link
Copy Markdown
Contributor

What changed?

Moves the @guardrail decorator framework from uipath-langchain into uipath-platform as a framework-agnostic subpackage, making it available to any Python agent framework — not just LangChain.

New subpackage: uipath.platform.guardrails.decorators

  • @guardrail decorator — wraps tools, LLMs, and state graphs; dispatches to registered framework adapters via an adapter/registry pattern
  • Validators: PIIValidator, PromptInjectionValidator, CustomValidator (with RuleFunction type alias)
  • Actions: LogAction (log violations without blocking), BlockAction (raise GuardrailBlockException)
  • GuardrailBlockException — framework-agnostic exception raised by BlockAction; framework adapters (e.g. LangChain) catch and convert to their own error type
  • GuardrailTargetAdapter Protocol + register_guardrail_adapter() — allows downstream packages to teach the decorator how to wrap their objects
  • GuardrailExecutionStage enum (PRE / POST), PIIDetectionEntityType enum, PIIDetectionEntity model
  • All new symbols are exported from uipath.platform.guardrails

Version bumped: 0.1.150.1.16

How has this been tested?

  • New test file: packages/uipath-platform/tests/services/test_guardrails_decorators.py (74 tests)
  • Tests use a _DummyTarget / _DummyAdapter / _WrappedDummyTarget pattern to exercise the full decorator pipeline without any LangChain dependency
  • Covers: scope/stage enforcement, API guardrail routing, _evaluate_rules semantics (empty rules, exception in rule, mixed pass/fail), lazy UiPath() initialization, adapter registry priority, stacked decorators, and 9 joke-agent integration scenarios

Are there any breaking changes?

  • Under Feature Flag
  • None
  • DB migrations required
  • API removals / changes
  • Other

@github-actions github-actions bot added the test:uipath-langchain Triggers tests in the uipath-langchain-python repository label Apr 1, 2026
@apetraru-uipath apetraru-uipath force-pushed the feat/guardrails_decorators_support branch 6 times, most recently from b2f477d to 7fab058 Compare April 1, 2026 19:59
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>
@apetraru-uipath apetraru-uipath force-pushed the feat/guardrails_decorators_support branch from 7fab058 to cc560ff Compare April 1, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant