Skip to content

feat(guardrails): expose flagged attachments and add a termination mode to evaluate_guardrail [AL-614] - #1928

Merged
apetraru-uipath merged 4 commits into
mainfrom
feat/al-614-guardrail-action-span-files
Oct 6, 2026
Merged

apetraru-uipath merged 4 commits into
mainfrom
feat/al-614-guardrail-action-span-files

Conversation

@apetraru-uipath

@apetraru-uipath apetraru-uipath commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What changed?

Two optional additions to guardrail evaluation, both matching UiPath/Agents#6527:

  • GuardrailValidationResult.flagged_attachment_ids (alias flaggedAttachmentIds): the ids of the attached files the guardrail service flagged as causing a violation. GuardrailsService copies the key from the validate response only when it is a list. Responses without it, including 403 bodies, leave it None.
  • evaluate_guardrail(..., termination_mode=...), with a new GuardrailTerminationMode enum (FAIL_FAST = "FailFast", EVALUATE_ALL = "EvaluateAll").
    • It is sent as terminationMode. This is the same concept bulk validate uses.
    • With FAIL_FAST the service stops scanning at the first violation.
    • Without a mode the request body is unchanged.
    • SDK_REFERENCE.md is updated for the new signature.

uipath-langchain uses both (AL-614 stage 3, UiPath/uipath-langchain-python#1133). It names the flagged files in the Block error. Each guardrail action picks its mode: Block and Log use FAIL_FAST; Escalate and Filter use EVALUATE_ALL, so an escalation still sees every file.

Versions:

  • uipath-core 0.5.33
  • uipath-platform 0.2.34, which requires core ≥ 0.5.33
  • uipath 2.14.35, which requires platform ≥ 0.2.34 and core ≥ 0.5.33; 2.14.34 shipped from main in the meantime

How has this been tested?

  • uipath-core: alias and field name both populate the field, and it defaults to None (45 guardrails tests).
  • uipath-platform: 50 service tests, full suite 1772 passed.
    • The flagged key is parsed when present, and gives None when absent, on a 403 body, or when not a list.
    • terminationMode is sent as "FailFast" / "EvaluateAll", and absent when not given.
  • uipath: full suite 2597 passed.
  • ruff and mypy are clean on the touched packages, and the dependency-bump check passes.
  • End to end against local helix with #6527: FAIL_FAST stops after the first Content Safety window (4 calls instead of 5) and returns the flagged file; EVALUATE_ALL and no mode scan every chunk.

🤖 Generated with Claude Code

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.

Copilot review overview

🟢 Approval recommended

The implementation is backward compatible, dependency versions are aligned, and relevant behavior is comprehensively tested.

Review effort: Balanced
Findings: None

What changed in this PR

Adds flagged attachment IDs to guardrail validation results for downstream tracing and review tasks.

Changes:

  • Adds the aliased flagged_attachment_ids result field.
  • Parses valid list responses with backward-compatible defaults.
  • Adds tests and updates package versions/dependencies.
File Description
packages/​uipath/​uv.lock Updates workspace package versions.
packages/​uipath/​pyproject.toml Bumps SDK and platform dependency versions.
packages/​uipath-platform/​uv.lock Updates platform and core versions.
packages/​uipath-platform/​tests/​services/​test_guardrails_service.py Tests response parsing and edge cases.
packages/​uipath-platform/​src/​uipath/​platform/​guardrails/​_guardrails_service.py Extracts flagged attachment IDs.
packages/​uipath-platform/​pyproject.toml Bumps platform and core requirements.
packages/​uipath-core/​uv.lock Updates the core package version.
packages/​uipath-core/​tests/​guardrails/​test_guardrails_models.py Tests aliases, defaults, and serialization.
packages/​uipath-core/​src/​uipath/​core/​guardrails/​guardrails.py Adds the public result field.
packages/​uipath-core/​pyproject.toml Bumps the core package version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@apetraru-uipath apetraru-uipath changed the title feat(guardrails): expose the attachments a guardrail flagged [AL-614] feat(guardrails): expose flagged attachments and send the guardrail action [AL-614] Oct 6, 2026
apetraru-uipath and others added 3 commits October 6, 2026 18:48
GuardrailValidationResult gains flagged_attachment_ids (alias
flaggedAttachmentIds), parsed from the guardrail validate response when the
service returns it. Old responses leave it None.

Bumps uipath-core 0.5.33, uipath-platform 0.2.34, uipath 2.14.34.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… [AL-614]

evaluate_guardrail takes an optional action (block, log, escalate,
filter) and sends it to the validate API, which stops scanning at the
first violation for block and log. Without it the request body is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
uipath now also requires uipath-core>=0.5.33, since this PR changes both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apetraru-uipath
apetraru-uipath force-pushed the feat/al-614-guardrail-action-span-files branch from e390286 to b33d380 Compare October 6, 2026 15:51
Comment thread packages/uipath-platform/src/uipath/platform/guardrails/_guardrails_service.py Outdated
…l action [AL-614]

evaluate_guardrail takes termination_mode (GuardrailTerminationMode.FAIL_FAST
or EVALUATE_ALL), the same concept bulk validate uses, instead of the
guardrail's action. FAIL_FAST makes the service stop scanning at the first
violation; without a mode the request body is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apetraru-uipath apetraru-uipath changed the title feat(guardrails): expose flagged attachments and send the guardrail action [AL-614] feat(guardrails): expose flagged attachments and add a termination mode to evaluate_guardrail [AL-614] Oct 6, 2026
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

@apetraru-uipath
apetraru-uipath merged commit ae20e9a into main Oct 6, 2026
187 checks passed
@apetraru-uipath
apetraru-uipath deleted the feat/al-614-guardrail-action-span-files branch October 6, 2026 19:37
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 test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants