Allow dynamic tool calls to execute in parallel (#54654)

## Why

Dynamic tool calls should remain independent while waiting for client responses, so one pending call does not block another from reaching the client.

## What changed

Enable parallel execution in `DynamicToolHandler`, allowing code mode programs to issue concurrent dynamic tool calls with `Promise.all`.

## Testing

Add a code mode regression test that waits for two dynamic tool requests before responding, resolves them in reverse order, and verifies that `Promise.all` preserves the expected result order.

GitOrigin-RevId: c93c1fea720f76c772b0e3452ddc8c01fb1a08d8
This commit is contained in:
Steve Coffey
2026-10-16 16:28:53 +00:00
committed by copyberry
parent b26b0a7a77
commit beae473be8
3 changed files with 122 additions and 0 deletions
@@ -85,6 +85,10 @@ impl DynamicToolHandler {
}
impl ToolExecutor<ToolInvocation> for DynamicToolHandler {
fn supports_parallel_tool_calls(&self) -> bool {
true
}
fn tool_name(&self) -> ToolName {
self.tool_name.clone()
}