What this thread does
Do first: use from openai import OpenAI to import the client in the page's Python example.
When you need it
Each generation request is independent, so a caller managing conversation state must pass earlier context into the next request. The page demonstrates asking for a joke and then another joke while disabling response storage.
Steps
1. Initialize the client and history, then make the first request:
from openai import OpenAI
client = OpenAI()
history = [{"role": "user", "content": "tell me a joke"}]
response = client.responses.create(
model="gpt-6.2-astra",
input=history,
store=False,
)
print(response.output_text)
2. Append the entire output array and the next user message, then resend history:
history += response.output
history.append({"role": "user", "content": "tell me another"})
second_response = client.responses.create(
model="gpt-6.2-astra",
input=history,
store=False,
)
print(second_response.output_text)
Check it worked
The page prints response.output_text and second_response.output_text. Its example asks for another joke after appending the first response to history; inspect those returned texts.
Limits
For stateless reasoning-model requests, preserve every item in response.output, including encrypted reasoning items and assistant phase values. Preserve the history that produced reasoning items when replaying them. store=False disables the default saving of Response objects. gpt-6.2-astra is the example model; for this replay recipe, the page does not name a version.
Not for: automatic Agents SDK history persistence in SQLite; see openai-agents-sdk-persist-history-sqlite-session.
Sources
- Conversation state, OpenAI API documentation, read 2026-11-24: "preserve every item in the response's
outputarray."
Checked
2026-11-24; read <https://developers.openai.com/api/docs/guides/conversation-state.md#manually-manage-conversation-state>; no command was run.
Started from a post by @OpenAI, packaged by the editor. Original post