feat(governance): in-runtime policy evaluator, guardrail compensation, audit pipeline#140
Merged
Merged
Conversation
abd0a0c to
ff2a429
Compare
…models, and dependencies Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ff2a429 to
0a3e28f
Compare
|
radu-mocanu
approved these changes
Jul 1, 2026
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.



Summary
Lands the full in-runtime governance stack on
main. Wraps a runtime delegate with:UiPathGovernedRuntime— thin wrapper that firesBEFORE_AGENT/AFTER_AGENTaround the delegate, opens a single OTel root span per invocation (so runtime-side governance events correlate with framework-emitted spans under onetrace_id), and exposes an opaqueon_dispose: Callable[[], None] | Nonecleanup hook that runs in afinallyafter the delegate's owndispose.native/evaluator.py) — rule / check / condition matching for regex, contains, entropy, encoding-concern, incident-concern, commitment-concern, VADER sentiment, andguardrail_fallbackoperators. Per-check action overrides, cross-rule aggregation (DENY > ESCALATE > AUDIT > ALLOW). Instance-scoped; no process-globals.native/guardrail_compensation.py) — synchronous dispatcher (no thread pool inside the runtime layer) that handsGovernRequests off to an injectedGovernanceCompensationProvider. Stamps runtime identity (agent_framework,agent_type,runtime_version) onto the wire._audit/) —AuditManagerfans events out to sinks; two shipped:TracesAuditSink(OTel → Orchestrator) andTrackEventAuditSink(host-injectedCallable→ App Insights). Both non-blocking-by-contract; the host wires whatever adapter it wants behind the callable.AUDIT,ENFORCE,DISABLEDhandled at the evaluator boundary. Deny short-circuits viaGovernanceBlockExceptioninENFORCE; collapses to audit-only logging inAUDIT; short-circuits before any rule evaluates inDISABLED.Architecture principles
ThreadPoolExecutor, noatexit, no environment-variable reads in the governance layer. Async dispatch (if any) is the host's problem.Callableover Protocol for single-method contracts —track_eventandon_disposeare typed asCallable[..., None]/Callable[[], None]. The runtime never imports concrete platform classes.Tracer; track-event sink calls a host-suppliedCallable.Dependencies
Bumps floor to
uipath-core>=0.5.28, <0.6.0(needsGovernRequest.agent_framework/agent_type/runtime_version). Addspyyaml,vaderSentiment,chardetfor the native evaluator's YAML compilation + sentiment + encoding-integrity checks. WheelRequires-Distverified narrow-and-correct.Verification
uv run pytest— 395 passed, 1 skippeduv run ruff check .— cleanuv run mypy src/— clean (51 source files)Requires-Dist: uipath-core<0.6.0,>=0.5.28— no testpypi pin baked inRisk / rollout
Additive to the runtime surface: no removed symbols, no signature changes on existing classes. Framework consumers (
uipath-integrations-python) don't importuipath.runtime.governance.*so they're unaffected. Host CLI wiring is a follow-up.Follow-ups (not in this PR)
LiveTrackEventDispatcher.dispatchfromuipath-platformas the non-blockingtrack_event, anddispatcher.shutdownas theon_dispose.vaderSentiment/chardetinto[project.optional-dependencies].governanceto reduce install footprint for non-governance consumers.🤖 Generated with Claude Code
Development Package