Core concept

A response is one turn inside a session.

Save the response ID and session ID from the stream. Your product needs both to recover, continue, cancel, and fetch artifacts.

Identifiers

response.id
The runtime response identifier. Use it for continuation as previous_response_id.
response.metadata.session_id
The persistent session identifier. Use it for polling, turns, files, cancel, and archive.

Terminal states

Streaming uses events such as response.completed, response.incomplete, and response.failed. Session polling reports a successful turn as status: "done", not completed.