AI Help

How do I run a long AI request in the background without keeping the connection open?

Use background mode on a supported Responses request and persist its response ID so another worker can check the result.

Steps to follow

  1. Confirm that background mode supports the model and your retention requirements. Check its documented storage behavior.
  2. Create the request with the background option and store the returned ID and job association.
  3. Poll or use supported completion events until the response reaches a terminal state. Handle failed, cancelled and incomplete results.

Example in practice

Illustrative example. A long report job can return a job reference to the interface while a worker later retrieves the completed response.

Related AI help

Official guidance

OpenAI documentation