Tool calls from one model step run one at a time, but the docs say they run in parallel
I maintainer di solito rispondono entro 1 giorno
@tombeckenham ci sta già lavorando.
Dal 28/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 3.1k
- Fork
- 340
- Merge medio
- 2g 10h
- PR unite (30g)
- 175
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/ai
-
update elevenlabsForse già presa @tombeckenham l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
onAfterToolCall failure records a second, contradictory result for a successful server toolForse già presa @AlemTuzlak l’ha presa oggi. Apertahas-pr waiting-on: maintainer
TanStack/ai#1558 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
SSE and NDJSON response streams drain unread sources without backpressureForse già presa @tombeckenham l’ha presa oggi. Apertahas-pr waiting-on: maintainer
TanStack/ai#1556 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Solid useChat drops earlier turns after a reactive request option changesForse già presa @AlemTuzlak l’ha presa oggi. Apertahas-pr waiting-on: maintainer
TanStack/ai#1552 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
OpenRouter adapters: optional tool fields cannot be omitted (Chat Completions) or fail validation (Responses)Forse già presa @tombeckenham l’ha presa 1 giorno fa. Apertahas-pr waiting-on: maintainer
TanStack/ai#1542 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
priority: P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
prime-radiant-inc/evener#3291 ·
I maintainer di solito rispondono entro 1 giorno
-
accessibility bug revealjs
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
quarto-dev/quarto-cli#14961 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
supabase/agent-skills#614 ·
-
Content
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
RunestoneInteractive/rs#1559 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni