← All labs
D1·Fix the code
Parallel tool results
An agent that queries three services has started making tool calls one at a time instead of in parallel, roughly a week after this harness shipped. Nothing errors, and every result reaches Claude. Find why the parallelism decayed.
tool_uses = [b for b in response.content if b.type == "tool_use"]
messages.append({"role": "assistant", "content": response.content})
# Execute concurrently, then hand each result back as it lands.
for block in tool_uses:
result = run_tool(block.name, block.input)
messages.append({
"role": "user",
"content": [
{"type": "tool_result", "tool_use_id": block.id, "content": result}
],
})1.What is wrong with how the results are returned?
2.What is the correct structure?