fix(http-request): accept any-case pair keys and return model-fixable errors - #1126
Merged
Merged
Conversation
… errors
Models sometimes write header and param pairs as {"Name", "Value"}. The
schema keys are lowercase and pydantic matches them case-sensitively, so
the call failed validation and faulted the run. The pair keys are now
lowercased before validation; header and param values keep their case.
Errors the model can correct (schema mismatches, a bad url, method or
timeout, a blocked or unresolvable host, timeouts and connection errors)
are raised as ToolException with handle_tool_error on, so they come back
as an error tool message instead of faulting the run. Non-conversational
agents have no node-level error handling, so a single bad call ended the
whole job.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016T19pn6oVDUNv9YHzgQQUP
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the stated behavior and includes focused coverage for the affected execution paths.
Review effort: Balanced
Findings: None
What changed in this PR
Improves HTTP Request tool resilience so agents can recover from casing mistakes and model-fixable failures.
Changes:
- Normalizes header and parameter pair keys case-insensitively.
- Returns validation, network, and SSRF errors as error
ToolMessageresponses. - Adds coverage for normalization and non-conversational tool-node behavior.
| File | Description |
|---|---|
http_request_tool.py |
Adds normalization and recoverable error handling. |
base_uipath_structured_tool.py |
Broadens validation-error return typing. |
test_http_request_tool.py |
Tests successful normalization and error responses. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
radu-mocanu
approved these changes
Oct 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.



Why
Agents using the HTTP Request tool failed at random with
AGENT_RUNTIME.INVALID_INPUT_ARGUMENT:The schema expects
{"name", "value"}pairs, but models sometimes write{"Name", "Value"}, and pydantic matches keys case-sensitively. Because non-conversational agents have no node-level tool error handling, one malformed call out of many ended the whole job, and the model never got to retry.What
_HttpRequestToolsubclass lowercasesname/valuekeys inheadersandparamsbefore validation. Only the keys change; header and param values keep their case, so tokens and case-sensitive query values are untouched._pairs_to_dictdoes the same lookup for input that skips validation.ToolExceptionand setshandle_tool_error=True, so these come back asToolMessage(status="error")and the run continues:_invalid_input_erroroverride)httpxtransport errorsBaseUiPathStructuredTool._invalid_input_errorhas a wider return type (-> Exception). Other tools behave exactly as before.Tests
create_tool_node. That last one is the non-conversational graph path, which now yields an error tool message instead of raising.tests/agent: 2281 passed, 3 skipped. ruff, mypy andlint_httpx_client.pyare clean.🤖 Generated with Claude Code
https://claude.ai/code/session_016T19pn6oVDUNv9YHzgQQUP