Integration pattern

Stream useful progress, not raw agent internals.

Your UI should show task progress, save recovery identifiers, and tolerate new stream event types without breaking.

Behavior

  • Create the user-visible task immediately after submission.
  • Save response and session identifiers from response.created.
  • Append response.output_text.delta to visible answer text.
  • Use tool and item events as sanitized activity status, not raw logs.
  • Ignore unknown data.type values instead of failing the stream.

Recovery

If the stream disconnects after response.created, poll the saved session until terminal and recover answer text from turns plus files from the latest file list.