01 / DECIDE
Architecture decision
最終 payload 一括受信より perceived latency と progressive feedback が重要な場合に使う。
有用な stream は start、typed delta、tool activity、completion、cancellation、failure を区別し、単なる文字追記にしない。 input、output、state、side effect を一つの観測可能な経路にしてから、streaming を state machine として設計する の所有層を決めます。
02 / BUILD
3段階の実装
- 01
contract を定義
caller、data classification、success condition、timeout、cancel、ownership を先に記述します。最終 payload 一括受信より perceived latency と progressive feedback が重要な場合に使う。
- 02
狭い経路を構築
request correlation、typed state、reversible failure handling を持つ一つの end-to-end path だけを実装します。有用な stream は start、typed delta、tool activity、completion、cancellation、failure を区別し、単なる文字追記にしない。
- 03
outcome を証明
acceptance を再実行可能な fixture、contract test、browser test にします。browser test で abort、reconnect、slow consumer、malformed event、text と tool call の交差を確認する。
03 / BOUND
Production boundary
partial text は未確定で変更され得る。terminal event の validation 前に side effect や final record 保存を行わない。
04 / PROVE
Acceptance evidence
browser test で abort、reconnect、slow consumer、malformed event、text と tool call の交差を確認する。
SOURCE / HTTP
再現可能な source probe
curl -fsSI 'https://developers.openai.com/api/docs/guides/streaming-responses' | sed -n '1,5p'