Skip to content

Conversation

@ohayolink
Copy link

Summary

This PR fixes parallel agent invocation in the supervisor architecture by changing the create_react_agent version from v2 to v1 when parallel_tool_calls=True. ref Issue #230

Problem

When parallel_tool_calls=True is enabled in the supervisor, parallel agent handoffs were failing due to how different versions of create_react_agent handle tool calls:
v1: Handles multiple tool calls in a way that allows ToolNode to combine Send commands properly
v2: Creates separate Send commands for each tool call individually, preventing proper command combination

Root Cause Analysis

  1. ToolNode Command Combination: The ToolNode in LangGraph has special logic to combine multiple Send commands from parallel tool calls into a single parent command (see _combine_tool_outputs method in tool_node.py https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_node.py#L403-L432)
  2. v2 Behavior Prevents Combination: When using v2, create_react_agent generates individual Send commands for each tool call separately, which prevents the ToolNode from properly combining them for parallel execution (see https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py#L805-L809)
  3. Handoff Tool Design: The handoff tools are specifically designed to work with this command combination mechanism. (see https://github.com/langchain-ai/langgraph-supervisor-py/blob/main/langgraph_supervisor/handoff.py#L106-L110)

@cluttered-cabinet
Copy link

@sydney-runkle do you know the right person to route this to?

@dy93
Copy link

dy93 commented Oct 17, 2025

ping

@naufal-fachri
Copy link

Dude, I have been debugging the source code for THISS, I thought there was an error in my code since I was having the same issue. UP for this !!

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.

4 participants