feat(licensing): normalize provider HTTP errors via provider_errors module#926
Open
vldcmp-uipath wants to merge 1 commit into
Open
feat(licensing): normalize provider HTTP errors via provider_errors module#926vldcmp-uipath wants to merge 1 commit into
vldcmp-uipath wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors LLM Gateway provider HTTP error extraction into a dedicated provider_errors module so licensing.py can focus on mapping normalized statuses to AgentRuntimeError, while also bumping uipath-langchain-client to pick up the released Bedrock error-surfacing fix.
Changes:
- Adds
ProviderError+extract_provider_errorto normalize provider SDK exception shapes (including LangChain__cause__wrapping). - Simplifies
raise_for_provider_http_errorto delegate extraction and use gatewaydetailwhen available. - Bumps
uipath-langchain-clientminimum to>=1.14.1and adds targeted tests for provider error normalization.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/uipath_langchain/chat/provider_errors.py |
Introduces normalized provider error extraction logic. |
src/uipath_langchain/agent/exceptions/licensing.py |
Delegates provider error parsing and maps normalized status to AgentRuntimeError. |
tests/chat/test_provider_errors.py |
Adds unit tests covering provider shapes and LangChain wrapping. |
pyproject.toml |
Bumps package version and raises uipath-langchain-client floor to >=1.14.1. |
uv.lock |
Updates lockfile for the version bump and dependency floor change. |
51bb902 to
38159e8
Compare
…odule Extract the per-provider exception parsing out of licensing.py into a focused chat/provider_errors.py module. extract_provider_error walks the __cause__ chain and reads the HTTP status + gateway `detail` from whichever attribute each SDK exposes (OpenAI/Anthropic .body, Vertex .details, Bedrock UiPathAPIError .body, legacy botocore .response), returning a normalized ProviderError. licensing.py now just maps that status to an AgentRuntimeError. Bumps uipath-langchain-client to 1.14.1, which makes the Bedrock path raise on gateway errors instead of swallowing them. Adds tests/chat/test_provider_errors.py covering all provider shapes, the LangChain __cause__ wrapping, the empty no-match case, and the non-int-status false-positive guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
38159e8 to
59a6c50
Compare
|
radu-mocanu
reviewed
Jun 23, 2026
| @@ -0,0 +1,95 @@ | |||
| """Normalize LLM provider HTTP errors into a common shape. | |||
|
|
|||
| Providers behind the LLM Gateway each raise a different exception type, but all | |||
Collaborator
There was a problem hiding this comment.
should uipath-langchain know about llm gateway?
I think this should be the concern of the upstream clients lib
radu-mocanu
approved these changes
Jun 23, 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
Refactors the provider HTTP-error handling out of
licensing.pyinto a focused, testedchat/provider_errors.pymodule, and picks up the released Bedrock fix.LLM providers behind the gateway each raise a different exception type (LangChain sometimes wraps them again), but all carry the same gateway body (
{status, detail, ...}).extract_provider_errorwalks the__cause__chain and reads the status +detailfrom whichever attribute each SDK exposes:.status_code.bodyUiPathAPIErrorvia WrappedBotoClient).status_code.body.code.details.response["ResponseMetadata"].response["Error"]licensing.pyis now just the policy layer — it maps the normalized status to anAgentRuntimeError.Changes
src/uipath_langchain/chat/provider_errors.py—ProviderError+extract_provider_error(recursive__cause__walk, one small extractor per provider).agent/exceptions/licensing.py— delegates extraction toprovider_errors; keeps only the status→error-code mapping.uipath-langchain-clientfloor to>=1.14.1— the released version that makes the BedrockWrappedBotoClientraise on gateway errors instead of swallowing them (previously surfaced as a misleading "No 'output' key … misconfiguration of endpoint or region"ValueError). Also fixes Vertexdetailextraction, which was previously dropped.tests/chat/test_provider_errors.py— covers all provider shapes, the LangChain__cause__wrapping, the empty no-match case, and the non-int-status false-positive guard.Testing
pytest tests/chat/test_provider_errors.py→ 7 passed.🤖 Generated with Claude Code