[PR #6021] feat(prebuilt): add support for handle_tool_errors with single exception type #4790

Closed
opened 2026-02-20 17:50:45 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/6021

State: closed
Merged: Yes


This PR extends the ToolNode handle_tool_errors property to also accept a single exception type: type[Exception].

Example:

tool_node_with_error_handling = ToolNode(
    [tool1, tool2, tool3], handle_tool_errors=ValueError
).invoke(...)
"""A tool node that will only retry a failed tool call if a ValueError is raised"""
**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6021 **State:** closed **Merged:** Yes --- This PR extends the `ToolNode` `handle_tool_errors` property to also accept a single exception type: `type[Exception]`. Example: ```python tool_node_with_error_handling = ToolNode( [tool1, tool2, tool3], handle_tool_errors=ValueError ).invoke(...) """A tool node that will only retry a failed tool call if a ValueError is raised""" ```
yindo added the pull-request label 2026-02-20 17:50:45 -05:00
yindo closed this issue 2026-02-20 17:50:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4790