GPT WORLD / INDEPENDENT CODEX FIELD MANUAL 來源檢視 · 2026-07-31

回顧期號 / ASYNC

把 long-running response 做成 async job

Background work 需要 job identifier、polling/streaming policy、cancellation、expiry、idempotent consumption 與可見 status。

01 / DECIDE

架構決策

當 reasoning/tool work 超過 interactive request budget,但使用者仍需要可恢復結果時採用。

Background work 需要 job identifier、polling/streaming policy、cancellation、expiry、idempotent consumption 與可見 status。 先把 input、output、state 與 side effect 畫成一條可觀察路徑,再決定 把 long-running response 做成 async job 要放在哪一層。

02 / BUILD

三步實作

  1. 01

    框定合約

    先寫下 caller、資料分類、成功條件、timeout、取消與 ownership。當 reasoning/tool work 超過 interactive request budget,但使用者仍需要可恢復結果時採用。

  2. 02

    建立單一路徑

    只實作一條 end-to-end path,保留 request correlation、typed state 與可逆 failure handling。Background work 需要 job identifier、polling/streaming policy、cancellation、expiry、idempotent consumption 與可見 status。

  3. 03

    證明結果

    把驗收寫成可重跑的 fixture、contract test 或 browser test。State-machine test 涵蓋 queued、running、streaming、completed、cancelled、expired、failed 與 duplicate consumer。

03 / BOUND

Production 邊界

敏感 workload 使用 background execution 前,先確認 storage 與 Zero Data Retention compatibility。

04 / PROVE

驗收證據

State-machine test 涵蓋 queued、running、streaming、completed、cancelled、expired、failed 與 duplicate consumer。

SOURCE / HTTP

可重現來源探針

curl -fsSI 'https://developers.openai.com/api/docs/guides/background' | sed -n '1,5p'