Calling a single tool
Invoke a single tool and include its response in a follow-up request. Also known as “single-shot” tool calling.- cURL
- Python
- JavaScript
Parallel tool calling
- cURL
- Python
- JavaScript
Request multiple tool calls in parallel, then send all tool responses back to the model.Generate a response with multiple tool results
Multi-turn tool calling (Agent loop)
An agent loop allows the model to decide when to invoke tools and incorporate their results into its replies. It also might help to tell the model that it is in a loop and can make multiple tool calls.- Python
- JavaScript
Tool calling with streaming
When streaming, gather every chunk ofthinking
, content
, and tool_calls
, then return those fields together with any tool results in the follow-up request.
- Python
- JavaScript