[PR #6644] fix(prebuilt): add handle_tool_errors parameter to create_react_agent #5192

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

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

State: closed
Merged: No


Summary

Add handle_tool_errors parameter to create_react_agent with a default of True to maintain backward compatibility.

This fixes the issue where tool errors were not being handled by default after version 1.0.1, causing agents to crash instead of returning error messages to the LLM.

Changes:

  • Added handle_tool_errors: bool = True parameter to create_react_agent
  • The parameter is passed to the internally created ToolNode when tools are provided as a list
  • If a ToolNode is passed directly, its error handling configuration is preserved
  • Added documentation for the new parameter

Fixes #6486

Test plan

  • Added test_handle_tool_errors_default_true - verifies tool errors are handled by default
  • Added test_handle_tool_errors_false_propagates - verifies errors propagate when handle_tool_errors=False
  • Both tests pass for v1 and v2 versions
  • Ran make format and make lint successfully
**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6644 **State:** closed **Merged:** No --- ## Summary Add `handle_tool_errors` parameter to `create_react_agent` with a default of `True` to maintain backward compatibility. This fixes the issue where tool errors were not being handled by default after version 1.0.1, causing agents to crash instead of returning error messages to the LLM. **Changes:** - Added `handle_tool_errors: bool = True` parameter to `create_react_agent` - The parameter is passed to the internally created `ToolNode` when tools are provided as a list - If a `ToolNode` is passed directly, its error handling configuration is preserved - Added documentation for the new parameter Fixes #6486 ## Test plan - [x] Added `test_handle_tool_errors_default_true` - verifies tool errors are handled by default - [x] Added `test_handle_tool_errors_false_propagates` - verifies errors propagate when `handle_tool_errors=False` - [x] Both tests pass for v1 and v2 versions - [x] Ran `make format` and `make lint` successfully
yindo added the pull-request label 2026-02-20 17:51:21 -05:00
yindo closed this issue 2026-02-20 17:51:21 -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#5192