What would you like to be added?
When the model returns multiple Agent tool calls in a single turn (e.g., spawning several Explore subagents in parallel), the ACP Session path should execute them concurrently instead of sequentially.
Currently, the CLI's ACP Session runs all tool calls in a sequential loop. This means when the model spawns multiple subagents to work on independent tasks, they run one after another rather than in parallel. For example, a research task that spawns 4 Explore agents would take approximately 4x longer than necessary.
Why is this needed?
Agent tools spawn independent sub-agents with no shared mutable state, making them safe to run concurrently. The core engine already recognizes this and runs agent tools concurrently while keeping other tools sequential to preserve any implicit ordering the model may rely on.
Bringing this same optimization to the ACP Session path would significantly improve performance for users on the interactive CLI when the model spawns multiple subagents in parallel.
Additional context
Relevant files:
- Core engine (reference implementation):
packages/core/src/core/coreToolScheduler.ts
- ACP Session (needs fix):
packages/cli/src/acp-integration/session/Session.ts
Key difference:
CoreToolScheduler partitions calls into agent calls and other calls, then runs agent calls concurrently via Promise.all while keeping other calls sequential
Session.ts runs all tool calls in a plain sequential loop
Suggested approach: In Session.ts, partition functionCalls into agent calls and other calls (similar to CoreToolScheduler), then run agent calls concurrently via Promise.all while keeping other calls sequential. The result parts ordering should be preserved to match the original function call order.
What would you like to be added?
When the model returns multiple Agent tool calls in a single turn (e.g., spawning several Explore subagents in parallel), the ACP Session path should execute them concurrently instead of sequentially.
Currently, the CLI's ACP Session runs all tool calls in a sequential loop. This means when the model spawns multiple subagents to work on independent tasks, they run one after another rather than in parallel. For example, a research task that spawns 4 Explore agents would take approximately 4x longer than necessary.
Why is this needed?
Agent tools spawn independent sub-agents with no shared mutable state, making them safe to run concurrently. The core engine already recognizes this and runs agent tools concurrently while keeping other tools sequential to preserve any implicit ordering the model may rely on.
Bringing this same optimization to the ACP Session path would significantly improve performance for users on the interactive CLI when the model spawns multiple subagents in parallel.
Additional context
Relevant files:
packages/core/src/core/coreToolScheduler.tspackages/cli/src/acp-integration/session/Session.tsKey difference:
CoreToolSchedulerpartitions calls into agent calls and other calls, then runs agent calls concurrently viaPromise.allwhile keeping other calls sequentialSession.tsruns all tool calls in a plain sequential loopSuggested approach: In
Session.ts, partitionfunctionCallsinto agent calls and other calls (similar toCoreToolScheduler), then run agent calls concurrently viaPromise.allwhile keeping other calls sequential. The result parts ordering should be preserved to match the original function call order.