OpenAI shut down the Assistants API on 26 August 2026. Any code still calling client.beta.assistants, beta.threads or beta.threads.runs is now failing. To migrate, move assistant configuration into your own code, replace threads with Conversations, and replace run polling with single Responses API calls. OpenAI's own migration guide suggests turning assistants into dashboard "prompt" objects. Don't: /v1/prompts is itself scheduled to shut down on 30 November 2026.
The guide is written for teams finishing the move now. Code was checked against the current OpenAI docs and the openai Python SDK 3.52.0 (released 16 November 2026).
The dates that matter
| Date | What happens | Source |
|---|---|---|
| 26 Aug 2026 | Assistants API sunset; no longer available | Deprecations |
| 30 Nov 2026 | /v1/prompts and reusable prompt objects shut down |
Deprecations, migrate from prompt objects |
| 30 Nov 2026 | Evals dashboard, API and graders for eval workflows become read-only | Deprecations |
| 14 Jan 2027 | gpt-4o-2024-08-06, gpt-4o-2024-11-20, gpt-4.1-2025-04-14 and their mini variants shut down |
Deprecations |
The last row matters if your assistants were pinned to a GPT-4o or GPT-4.1 snapshot. Those snapshots are also going away, and OpenAI lists gpt-6-luna as the replacement. Migrating API surface and model at the same time is tempting. Do it in two steps, so that when behaviour changes you know which change caused it.
The OpenAI migration guide maps Assistants to Prompts. The prompts deprecation notice says to "move prompt content into your application code" instead. That is what this guide does. If you already created dashboard prompts during an earlier migration attempt, you have until 30 November to inline them.
Concept mapping
| Assistants API | Responses API equivalent | Notes |
|---|---|---|
Assistant (asst_...) |
Constants in your code: model, instructions, tools, text.format |
Versioned in git, reviewed in PRs |
Thread (thread_...) |
Conversation (conv_...) |
Stores items of any type, not just messages |
| Message | Message item (input_text / output_text content) |
|
| Run + polling loop | One responses.create call |
Use background=True for long jobs |
| Run step | Output items: reasoning, function_call, file_search_call, code_interpreter_call, message |
Iterate response.output by type |
requires_action + submit_tool_outputs |
function_call item, then send a function_call_output item with the same call_id |
Your code owns the tool loop |
tool_resources.file_search.vector_store_ids |
{"type": "file_search", "vector_store_ids": [...]} on the tool |
Vector stores are a top-level API |
tool_resources.code_interpreter.file_ids |
{"type": "code_interpreter", "container": {"type": "auto", "file_ids": [...]}} |
Containers expire after 20 idle minutes |
response_format |
text={"format": {...}} |
Or responses.parse(text_format=...) |
truncation_strategy |
truncation="auto" or "disabled", plus compaction |
|
additional_instructions |
instructions on each request |
Not inherited from earlier turns |
Streaming thread.message.delta |
response.output_text.delta |
Typed semantic events |
Step 1: turn the assistant object into code
Before, configuration lived on a server-side object:
assistant = client.beta.assistants.create(
model="gpt-4o",
name="Support agent",
instructions="You are Acme's support agent. Answer from the knowledge base.",
tools=[{"type": "file_search"}, {"type": "function", "function": ORDER_FN}],
tool_resources={"file_search": {"vector_store_ids": ["vs_123"]}},
)
After, the same configuration is plain data in your repository. Note that function tools are now internally tagged. name, description and parameters sit at the top level of the tool, not under a function key, as described in the Responses migration guide:
import json
import os
from openai import OpenAI
client = OpenAI()
MODEL = os.environ.get("OPENAI_MODEL", "gpt-6-astra")
# Everything that used to live on the Assistant object, now in version control.
INSTRUCTIONS = (
"You are Acme's support agent. Answer from the knowledge base. "
"If the answer is not there, say so."
)
TOOLS = [
{"type": "file_search", "vector_store_ids": [os.environ["VECTOR_STORE_ID"]]},
{
"type": "function",
"name": "get_order_status",
"description": "Look up the shipping status of an order.",
"strict": True,
"parameters": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"],
"additionalProperties": False,
},
},
]
A gotcha with strict mode: in Chat Completions and Assistants, functions were non-strict unless you said otherwise. In Responses, omitting strict attempts strict mode, and falls back to non-strict if your schema can't be made compatible. Set strict explicitly so the behaviour is predictable.
Step 2: threads become conversations
# Before
thread = client.beta.threads.create(metadata={"user_id": "u_42"})
# After
conversation = client.conversations.create(metadata={"user_id": "u_42"})
Store conversation.id where you used to store thread.id, usually in a session or chat table. Per the conversation state guide, conversation objects and their items are not subject to the 30-day TTL that applies to stored responses.
Step 3: runs become responses (with your own tool loop)
The old pattern created a message, started a run, polled it, handled requires_action, submitted tool outputs and polled again:
client.beta.threads.messages.create(thread_id=thread_id, role="user", content=text)
run = client.beta.threads.runs.create_and_poll(thread_id=thread_id, assistant_id=assistant_id)
if run.status == "requires_action":
outputs = [
{"tool_call_id": tc.id, "output": json.dumps(dispatch(tc.function.name, tc.function.arguments))}
for tc in run.required_action.submit_tool_outputs.tool_calls
]
run = client.beta.threads.runs.submit_tool_outputs_and_poll(
thread_id=thread_id, run_id=run.id, tool_outputs=outputs
)
messages = client.beta.threads.messages.list(thread_id=thread_id, order="desc", limit=1)
With Responses, each call returns output items directly. When the model wants a function, you get function_call items. You run the function and send back function_call_output items with the matching call_id:
def get_order_status(order_id: str) -> dict:
return {"order_id": order_id, "status": "shipped"} # your real lookup here
FUNCTIONS = {"get_order_status": get_order_status}
def handle_message(conversation_id: str, user_text: str, max_tool_rounds: int = 5) -> str:
request = dict(model=MODEL, instructions=INSTRUCTIONS, tools=TOOLS,
conversation=conversation_id)
response = client.responses.create(
input=[{"role": "user", "content": user_text}], **request
)
for _ in range(max_tool_rounds):
calls = [item for item in response.output if item.type == "function_call"]
if not calls:
return response.output_text
outputs = []
for call in calls:
result = FUNCTIONS[call.name](**json.loads(call.arguments))
outputs.append({
"type": "function_call_output",
"call_id": call.call_id,
"output": json.dumps(result),
})
# The function_call items are already in the conversation;
# send only the outputs.
response = client.responses.create(input=outputs, **request)
raise RuntimeError("Too many tool rounds")
Why send only the outputs? The SDK's own parameter docs say that, when you pass conversation, the conversation's items are prepended to your input, and the response's input and output items are added back to the conversation after it completes. The function_call items from the first call are therefore already stored. Hosted tools such as file_search and code_interpreter run inside a single responses.create call and don't need this loop.
I exercised these functions against a mocked HTTP transport to confirm the SDK accepts these shapes and serializes them as shown. They have not been run against the live API.
Three things about this loop catch people out:
instructionsis per request. Send it every time. The Responses migration guide notes that withprevious_response_id, the previous response'sinstructionsare not carried over. Treat it the same way with conversations.- There is no
run.statusto poll. A normal call blocks until it finishes. For long reasoning jobs, use background mode (background=True), then pollclient.responses.retrieve(resp.id)while the status isqueuedorin_progress. That is the closest equivalent to the old run lifecycle. - Cap the loop. You now own the orchestration, so nothing else stops a model that keeps requesting tools. Add a counter like
max_tool_rounds.
Conversation vs previous_response_id
Responses gives you three ways to carry state between turns. Pick one per flow.
| Approach | How | Use when |
|---|---|---|
conversation=conv_id |
Durable conversation object | Closest to threads; multi-device or long-lived chats |
previous_response_id=resp.id |
Chain responses | Short chains, forking from an earlier turn |
| Manual | Append response.output items to your own list |
store=False, Zero Data Retention, full control over trimming |
You can't use conversation and previous_response_id in the same request. The SDK documents that previous_response_id "cannot be used in conjunction with conversation". Either way, all previous input tokens in the chain are billed as input tokens on each turn. Stateful APIs don't make history free. Keep the static parts of each request (instructions, tool definitions) identical and first, so prompt caching can do its job.
Migrating existing thread history
This is the bad news. The migration guide states that the Assistants API call that retrieves thread messages no longer works. Since the sunset, threads.messages.list cannot be used to export history. OpenAI's guide says to rebuild conversations from messages your application has already stored. If you never stored transcripts yourself, those threads can no longer be exported through the API.
If you do have your own copy, convert it into conversation items. User text becomes input_text and assistant text becomes output_text, following the mapping in OpenAI's guide. One limit the guide's example skips: the SDK documents that conversations.create and conversations.items.create accept up to 20 items per call, so long histories have to be chunked:
def to_items(rows: list[dict]) -> list[dict]:
"""rows: your stored messages, oldest first: {"role": "user"|"assistant", "text": str}"""
items = []
for row in rows:
part_type = "input_text" if row["role"] == "user" else "output_text"
items.append({
"type": "message",
"role": row["role"],
"content": [{"type": part_type, "text": row["text"]}],
})
return items
def import_history(rows: list[dict], metadata: dict) -> str:
items = to_items(rows)
conversation = client.conversations.create(items=items[:20], metadata=metadata)
for start in range(20, len(items), 20): # API accepts up to 20 items per call
client.conversations.items.create(conversation.id, items=items[start:start + 20])
return conversation.id
Put the old thread ID in metadata (for example {"legacy_thread_id": "thread_..."}) so support staff can trace a conversation back to it. Only migrate conversations users will actually return to. For most products that means recent ones. Tool-call history from old runs can't be faithfully replayed, so import the text turns and accept that tool context starts fresh.
file_search and vector stores
Vector stores are now a top-level API (client.vector_stores), and the file search guide attaches them directly to the tool:
response = client.responses.create(
model=MODEL,
input="What is our refund window?",
tools=[{
"type": "file_search",
"vector_store_ids": [os.environ["VECTOR_STORE_ID"]],
"max_num_results": 4,
}],
include=["file_search_call.results"], # raw chunks are not returned by default
)
OpenAI's Assistants migration guide doesn't say whether vector stores created through the Assistants workflow carry over. Run client.vector_stores.list() before assuming your existing IDs still work, and keep your source files so you can re-index if needed. File citations arrive as file_citation annotations on the output text. The file_search_call output item records the queries the model ran. The guide also documents metadata filters on the tool, which is useful if you previously kept one assistant per customer just to separate their documents.
Code interpreter and containers
Code interpreter now runs in a container. With {"type": "auto"} the container is created for you, and you can pass file_ids and a memory_limit (1g default, 4g, 16g or 64g), per the code interpreter guide:
resp = client.responses.create(
model=MODEL,
tools=[{"type": "code_interpreter",
"container": {"type": "auto", "file_ids": ["file-abc123"]}}],
input="Use the python tool to chart monthly signups from the CSV.",
)
The big behavioural difference: a container expires after 20 minutes of inactivity. Its data is discarded and can't be recovered. Generated files come back as container_file_citation annotations. Download them promptly and store them yourself.
Streaming differences
Assistants streams emitted thread and run events such as thread.message.delta and thread.run.requires_action. Responses streams use typed semantic events. Branch on event.type:
stream = client.responses.create(
model=MODEL,
instructions=INSTRUCTIONS,
input=[{"role": "user", "content": "Summarise my last order"}],
conversation=conversation_id,
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
elif event.type == "response.function_call_arguments.done":
pass # a complete function call is ready; run it after the stream ends
elif event.type == "response.completed":
final = event.response
elif event.type == "error":
raise RuntimeError(event.message)
The streaming guide lists the full event set, including file search and code interpreter progress events. If a client may drop mid-stream, combine background=True with stream=True. You can then resume from the last sequence_number, as described in the background mode guide.
Gotchas checklist
- Prompt objects: don't migrate onto dashboard prompts. They shut down on 30 November 2026.
- Structured output:
response_formatbecomestext.format. Responses have nochoices. Readresponse.output_text, or iterateresponse.output. - Mixed item types: not every output item is a message. Reasoning and tool items sit alongside messages, so filter by
type. - Billing:
previous_response_idandconversationdon't make prior tokens free. - Retention: responses are stored for 30 days by default. Set
store=Falseif you manage state yourself, and replay reasoning items when you do. - Model change: if your assistant used a GPT-4o or GPT-4.1 snapshot, those shut down on 14 January 2027. Re-run your evals when you switch models. Our DeepEval vs Promptfoo post covers tooling, and OpenAI now points former Evals users to Promptfoo.
- MCP: if you bolted MCP onto Assistants through function proxies, Responses supports remote MCP servers as a native tool. See MCP vs REST API for the trade-offs.
When reviewing the migration PR, a side-by-side code difference checker makes it easy to confirm that each assistant's instructions were copied over verbatim.
Frequently Asked Questions
Is the OpenAI Assistants API still available?
No. OpenAI's migration guide states that it was sunset on 26 August 2026 and is no longer available. The beta.assistants and beta.threads methods still exist in the Python SDK, marked deprecated, but the endpoints behind them have been shut down. New code should use the Responses and Conversations APIs.
Can I still export my old threads?
Not through the API. OpenAI's guide says the call that retrieves thread messages no longer works, and that you should use messages your application already stored. If you kept your own transcripts, convert them into conversation items, in batches of up to 20 per call.
Should I convert my assistants into dashboard prompts?
No. Reusable prompt objects and /v1/prompts are scheduled to shut down on 30 November 2026. OpenAI's prompt-object migration guide recommends moving prompt content into application code and passing it as instructions/input. That also gives you git history, code review and tests.
Should I use conversation or previous_response_id?
Use conversation if you need a durable, thread-like object that persists across sessions and devices. That is the closest match to threads. Use previous_response_id for short chains or for forking from an earlier turn. You can't combine the two in one request, and both bill all prior input tokens.
Do I need to rebuild my vector stores?
Not necessarily. Vector stores have their own API and plug into the file_search tool through vector_store_ids. OpenAI's Assistants migration guide doesn't address whether stores created under Assistants carry over, so list them with client.vector_stores.list() and test retrieval before relying on old IDs.
Conclusion
The Assistants-to-Responses migration involves more than renaming methods. State moves into conversations, orchestration moves into your code, and configuration moves into your repository. That last part matters more now that prompt objects are being retired too. Migrate the API first and keep the model fixed. Rebuild history only from transcripts you own. Then switch off GPT-4o or GPT-4.1 snapshots before January 2027, with evals in place to catch regressions.