fix: categorize invalid tool input as user error - #1020
Conversation
There was a problem hiding this comment.
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.ValidationErrorraised during tool argument parsing/validation intoAgentRuntimeErrorCode.INVALID_INPUT_ARGUMENTwithUiPathErrorCategory.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. |
2ec811b to
a13e3ed
Compare
| 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, | ||
| ) | ||
|
|
There was a problem hiding this comment.
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
a13e3ed to
68578a4
Compare
68578a4 to
3dfcae6
Compare
|



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