Background Response Lifecycle

A background run returns a continuation_token, then a poll loop runs through IN_PROGRESS until None

Background Response Lifecycle A background run returns a continuation_token, then a poll loop runs through IN_PROGRESS until None 01 / Response lifecycle 02 / Poll loop 03 / Outcomes Started · background=True · Response lifecycle · launch 01 Started background=True launch Token Issued · continuation_token · Response lifecycle · handle 02 Token Issued continuation_token handle Poll(token) · check status · Response lifecycle · loop 03 Poll(token) check status loop Done · returns None · Response lifecycle · terminal 04 Done returns None terminal IN_PROGRESS · still running · Poll loop · pending IN_PROGRESS still running pending in_progress re-run(token) Legend active state waiting terminal success failure / exit

Fire and Poll

  • • background=True returns immediately with a token
  • • The token is the handle to the running work
  • • Completion is signalled when the poll returns None

The Poll Loop

  • • Each poll re-runs with the same continuation_token
  • • IN_PROGRESS keeps the run alive without blocking
  • • The loop exits only when status resolves to done

Resumable Streams

  • • The last token also anchors a streamed response
  • • A dropped stream resumes from the last token
  • • No work is lost across a reconnect