Skip to content

fix: categorize invalid tool input as user error - #1020

Merged
radu-mocanu merged 1 commit into
mainfrom
fix/tool-input-validation-categorization
Aug 3, 2026
Merged

fix: categorize invalid tool input as user error#1020
radu-mocanu merged 1 commit into
mainfrom
fix/tool-input-validation-categorization

Conversation

@radu-mocanu

@radu-mocanu radu-mocanu commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • categorize dynamic tool argument validation failures as user input errors
  • identify the failing tool and preserve schema validation details
  • guide users to revise the agent prompt or tool configuration

Why

Invalid generated tool arguments were reported as unexpected runtime failures instead of actionable user errors.

Copilot AI review requested due to automatic review settings August 3, 2026 00:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves agent tool error reporting by reclassifying dynamic tool argument schema validation failures as user input errors, preserving validation details and identifying the tool that failed. This makes invalid tool calls surface as actionable AGENT_RUNTIME.INVALID_INPUT_ARGUMENT errors (USER category) instead of generic unexpected runtime failures.

Changes:

  • Wrap pydantic.ValidationError raised during tool argument parsing/validation into AgentRuntimeErrorCode.INVALID_INPUT_ARGUMENT with UiPathErrorCategory.USER.
  • Include the failing tool name in the error title and preserve validation details in the error detail.
  • Add a regression test to verify the new error code/category/title/detail behavior and bump package version to 0.15.1.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/uipath_langchain/agent/tools/base_uipath_structured_tool.py Catches schema validation failures and raises AgentRuntimeError categorized as USER with tool-specific title and validation detail.
tests/agent/tools/test_base_uipath_structured_tool.py Adds an async test asserting invalid dynamic tool inputs are surfaced as INVALID_INPUT_ARGUMENT with USER category and helpful messaging.
pyproject.toml Bumps package version to 0.15.1.
uv.lock Updates lockfile metadata to match the new package version.

Comment thread tests/agent/tools/test_base_uipath_structured_tool.py Outdated
@radu-mocanu
radu-mocanu force-pushed the fix/tool-input-validation-categorization branch 2 times, most recently from 2ec811b to a13e3ed Compare August 3, 2026 06:38
Comment on lines +141 to +148
def _invalid_input_error(self, error: ValidationError) -> AgentRuntimeError:
return AgentRuntimeError(
code=AgentRuntimeErrorCode.INVALID_INPUT_ARGUMENT,
title=f"Invalid input for tool '{self.name}'",
detail=str(error),
category=UiPathErrorCategory.USER,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: User & Deployment errors should be actionable. I would add guidance on what the user can do to solve it, like "revise the prompts and the tool configuration" or something

@radu-mocanu
radu-mocanu force-pushed the fix/tool-input-validation-categorization branch from a13e3ed to 68578a4 Compare August 3, 2026 10:52
@radu-mocanu
radu-mocanu force-pushed the fix/tool-input-validation-categorization branch from 68578a4 to 3dfcae6 Compare August 3, 2026 11:31
@radu-mocanu
radu-mocanu enabled auto-merge (squash) August 3, 2026 11:31
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@radu-mocanu
radu-mocanu merged commit 2baaa0d into main Aug 3, 2026
44 checks passed
@radu-mocanu
radu-mocanu deleted the fix/tool-input-validation-categorization branch August 3, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants