Skip to content

feat: add ByoValidator for Bring Your Own Guardrail (BYOG) [AL-512] - #1833

Merged
apetraru-uipath merged 1 commit into
mainfrom
feat/byog-decorator-validator
Jul 30, 2026
Merged

feat: add ByoValidator for Bring Your Own Guardrail (BYOG) [AL-512]#1833
apetraru-uipath merged 1 commit into
mainfrom
feat/byog-decorator-validator

Conversation

@apetraru-uipath

Copy link
Copy Markdown
Contributor

What changed?

Adds Bring Your Own Guardrail (BYOG) support to the @guardrail decorator framework in uipath-platform:

  • ByoValidator (packages/uipath-platform/src/uipath/platform/guardrails/decorators/validators/byo.py): references an admin-created BYOG configuration (Admin → AI Trust Layer → Guardrails Configurations) by validator_name (byoValidatorName) + recommended Integration Service connection_id, and builds a builtInValidator guardrail with validator_type="byo". The GuardrailsService.evaluate_guardrail wire layer already forwards byoValidatorName/byoConnectionId, so no service changes are needed.
  • No stage restriction (supported_stages inherited empty): BYO validator capabilities are connector-defined and unknowable statically; an unsupported scope/stage surfaces as PROVIDER_ERROR at evaluation time.
  • Parameters are connector-defined → passed through as raw ValidatorParameter values.
  • Exports: ByoValidator from uipath.platform.guardrails.decorators(.validators) and uipath.platform.guardrails; BYO_VALIDATOR_TYPE added to uipath.platform.guardrails.__all__.

Usage:

from uipath.platform.guardrails.decorators import BlockAction, ByoValidator, guardrail

@guardrail(
    validator=ByoValidator("byog-harmful-content", connection_id="24887687-..."),
    action=BlockAction(),
)
def summarize(text: str) -> str: ...

