The Responses API supports comprehensive tool calling capabilities, allowing models to call functions, execute tools in parallel, and handle complex multi-step workflows.Documentation Index
Fetch the complete documentation index at: https://docs.anannas.ai/llms.txt
Use this file to discover all available pages before exploring further.
Stateless APIRemember that this API is stateless. When handling multi-turn tool calls, you must include the complete conversation history (including previous tool calls and results) in each request.
Basic Tool Definition
Define tools using the OpenAI function calling format:Tool Choice Options
Control when and how tools are called using thetool_choice parameter:
| Tool Choice | Description |
|---|---|
"auto" | Model decides whether to call tools (default) |
"none" | Model will not call any tools |
{"type": "function", "name": "tool_name"} | Force specific tool call |
Handling Tool Calls
When a model calls a tool, the response contains function call information in the output:Multi-Turn Tool Calling
For multi-turn conversations with tool calls, include the tool results in subsequent requests:Parallel Tool Calls
Enable parallel tool execution withparallel_tool_calls:
Best Practices
- Clear tool descriptions: Provide detailed descriptions for better tool selection
- Validate tool results: Always validate and sanitize tool execution results
- Handle errors gracefully: Implement error handling for tool execution failures
- Use parallel calls: Enable
parallel_tool_callswhen multiple independent tools can run simultaneously - Tool result format: Return tool results as JSON strings for consistency
Was this page helpful?