feat: Governance runtime implementation#899
Open
viswa-uipath wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a LangChain/LangGraph governance integration layer to uipath-langchain, wiring UiPath’s governance evaluator into LangChain callbacks and exposing registration via an entry point so uipath-runtime can discover the adapter.
Changes:
- Introduces a
LangChainAdapter+ governed proxy wrapper and a callback handler that callsEvaluatorProtocolhooks for model/tool events. - Adds governance adapter registration (
uipath.governance.adaptersentry point) with import-time idempotent self-registration. - Updates dependency/lock configuration to pull in updated
uipath-coreand a dev/test build ofuipath-runtime(currently with non-portable lockfile sources).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
src/uipath_langchain/governance/adapter.py |
Implements the LangChain/LangGraph adapter, wrapper, and callback handler that triggers governance evaluations. |
src/uipath_langchain/governance/__init__.py |
Registers the governance adapter on import and exposes an entry-point registration function. |
pyproject.toml |
Adds governance adapter entry point; bumps uipath-core; pins uipath-runtime to a dev build and adds a uv TestPyPI source override. |
uv.lock |
Updates locked dependencies, but currently includes a machine-local Windows editable uipath-runtime source. |
Comment on lines
8
to
13
| "uipath>=2.10.79, <2.11.0", | ||
| "uipath-core>=0.5.17, <0.6.0", | ||
| "uipath-core>=0.5.18, <0.6.0", | ||
| "uipath-platform>=0.1.61, <0.2.0", | ||
| "uipath-runtime>=0.11.0, <0.12.0", | ||
| "uipath-runtime==0.11.0.dev1001180441", | ||
| "langgraph>=1.1.8, <2.0.0", | ||
| "langchain-core>=1.2.11, <2.0.0", |
Comment on lines
+161
to
+163
| [tool.uv.sources] | ||
| uipath-runtime = { index = "testpypi" } | ||
|
|
7e335b2 to
8675ab9
Compare
7f54963 to
487db83
Compare
|
Registers a LangChain/LangGraph adapter with the uipath-core adapter registry so GovernanceRuntime can attach BEFORE_MODEL / AFTER_MODEL / TOOL_CALL / AFTER_TOOL hooks via LangChain's callback system. Exposed as a uipath.governance.adapters entry point and self-registers on import. Bumps uipath-core to 0.6.x and uipath-runtime to 0.11.x to pick up the new adapter contracts. Key behaviour: - BEFORE_MODEL is scoped to the latest message only. Earlier passes concatenated the entire prompt history, which re-fired violations from older turns on every subsequent LLM call. The callback now takes the last entry of the last batched prompt (mirrors the BEFORE_AGENT latest_only contract in uipath-runtime). - List-of-blocks content (multimodal, OpenAI function-call, Anthropic tool_use, Claude extended thinking) is walked via _extract_block_text instead of str(msg.content), so structured shapes produce clean text with no dict-repr noise that breaks regex/field rules. - Both on_chat_model_start and on_llm_start cap extracted input at _BEFORE_MODEL_TEXT_CAP = 64000 (matches the runtime side). - register_governance_adapter is idempotent — uses the AdapterRegistry instance state as the single source of truth (no module-level flag). Packaging: - prerelease = "allow" plus override-dependencies for uipath-runtime under [tool.uv] so the dev pin can satisfy the umbrella's stable-only constraint. Re-locked so uipath-runtime resolves from testpypi rather than the local editable Windows path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
487db83 to
7bb7c33
Compare
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.



TEST IN PROGRESS: Changes for lang-chain adapter to support governance
Development Package
uipath pack --nolockto get the latest dev build from this PR (requires version range).