[FEATURE] Add BidiToolUsesCompleteEvent and batch tool hooks
Author: pgrayyCreated Sep 10, 2026Updated Sep 22, 2026
Labelsenhancementpythonarea-hooksarea-bidirectional-streaming
SDK Language
Python
Problem Statement
BidiAgent executes each ToolUseStreamEvent immediately. It has no explicit boundary for a complete group of tool requests, making it difficult to support BeforeToolsEvent and AfterToolsEvent consistently with Agent.
Proposed Solution
- Add
BidiToolUsesCompleteEventcarrying an assistant message containing the complete group'stoolUseblocks. - Keep
ToolUseStreamEventfor streaming visibility. Use the completion event to schedule_run_tools()asynchronously, wrapping execution with the shared batch hooks and retaining existing per-tool hooks. - Let providers identify ready groups independently of response completion: Gemini's tool-call list, OpenAI's
response.done, and a defined Nova grouping boundary. Validate Nova's event ordering before choosing response-wide batching. - Establish the provider contract before bidi graduates: the loop must know before the first tool event whether to execute individual calls or await group completion. Define batch cancellation, interruption, and
end_turnsemantics.
Use Case
Apply validation, cancellation, and setup/cleanup to a complete tool group while the bidi receive loop continues processing audio and other events.
Source: strands-agents/harness-sdk