Waiting on a background OpenAI Responses API request

OAI-SE Responses API & Vector Stores Medium Question 20 of 24

A customer support portal starts a long-running Responses API request with background set to true. The creation call returns HTTP 200 with status queued, and the UI renders an empty answer as if the work had finished.

How should the application wait for the answer and determine whether generation succeeded?

Show answer and explanation

DPoll the response by ID while status is queued or in_progress, then read its final status

A background response is acknowledged while still queued, so the client polls by ID while status is queued or in_progress and then branches on the terminal status, handling failed, cancelled and incomplete explicitly. Waiting for non-empty text never terminates on a failed or incomplete response, retrying on empty output duplicates in-flight work, and turning background off restores the timeouts it was introduced to avoid.

Source: developers.openai.com/api/docs/guides/background

Anonymous, no account needed. Your tally stays in this browser.

Next question Start 5 timed questions Browse all 24 original OAI-SE practice questions