Repository navigation
feat(guardrails): record deterministic rule checks as spans - #1221
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The review identifies no active issues requiring changes to the deterministic guardrail tracing update.
No open issues 🎉
What changed in this PR
Adds client-side tracing for deterministic guardrail evaluations, continuing the guardrail observability work from #1220. Evaluation spans record validation outcomes and link to actions taken on violations.
Changes:
- Adds evaluation-span helpers, result attributes, and GUID-formatted span IDs.
- Integrates tracing into deterministic checks while preserving action handling and block-error conversion.
- Adds tests for failed, passing, and blocking checks; bumps the package to
0.20.4.
| File | Description |
|---|---|
uv.lock |
Updates the locked package version to 0.20.4. |
tests/guardrails/middlewares/test_deterministic_spans.py |
Tests evaluation attributes, action links, and span status. |
src/uipath_langchain/guardrails/middlewares/deterministic.py |
Records evaluation spans and links violation actions. |
src/uipath_langchain/guardrails/middlewares/_spans.py |
Adds evaluation-span, validation-result, and span-ID helpers. |
pyproject.toml |
Bumps the project version to 0.20.4. |
Review effort: Balanced
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
daniel-joica
force-pushed
the
feat/guardrail-deterministic-spans
branch
from
November 19, 2026 13:00
13cf3c6 to
6fa85ec
Compare
…ectly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
valentinabojan
approved these changes
Nov 19, 2026
…inistic-spans # Conflicts: # pyproject.toml # uv.lock
|
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.





2 of 3 (#1220 is merged; this is now based on
main):What
UiPathDeterministicGuardrailMiddlewarerules run in the agent, so nothing recorded their check: a rule that fired only left a log line. Low-code agents record a client-sideguardrailEvaluationspan for their deterministic guardrails.Each rule check now gets that span, and the action span on a violation (recorded since #1220) links to it:
Attributes:
guardrailName,guardrailDescription,guardrailType=custom,validationResult(PASSEDorVALIDATION_FAILED),details(the rule result's reason).How
_spans.py:guardrail_evaluation_span(name, description)andset_validation_result(span, result), plusspan_guid(span), which gives the span id as a GUID, the formguardrailSpanIduses.guardrail_action_spantakes an optionalevaluation_span_idand falls back toresult.span_id.deterministic.py: the rule check now runs inside the evaluation span, and its span id is passed to the action span. The empty-rules case is still handled in_evaluate_rules, and a block is still converted toAgentRuntimeError. Behaviour is unchanged.Tests
test_deterministic_spans.py(3): a failed rule records its evaluation with every attribute and the action links to it; a passing rule records its evaluation only; a blocking rule's action span is an error, its evaluation is not.🤖 Generated with Claude Code
Development Package
uipath pack --nolockto get the latest dev build from this PR (requires version range).