Repository navigation
Description
Summary
Tole executes only the first tool_calls entry of each model response (openai.rs parse_completion: "First call only"; complete_streaming takes tool_calls.into_iter().next()). The other calls are silently dropped and the model has to ask for them again, costing one provider round trip each. The design doc says so (docs/prd.md:69 non-goal "Parallel tool execution", docs/architecture.md:169 "no parallel tool calls in Phase 1"), but it was written for a different model profile. The fleet model emits parallel calls routinely.
This issue is a measurement and a request to revisit the non-goal, not a proposal to build a concurrent executor.
Measured on the real fleet model (glm/glm-5.1 via the gateway, Tole 0.9.0 as shipped)
- Direct probe, "read a.txt, b.txt and c.txt": 3 tool calls in ONE response in 4 of 4 trials (2 explicit prompts, 2 vague ones); with
parallel_tool_calls: truealso 3, so the gateway accepts the parameter. - After tole executes only call 1, the history it resends is
[user, assistant(call a), tool(a)]. The model asks for the remaining calls in the next request (3 trials: 2, 1, 2 calls). - 3 natural read-only missions (repo summary, storage explanation, tool risk levels), 14 provider requests in total:
- calls per response:
[3,2,1,0],[3,3,1,2,1,0],[3,2,1,0] - the model emitted 22 calls; 11 were dropped; all 11 were asked for again in a later request
- mean request latency 5.7 s (1.1-8.9 s)
- the extra calls of the FIRST response alone account for 6 of 14 requests (43%), about 26 s of 80 s wall (32%): the summed latency of those six re-ask requests, 4.3 s each on average, not 6 x the 5.7 s overall mean.
- calls per response:
Why it is cheap in principle
A batch could be executed sequentially, in model order, as consecutive effect sandwiches. That is safe and keeps the "single-threaded turn loop" intact:
- the wire already supports several
tool_callsper assistant message (the transcript flattening emits one assistant message per intent; consecutive ones need merging into onetool_callsarray, with tool results in call order); - every call still goes through
gate::authorize, the approval gate, the loop guard and the effect sandwich; the first denial or failure stops the batch (remaining calls get a stub result, per the API rule that everytool_callneeds a result); - crash-resume stays correct because each call is its own sandwich with its own
ReplaySafety.
Risks to review: the public API (ProviderOutput carries a single ToolCall, provider.rs:22, and Provider::complete returns one ProviderOutput, so batching changes the published tole-core embedder trait: a semver-visible change), step-budget accounting (1 model step with N tools), the loop-guard fingerprint across a batch, the E5 golden file, ACP/serve observers that assume one call per step, and the cache-prefix property (history stays append-only). Restricting the first version to batches of ReadOnly tools avoids most approval questions.
Alternative (cheaper, weaker)
Send "parallel_tool_calls": false so the model plans one call at a time. It removes the dropped-call waste but not the round trips; measure before choosing.
Acceptance (for the investigation)
- Owner decision: revisit the non-goal, yes/no, and which of the two options.
- If yes: design note covering budget accounting, loop guard, denial mid-batch, crash-resume mid-batch, and observer events.
Found by
nca 0.5.5 runs read-only tools of a batch concurrently (join_all) and finished the 3-file scenario in 2 provider requests versus tole's 4 (mock, identical scripted model); then measured on the real model as above.
Activity
[-]harness: only the first tool call of a response runs \u2014 measured cost of the 'no parallel tool calls' non-goal on the real fleet model[/-][+]harness: only the first tool call of a response runs — measured cost of the 'no parallel tool calls' non-goal on the real fleet model[/+]feat(turn): run read-only tool-call batches sequentially in one step