This is the decorator-flavor counterpart of the middleware flavor shipped in uipath-langchain-python (UiPathByoGuardrailMiddleware, UiPath/uipath-langchain-python#1013). The two PRs are independent.

How has this been tested?

  • New TestByoValidator suite in packages/uipath-platform/tests/services/test_guardrails_decorators.py (11 tests): construction validation, byo sentinel + byoValidatorName/byoConnectionId alias serialization, parameter passthrough, stage permissiveness, and run() forwarding the BYO guardrail to evaluate_guardrail.
  • Full uipath-platform suite: 1609 passed, 7 skipped (pre-existing credential-gated integration tests).
  • ruff check, ruff format --check, and mypy src tests clean.
  • The existing 8 BYO wire-payload tests in test_guardrails_service.py already pin the evaluate payload contract.

Are there any breaking changes?

  • Under Feature Flag
  • None
  • DB migrations
  • API removals

(Server-side, BYOG evaluation is gated by the tenant's EnableByoGuardrails feature flag; this SDK change is purely additive.)

🤖 Generated with Claude Code

Add a BYOG validator for the @guardrail decorator so coded agents can run
customer-managed validators (Azure Content Safety subscriptions, vendor
connectors, or custom Integration Service connectors) configured under
Admin -> AI Trust Layer -> Guardrails Configurations.

- ByoValidator(validator_name, *, connection_id=None, parameters=None)
  references the admin configuration by byoValidatorName + optional IS
  connection id and builds a builtInValidator guardrail with
  validator_type="byo"; the guardrails service already forwards
  byoValidatorName/byoConnectionId on evaluate.
- No stage restriction (supported_stages inherited empty): BYO validator
  capabilities are connector-defined and unknowable statically.
- Parameters are passed through as raw ValidatorParameter values.
- Export ByoValidator from decorators(.validators) and BYO_VALIDATOR_TYPE
  from uipath.platform.guardrails __all__.
- Bump uipath-platform to 0.2.14 (0.2.13 is published on PyPI) and keep
  both uv.lock files in sync.

Counterpart of the middleware flavor shipped in uipath-langchain-python
(UiPathByoGuardrailMiddleware).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 29, 2026 12:18
@apetraru-uipath
apetraru-uipath force-pushed the feat/byog-decorator-validator branch from 00423d2 to 82394ff Compare July 29, 2026 12:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Bring Your Own Guardrail (BYOG) support to the uipath-platform guardrails decorator framework by introducing a ByoValidator that builds a BuiltInValidatorGuardrail with validator_type="byo" and forwards the BYOG name/connection metadata on the existing wire contract.

Changes:

  • Introduces ByoValidator decorator validator with BYOG name/connection and parameter passthrough.
  • Exposes ByoValidator (and BYO_VALIDATOR_TYPE) through the public guardrails/decorators export surfaces.
  • Adds a dedicated test suite for ByoValidator behavior and bumps uipath-platform version to 0.2.14.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/uipath/uv.lock Updates the editable uipath-platform version to 0.2.14 in the monorepo lock.
packages/uipath-platform/uv.lock Updates the package version to 0.2.14 in the platform lock.
packages/uipath-platform/tests/services/test_guardrails_decorators.py Adds TestByoValidator coverage for construction, serialization, parameter passthrough, stage behavior, and service forwarding.
packages/uipath-platform/src/uipath/platform/guardrails/decorators/validators/byo.py Adds the new ByoValidator implementation that builds a BYO built-in validator guardrail.
packages/uipath-platform/src/uipath/platform/guardrails/decorators/validators/init.py Re-exports ByoValidator from the validators package.
packages/uipath-platform/src/uipath/platform/guardrails/decorators/init.py Re-exports ByoValidator from the decorators package.
packages/uipath-platform/src/uipath/platform/guardrails/init.py Re-exports ByoValidator and adds BYO_VALIDATOR_TYPE to top-level guardrails exports.
packages/uipath-platform/pyproject.toml Bumps uipath-platform version to 0.2.14.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +70 to +74
if not validator_name or not validator_name.strip():
raise ValueError("validator_name must be a non-empty string")
self.validator_name = validator_name
self.connection_id = connection_id
self.parameters = list(parameters or [])
@sonarqubecloud

Copy link
Copy Markdown

apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 29, 2026
Decorator-flavor Bring Your Own Guardrail support, pairing with the
ByoValidator shipped in uipath (UiPath/uipath-python#1833):

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim via a guarded getattr, so the package keeps
  importing (ByoValidator is None) on uipath releases that predate it.
  TODO in-code: switch to a direct import once the dependency floor
  includes it.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open). This makes BYOG misconfiguration
  (PROVIDER_ERROR, removed/disabled config, feature flag off) visible.
- Tests: adapter error-logging tests (always run) + ByoValidator-through-
  @guardrail tests (tool / plain function / validator reuse) that skip
  automatically until the installed uipath ships ByoValidator; verified
  passing locally against the uipath-python ByoValidator branch.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md,
  using placeholder validator/connection values and documenting the
  connector-defined `parameters` passthrough.
- Sample: samples/joke-agent-byog-decorator starter (agent-factory AGENT
  scope + tool TOOL scope, bindings.json connection binding), with a
  commented-out Azure Content Safety `parameters` example.

Bump to 0.14.18 (0.14.17 was taken by #1012 and is published on PyPI).

Independent of the middleware-flavor PR (#1013); branched from main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 29, 2026
Decorator-flavor Bring Your Own Guardrail support, pairing with the
ByoValidator shipped in uipath (UiPath/uipath-python#1833):

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim via a guarded getattr, so the package keeps
  importing (ByoValidator is None) on uipath releases that predate it.
  TODO in-code: switch to a direct import once the dependency floor
  includes it.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open). This makes BYOG misconfiguration
  (PROVIDER_ERROR, removed/disabled config, feature flag off) visible.
- Tests: adapter error-logging tests (always run) + ByoValidator-through-
  @guardrail tests (tool / plain function / validator reuse) that skip
  automatically until the installed uipath ships ByoValidator; verified
  passing locally against the uipath-python ByoValidator branch.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md,
  using placeholder validator/connection values and documenting the
  connector-defined `parameters` passthrough.
- Sample: samples/joke-agent-byog-decorator starter (agent-factory AGENT
  scope + tool TOOL scope, bindings.json connection binding), with a
  commented-out Azure Content Safety `parameters` example.
- Discovery: docs and sample point at `uip agent guardrails
  byo-configurations` (UiPath/cli#3298) rather than the raw
  agents_/api/designer/byog-guardrails endpoint, and note that the command
  needs an org-admin user session.

Bump to 0.14.18 (0.14.17 was taken by #1012 and is published on PyPI).

Independent of the middleware-flavor PR (#1013); branched from main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@apetraru-uipath
apetraru-uipath merged commit dddfe7e into main Jul 30, 2026
170 checks passed
@apetraru-uipath
apetraru-uipath deleted the feat/byog-decorator-validator branch July 30, 2026 07:19
apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 30, 2026
Decorator-flavor Bring Your Own Guardrail support, pairing with the
ByoValidator shipped in uipath (UiPath/uipath-python#1833):

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim via a guarded getattr, so the package keeps
  importing (ByoValidator is None) on uipath releases that predate it.
  TODO in-code: switch to a direct import once the dependency floor
  includes it.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open). This makes BYOG misconfiguration
  (PROVIDER_ERROR, removed/disabled config, BYOG not enabled) visible.
- Tests: adapter error-logging tests (always run) + ByoValidator-through-
  @guardrail tests (tool / plain function / validator reuse) that skip
  automatically until the installed uipath ships ByoValidator; verified
  passing locally against the uipath-python ByoValidator branch.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md,
  using placeholder validator/connection values and documenting the
  connector-defined `parameters` passthrough.
- Sample: samples/joke-agent-byog-decorator starter (agent-factory AGENT
  scope + tool TOOL scope, bindings.json connection binding), with a
  commented-out Azure Content Safety `parameters` example.
- Discovery: docs and sample point at `uip agent guardrails list` for the
  validator name, connection id and the connector-defined `Parameters`
  schema, rather than the raw agents_/api/designer/byog-guardrails endpoint.
- Scopes/stages: BYOG validators are not scope- or stage-restricted, so the
  developer chooses; here the scope is inferred from each decorated target.

Bump to 0.14.18 (0.14.17 was taken by #1012 and is published on PyPI).

Independent of the middleware-flavor PR (#1013); branched from main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 30, 2026
Decorator-flavor Bring Your Own Guardrail support, pairing with the
ByoValidator shipped in uipath (UiPath/uipath-python#1833):

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim via a guarded getattr, so the package keeps
  importing (ByoValidator is None) on uipath releases that predate it.
  TODO in-code: switch to a direct import once the dependency floor
  includes it.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open). This makes BYOG misconfiguration
  (PROVIDER_ERROR, removed/disabled config, BYOG not enabled) visible.
- Tests: adapter error-logging tests (always run) + ByoValidator-through-
  @guardrail tests (tool / plain function / validator reuse) that skip
  automatically until the installed uipath ships ByoValidator; verified
  passing locally against the uipath-python ByoValidator branch.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md,
  using placeholder validator/connection values and documenting the
  connector-defined `parameters` passthrough.
- Sample: samples/joke-agent-byog-decorator starter (agent-factory AGENT
  scope + tool TOOL scope, bindings.json connection binding), with a
  commented-out Azure Content Safety `parameters` example.
- Discovery: docs and sample point at `uip agent guardrails list` for the
  validator name, connection id and the connector-defined `Parameters`
  schema, rather than the raw agents_/api/designer/byog-guardrails endpoint.
- Scopes/stages: BYOG validators are not scope- or stage-restricted, so the
  developer chooses; here the scope is inferred from each decorated target.

Bump to 0.14.19: 0.14.17 was taken by #1012 and is published on PyPI, and
0.14.18 belongs to the middleware flavor (#1013), which lands first.

Independent of the middleware-flavor PR (#1013); branched from main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 30, 2026
Decorator-flavor Bring Your Own Guardrail support, the counterpart to the
UiPathByoGuardrailMiddleware shipped in #1013.

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim. `uipath-platform` is floored at >=0.2.14, the
  release that ships ByoValidator (UiPath/uipath-python#1833), so this is a
  plain import rather than a guarded getattr.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open). This makes BYOG misconfiguration
  (PROVIDER_ERROR, removed/disabled config, BYOG not enabled) visible.
- Tests: adapter error-logging tests plus ByoValidator-through-@guardrail
  tests (tool / plain function / validator reuse), all running against the
  published uipath-platform - no conditional skips.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md. The
  admin prerequisite, discovery command and parameter-schema lookup are
  cross-referenced to the middleware section instead of repeated; only the
  decorator-specific notes are spelled out.
- Sample: samples/joke-agent-byog-decorator (agent-factory AGENT scope +
  tool TOOL scope, bindings.json connection binding), with a commented-out
  Azure Content Safety `parameters` example. Cross-links the middleware
  sample as the sibling starter.
- Replace the leftover tenant-specific validator name and connection GUID
  with the placeholder values used elsewhere, in this PR's tests and in
  tests/guardrails/middlewares/test_byo.py from #1013.
- Bump to 0.14.19 (main is at 0.14.18, published on PyPI).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 30, 2026
Decorator-flavor Bring Your Own Guardrail support, the counterpart to the
UiPathByoGuardrailMiddleware shipped in #1013.

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim. `uipath-platform` is floored at >=0.2.14, the
  release that ships ByoValidator (UiPath/uipath-python#1833), so this is a
  plain import rather than a guarded getattr.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open), via a shared _EVALUATION_FAILED_MSG constant
  rather than repeating the format string at each of the four call sites.
  This makes BYOG misconfiguration (PROVIDER_ERROR, removed/disabled config,
  BYOG not enabled) visible.
- Tests: adapter error-logging tests plus ByoValidator-through-@guardrail
  tests (tool / plain function / validator reuse), all running against the
  published uipath-platform - no conditional skips.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md. The
  admin prerequisite, discovery command and parameter-schema lookup are
  cross-referenced to the middleware section instead of repeated; only the
  decorator-specific notes are spelled out.
- Sample: samples/joke-agent-byog-decorator (agent-factory AGENT scope +
  tool TOOL scope, bindings.json connection binding), with a commented-out
  Azure Content Safety `parameters` example. Cross-links the middleware
  sample as the sibling starter.
- Replace the leftover tenant-specific validator name and connection GUID
  with the placeholder values used elsewhere, in this PR's tests and in
  tests/guardrails/middlewares/test_byo.py from #1013.
- Bump to 0.14.19 (main is at 0.14.18, published on PyPI).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 30, 2026
Decorator-flavor Bring Your Own Guardrail support, the counterpart to the
UiPathByoGuardrailMiddleware shipped in #1013.

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim. `uipath-platform` is floored at >=0.2.14, the
  release that ships ByoValidator (UiPath/uipath-python#1833), so this is a
  plain import rather than a guarded getattr.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open), via a shared _EVALUATION_FAILED_MSG constant.
  This makes BYOG misconfiguration (PROVIDER_ERROR, removed/disabled config,
  BYOG not enabled) visible.
- Tests: adapter error-logging tests plus ByoValidator-through-@guardrail
  tests (tool / plain function / validator reuse), all running against the
  published uipath-platform - no conditional skips.
- Sample: merge both flavors into samples/joke-agent-bring-your-own-guardrail
  as ONE agent guarded twice from the same BYOG configuration -- the
  middleware logs on AGENT scope (PRE_AND_POST, LogAction) while the
  decorator blocks on LLM scope (PRE, BlockAction on a create_llm factory),
  so a harmful topic is first logged and then blocked before the model is
  invoked. The separate joke-agent-byog-decorator sample is removed.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md,
  cross-referencing the middleware section for the shared prerequisite and
  discovery steps. Discovery now uses `uip agent guardrails list --byo`,
  whose entries carry ByoValidatorName / ByoConnectionId / ByoConnectorKey
  and the connector-defined Parameters schema.
- Replace the leftover tenant-specific validator name and connection GUID
  with the placeholder values used elsewhere, in this PR's tests and in
  tests/guardrails/middlewares/test_byo.py from #1013.
- Bump to 0.14.19 (main is at 0.14.18, published on PyPI).

Verified live on alpha against a real BYOG harmful-content configuration:
benign topic evaluates on both flavors (agent PRE, LLM PRE per model call,
agent POST) and returns a joke; harmful topic is logged by the agent-scope
guardrail, then blocked by the LLM-scope guardrail before chat/completions,
with the vendor verdict "Harmful content detected: Violence (severity 4)".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 30, 2026
Decorator-flavor Bring Your Own Guardrail support, the counterpart to the
UiPathByoGuardrailMiddleware shipped in #1013.

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim. `uipath-platform` is floored at >=0.2.14, the
  release that ships ByoValidator (UiPath/uipath-python#1833), so this is a
  plain import rather than a guarded getattr.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open), via a shared _EVALUATION_FAILED_MSG constant.
  This makes BYOG misconfiguration (PROVIDER_ERROR, removed/disabled config,
  BYOG not enabled) visible.
- Tests: adapter error-logging tests plus ByoValidator-through-@guardrail
  tests (tool / plain function / validator reuse), all running against the
  published uipath-platform - no conditional skips.
- Parity suite: new scenario 12 (test_byog_agent_block) runs for BOTH flavors
  and asserts they deliver the same byo wire contract to the service
  (validator_type="byo", byoValidatorName, byoConnectionId) and block
  identically on a failing verdict; both parity mock agents gain an
  "Agent BYOG Detection" guardrail (AGENT scope, PRE, BlockAction).
- Sample: merge both flavors into samples/joke-agent-bring-your-own-guardrail
  as ONE agent guarded twice from the same BYOG configuration -- the
  middleware logs on AGENT scope (PRE_AND_POST, LogAction) while the
  decorator blocks on LLM scope (PRE, BlockAction on a create_llm factory),
  so a harmful topic is first logged and then blocked before the model is
  invoked. The separate joke-agent-byog-decorator sample is removed.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md,
  cross-referencing the middleware section for the shared prerequisite and
  discovery steps. Discovery now uses `uip agent guardrails list --byo`,
  whose entries carry ByoValidatorName / ByoConnectionId / ByoConnectorKey
  and the connector-defined Parameters schema.
- Replace the leftover tenant-specific validator name and connection GUID
  with the placeholder values used elsewhere, in this PR's tests and in
  tests/guardrails/middlewares/test_byo.py from #1013.
- Bump to 0.14.20 (0.14.19 was taken by #1008 and is published on PyPI).

Verified live on alpha against a real BYOG harmful-content configuration:
benign topic evaluates on both flavors (agent PRE, LLM PRE per model call,
agent POST) and returns a joke; harmful topic is logged by the agent-scope
guardrail, then blocked by the LLM-scope guardrail before chat/completions,
with the vendor verdict "Harmful content detected: Violence (severity 4)".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Jul 31, 2026
Decorator-flavor Bring Your Own Guardrail support, the counterpart to the
UiPathByoGuardrailMiddleware shipped in #1013.

- Re-export ByoValidator from uipath_langchain.guardrails and the
  .guardrails.decorators shim. `uipath-platform` is floored at >=0.2.14, the
  release that ships ByoValidator (UiPath/uipath-python#1833), so this is a
  plain import rather than a guarded getattr.
- Adapter hardening: the LLM/agent wrappers previously swallowed evaluator
  exceptions silently; they now log a WARNING with the guardrail name and
  traceback (still fail-open), via a shared _EVALUATION_FAILED_MSG constant.
  This makes BYOG misconfiguration (PROVIDER_ERROR, removed/disabled config,
  BYOG not enabled) visible.
- Tests: adapter error-logging tests plus ByoValidator-through-@guardrail
  tests (tool / plain function / validator reuse), all running against the
  published uipath-platform - no conditional skips.
- Parity suite: new scenario 12 (test_byog_agent_block) runs for BOTH flavors
  and asserts they deliver the same byo wire contract to the service
  (validator_type="byo", byoValidatorName, byoConnectionId) and block
  identically on a failing verdict; both parity mock agents gain an
  "Agent BYOG Detection" guardrail (AGENT scope, PRE, BlockAction).
- Sample: merge both flavors into samples/joke-agent-bring-your-own-guardrail
  as ONE agent guarded twice from the same BYOG configuration -- the
  middleware logs on AGENT scope (PRE_AND_POST, LogAction) while the
  decorator blocks on LLM scope (PRE, BlockAction on a create_llm factory),
  so a harmful topic is first logged and then blocked before the model is
  invoked. The separate joke-agent-byog-decorator sample is removed.
- No solution binding for the BYOG connection (review feedback): the
  connection is resolved server-side from the BYOG configuration, so the
  sample ships no bindings.json and the docs no longer point ByoConnectorKey
  at a connection binding.
- Docs: BYOG section under the decorator pattern in docs/guardrails.md,
  cross-referencing the middleware section for the shared prerequisite and
  discovery steps. Discovery uses `uip agent guardrails list --byo`, whose
  entries carry ByoValidatorName / ByoConnectionId and the connector-defined
  Parameters schema.
- Replace the leftover tenant-specific validator name and connection GUID
  with the placeholder values used elsewhere, in this PR's tests and in
  tests/guardrails/middlewares/test_byo.py from #1013.
- Bump to 0.14.20 (0.14.19 was taken by #1008 and is published on PyPI).

Verified live on alpha against a real BYOG harmful-content configuration:
benign topic evaluates on both flavors (agent PRE, LLM PRE per model call,
agent POST) and returns a joke; harmful topic is logged by the agent-scope
guardrail, then blocked by the LLM-scope guardrail before chat/completions,
with the vendor verdict "Harmful content detected: Violence (severity 4)".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants