Responses API uses an item-based model.
Use it when the model needs live data, application logic, or side effects that do not exist in the prompt itself.
Define Tools
tool_choice: "auto" for normal model-driven behavior. Force a specific tool only when your application really needs it.
Workflow
Define the tool in the request
Send one or more function definitions in
tools[] and usually leave
tool_choice on "auto".Inspect the model's function call
Read the returned
function_call item from output[] and parse its
arguments payload.Execute the tool in your application
Run the requested function using your own business logic, external API
call, or internal system lookup.
Send the tool result back
Continue with a follow-up request that includes a
function_call_output item using the same call_id.Model Tool Call Output
The model can return afunction_call item in the output array:
Send Tool Results Back
You return the tool result in a follow-up request usingfunction_call_output:
Streaming Tool Arguments
When streaming, arguments arrive incrementally viaresponse.function_call_arguments.delta events. Buffer those deltas until the matching .done event arrives.
Some reasoning-capable models also emit a reasoning item before or alongside the tool call. If you want continuity across tool turns, replay that reasoning item unchanged in the follow-up request. See Responses Reasoning.
Common mistakes
- forcing a tool when the model should be allowed to choose naturally
- sending the tool result back in a chat-style
role: toolmessage instead of afunction_call_outputitem - parsing tool arguments before the streamed argument payload is complete
- exposing tools that can cause side effects without application-level authorization checks