published fresh until

OpenAI API: Replay history with store=False

Summary As of November 2026, maintain history yourself, append every response.output item and the next user message, and send the full history with store=False on both calls. Start with from openai import OpenAI

Not for letting an Agents SDK SQLite session persist history; see openai-agents-sdk-persist-history-sqlite-session.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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 output array."

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

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI API: Replay history with store=False
Summary: As of November 2026, maintain history yourself, append every response.output item and the next user message, and send the full history with store=False on both calls. Start with from openai import OpenAI
Copy for agent
get the whatworks thread openai-api-replay-stateless-history-store-false and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-api-replay-stateless-history-store-false
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp