OPENAI WORKFLOW · 06 / 10

Continue a conversation with previous_response_id

Connect a follow-up request to an earlier response without rebuilding the entire conversation yourself.

Documentation checked · Loomwell editorial guide · Examples have not been live API tested.

Steps

  1. Save the first response ID and pass it as previous_response_id in the next call.
  2. Set the instructions needed for each request explicitly. Chaining responses does not make prior context free: previous input tokens in the chain are still billed.

Example

Python · Python API examples require OPENAI_API_KEY and OPENAI_MODEL in your server environment. API calls may incur OpenAI charges.

import os
from openai import OpenAI

client = OpenAI()
model = os.environ["OPENAI_MODEL"]
first = client.responses.create(model=model, input="Suggest a name for a weather app.")
second = client.responses.create(
    model=model, previous_response_id=first.id,
    input="Explain that name in one sentence.",
)
print(second.output_text)

Check the result

The follow-up should refer to the earlier suggestion. Keep response IDs associated with the correct application user and session; plan retention and context limits before production use.

Official source

Conversation state

Check current provider documentation and model support before deployment. This guide is separate from the approved evidence records listed in the catalog.

Use Loomwell with your coding agent

Inspect the published record coverage before starting a trial or connecting MCP.