In a multi-agent research pipeline, an orchestrator spawns three parallel subagents to research different sections of a topic. Each subagent uses a tool that calls a web search API. After all three complete, the orchestrator must synthesize results. The orchestrator sends tool results from all three subagents in a single synthesis request. What is the correct format for passing multiple tool results from parallel tool calls in a single API request?
Select an answer to reveal the explanation.
Short Explanation
Here's the deal — you include all three tool_result blocks in one user message, and each one references the tool_use_id from its matching tool_use block. That's how you return parallel tool results in a single API request.
Full Explanation
The correct approach is to include all three tool_result content blocks in a single user message, each with the tool_use_id matching its corresponding tool_use block from the assistant's prior message. The Anthropic API supports returning multiple tool results in parallel by including multiple tool_result content blocks in a single user message turn. Each tool_result must reference the tool_use_id of the corresponding tool_use block in the prior assistant message. This is the documented pattern for resolving parallel tool calls. Sending three separate API requests sequentially, each containing one tool_result block, and aggregating the model's three responses client-side before presenting them as the synthesis input is wrong because it does not match the parallel tool call pattern; it creates three separate conversation branches that cannot be easily synthesized and does not use the correct protocol for returning tool results to the model. Wrapping all three tool results in a single tool_result block using a JSON array as the content value is wrong because it is not the API specification; tool_result blocks are per-tool, not aggregated. Placing the first tool result in the user message and the remaining two in the next assistant message prefill to simulate parallel resolution is wrong because it conflates roles; tool_result is a user-role content block, not an assistant-role block, and this approach violates the turn structure.