01 / DECIDE
Architecture decision
Use it when reasoning or tool work exceeds an interactive request budget but users still need a recoverable result.
Background work needs a job identifier, polling or streaming policy, cancellation, expiry, idempotent consumption, and a user-visible status. Map input, output, state, and side effects as one observable path before deciding which layer owns make long-running responses an asynchronous job.
02 / BUILD
Three-step implementation
- 01
Frame the contract
Write down the caller, data classification, success condition, timeout, cancellation, and ownership. Use it when reasoning or tool work exceeds an interactive request budget but users still need a recoverable result.
- 02
Build one narrow path
Implement one end-to-end path with request correlation, typed state, and reversible failure handling. Background work needs a job identifier, polling or streaming policy, cancellation, expiry, idempotent consumption, and a user-visible status.
- 03
Prove the outcome
Turn acceptance into a repeatable fixture, contract test, or browser test. State-machine tests cover queued, running, streaming, completed, cancelled, expired, failed, and duplicate-consumer paths.
03 / BOUND
Production boundary
Review storage and Zero Data Retention compatibility before selecting background execution for sensitive workloads.
04 / PROVE
Acceptance evidence
State-machine tests cover queued, running, streaming, completed, cancelled, expired, failed, and duplicate-consumer paths.
SOURCE / HTTP
Reproducible source probe
curl -fsSI 'https://developers.openai.com/api/docs/guides/background' | sed -n '1,5p'