Skip to main content

Parallel tool execution

When an agent needs weather, stock price, and calendar data, calling them sequentially wastes time. This recipe shows how to request multiple tool calls in parallel from a single model response, execute them concurrently, and return all results in one follow-up message.

The script

parallel_tools.py

Run it

Sample output

Async version for slow tools

If tools hit external APIs with latency, execute them concurrently with asyncio.gather:

Tips

  • clarke-1.0 handles parallel tool intent better than smaller models.
  • Structure tool names clearly — models rely on name and description to pick the right tool.
  • Keep descriptions short but include example inputs so arguments are formatted correctly.
  • Limit to 5-8 tools per call — more causes the model to miss or confuse tools.
  • Log which tools were called per request — it’s the #1 debugging signal for agent behavior.

Next steps

Tool calling agent

Build a full agent loop with tools

Structured extraction

Parse tool outputs into structured data