-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
When Claude returns multiple tool_use blocks in a single response (e.g., 7 parallel bash calls), the agent executes them sequentially in handle_native_tool_calls(). For N tools at ~2s each, latency is O(N) instead of O(1).
Current behavior
streaming.rs:handle_native_tool_calls iterates tool_calls with a sequential for loop, awaiting each execute_tool_call before starting the next.
Proposed solution
Replace the sequential loop with futures::future::join_all to execute all tool calls concurrently. Process results (metrics, channel sends, message building) sequentially after completion.
Key design decisions:
- Use
join_all(notJoinSet) to avoid'staticlifetime requirements on borrowed executor - Trust the model's parallelism signal: multiple tool_use in one response = independent calls
- Add optional
max_parallel_toolsconfig (default 8) withbuffer_unorderedfallback - No trait changes needed:
execute_tool_call(&self)is alreadySend + Sync
Files
crates/zeph-core/src/agent/streaming.rs— core changecrates/zeph-core/src/config.rs— optional concurrency limitconfig/default.toml— config documentation
Plan
.local/plan/parallel-tool-execution.md
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request