Skip to content

Conversation

@riunyfir
Copy link
Contributor

Description: Feature OverviewAdded the sequential_tool_calls parameter to support sequential execution during batch tool calls, ensuring subsequent tools can access state updates from previous tools.
Problem BackgroundWhen an LLM returns multiple tool calls at once, the default behavior is concurrent execution, where all tools operate on the same initial state snapshot. When dependencies exist between tools, subsequent tools cannot obtain state updates from previous ones, leading to unexpected results.
SolutionNew Parameter: Added the sequential_tool_calls parameter to the create_agent function (defaults to False for backward compatibility).Implement SequentialToolNode Class: Wraps the standard ToolNode to execute tool calls sequentially.State Propagation: Updates state after each tool execution to ensure subsequent tools can see results from the previous one.
Key ChangesFile: libs/langchain_v1/langchain/agents/factory.pyAdded SequentialToolNode class (supports synchronous and asynchronous operations).Modified create_agent function signature to include the sequential_tool_calls parameter.Updated docstrings to explain usage of the new parameter.
Issue: Fixes #33832
Dependencies: None

@github-actions github-actions bot added langchain Related to the package `langchain` feature labels Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature langchain Related to the package `langchain`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support sequential state propagation for batch tool calls

1 participant