# 1.3 Parallel tool calling

The model emits tool_use blocks; the host dispatches them and returns ID-matched tool_result blocks.

1. The model emits a structured tool_use block with an ID.
2. The host validates and dispatches the call.
3. tool_result returns, matched by tool_use_id.
4. Independent calls fan out in one turn, saving a round-trip.

- **Use when:** Independent, read-only lookups.
- **Avoid:** Concurrent calls with data dependencies or side effects.

```
# one model turn, two independent requests
reply.tool_calls = [
    { id: "1", name: "weather", input: { city: "Paris" } },
    { id: "2", name: "fx_rate", input: { pair: "EUR/USD" } },
]

# your code runs both at once
results = await gather(*[run(c) for c in reply.tool_calls])

# each result carries its matching id
messages.append([{ id: c.id, content: r } for c, r in ...])
```

## References

- [Tool use with Claude](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) (Anthropic)
- [Writing effective tools for AI agents](https://www.anthropic.com/engineering/writing-tools-for-agents) (Anthropic)
- [Parallel tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/parallel-tool-use) (Anthropic)
- [Function calling](https://platform.openai.com/docs/guides/function-calling) (OpenAI)
