Tool calls from one model step run one at a time, but the docs say they run in parallel
メンテナーはふだん 1 日以内に返信
@tombeckenham がすでに取り組んでいます。
2026年9月28日 から。
評価
この issue はまだ評価されていません。
説明
TanStack AI version
@tanstack/ai 0.63.0. Also on 0.61.0.
Framework/Library version
Node 24, server-side chat(). No framework involved.
Describe the bug and the steps to reproduce it
When the model asks for several tools in one step, chat() runs them one after another. A step's tool time is the sum of its tools instead of the slowest one. With slow tools (a web search that takes 5 to 20 s), three calls in one step take 30 s instead of 10.
The docs say the opposite. Parallel Tool Execution (docs/tools/tool-architecture.md): three get_weather calls in one step, "All execute simultaneously, then LLM generates comparison."
What goes wrong
executeToolCalls (tool-calls.ts:929) loops for (const toolCall of toolCalls) and runs each server tool with yield* executeServerTool(...) (:1151, :1202), so each tool finishes before the next one starts. The engine hands it the whole step's batch (chat/index.ts:2161, :2349). ToolCallManager.executeTools (:350-396) has the same shape: await tool.execute(...) inside a for loop.
There's no option to change it and no comment giving a reason. The approval batch gate (:920) decides before anything runs, so it doesn't need the tools to run one at a time.
Repro
Sandbox linked below (output in the preview). It's the docs' own example: the model calls get_weather three times in one step, and each call takes 500 ms. The model is scripted, so no API key.
5ms start NYC
509ms start SF
1010ms start LA
1513ms done
Expected, per the docs: all three start at about 0 ms, and done at about 500 ms.
Fix
Start a step's server tools together and wait for all of them, keeping what the loop does today:
- Results stay in call order, so the next model call sees them in the order it asked.
onBeforeToolCallstill decides for each tool before it runs, andonAfterToolCallstill runs for each result.- A tool's custom events still stream while it runs. They would interleave across tools, and each already carries its
toolCallId.
Is running them one at a time intentional, for example for the middleware hooks or event order? If not, I'm happy to send a PR. If some apps rely on the current order, it could be an option instead of the default.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/s/259lf4
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No response
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- 主要言語
- TypeScript
- スター
- 3.2k
- フォーク
- 365
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 263
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/ai のほかの issue
-
openai-base: a tool call cut off by finish_reason "length" is reported as "tool_calls" and re-sent対応中かも @tombeckenham が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
ai-ollama: streamed chat() reports finishReason "stop" when done_reason is "length"対応中かも @AlemTuzlak が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
ai-vercel-gateway: surface provider_metadata.gateway cost on usage (usage.cost)対応中かも @tombeckenham が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
withPersistence does not save activity rows when a run is stopped or fails対応中かも @tombeckenham が 6 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
Discriminate status-dependent record and option types (RunRecord, SessionIndexEntry, InputState, durable-only options)対応中かも @jherr が 7 日前に担当しました。 オープンenhancement waiting-on: maintainer
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
cloudscape-design/components#5184 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JarX-Concepts/react-native-platform-components#130 ·
メンテナーはふだん 1 日以内に返信
-
fix(api): optimize-for-web /preview outer catches miss asDecoderOutOfMemory on V8 OOM and SIGKILLオープンarea: backend bug priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
snapotter-hq/SnapOtter#3773 ·
メンテナーはふだん 1 日以内に返信
-
ai-driven-qa ux-audit
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
linagora/twake-contacts-frontend#386 ·
メンテナーはふだん 1 日以内に返信
-
git: README should state plainly that without --repository every reachable repository is in scopeオープンdocumentation server-git v2
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/servers#5225 ·
メンテナーはふだん 1 日以内に返信