background mode when a response may take a long time to complete, such as multi-step tool use or large generation tasks.
The API returns immediately with a queued response, and you retrieve the result later by polling or streaming.
Create a background response
Setbackground to true and stream to false.
The API creates the response, starts processing it asynchronously, and returns immediately with status: "queued".
id to retrieve the result later.
Poll for the result
CallGET /responses/{response_id} until the status reaches a terminal state.
| Status | Meaning |
|---|---|
queued | The request is waiting to be picked up |
in_progress | The model is generating output |
completed | Generation finished successfully |
failed | An error occurred during processing |
incomplete | The response was cut short (e.g. token limit) |
cancelled | The response was cancelled before completing |
queued or in_progress.
Stream events from a background response
If you want real-time updates instead of polling, retrieve the response withstream set to true.
The API returns server-sent events as the response is processed.
response.completed or response.failed.
If the response has already completed when you call this endpoint, you receive a single terminal event with the final response and the stream closes immediately.
Stream events at creation time
You can also stream events directly when creating a background response by setting bothbackground and stream to true.
response.queued, followed by response.created, intermediate events such as response.output_text.delta, and finally a terminal event like response.completed.
This is useful when you want to show progress in a UI while the work runs in the background.
If the client disconnects, the response continues processing and can be retrieved later.
Cancel a background response
If you no longer need the result, cancel a queued or in-progress response.cancelled.
Responses that have already completed or failed cannot be cancelled.
Next steps
- See generate a response for the basics of creating responses
- See spawn subagents using the Responses API for combining background responses with tool-based workflows
- Review the Responses API reference for the full list of parameters and response fields