6. Manage Conversation State
Conversation state determines how follow-up turns receive prior context. The Responses API supports stored continuation with previous_response_id, and applications can also manage state themselves by resending relevant input history. This section compares both patterns, then shows encrypted reasoning context where supported.
6.1 Continue with previous_response_id
Use previous_response_id to continue from a stored response without resending the full prior prompt. The first request stores the BrightCart case details; the second request passes only the new follow-up instruction plus the previous response ID. Inspect whether the follow-up preserves the order, customer, issue, and next action.
python
from __future__ import annotations
promised_delivery = (date.today() + timedelta(days=2)).isoformat()
stateful_seed_input = (
f"Customer Maya Chen opened ticket TICKET-4812 about order ORDER-8831. "
"The item is a standing desk replacement for a damaged delivery. "
f"The promised delivery date is {promised_delivery}, but the carrier scan has not moved in 36 hours. "
"Customer sentiment is frustrated because this is the second attempt. "
"Support policy says to offer expedited replacement or a 15% concession if the delay exceeds 48 hours. "
"Escalation owner is Tier 2 Returns."
)
stateful_followup_input = "Return five labeled lines: ticket ID, order ID, customer name, issue, and next best action."
stateful_request_shape = {
"model": MODEL_ID,
"input": stateful_followup_input,