Skip to content

feat: support OpenAI response continuation - #1941

Draft
arnabnandy7 wants to merge 1 commit into
embabel:mainfrom
arnabnandy7:feature/openai-response-continuation
Draft

arnabnandy7 wants to merge 1 commit into
embabel:mainfrom
arnabnandy7:feature/openai-response-continuation

Conversation

@arnabnandy7

@arnabnandy7 arnabnandy7 commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add OpenAI Responses API conversation continuation support using previous_response_id.

Changes

  • Forward previous_response_id from OpenAiChatOptions.extraBody.
  • Add OpenAiResponsesOptions.PREVIOUS_RESPONSE_ID as the supported option key.
  • Expose the returned OpenAI response ID through ChatResponseMetadata.id.
  • Document how to persist and reuse response IDs.
  • Clarify that callers should send only new input when continuing a stored conversation.
  • Add unit coverage for request and response ID mapping.

Example

val firstResponse = model.call(Prompt("Tell me a short story"))

val nextOptions = OpenAiChatOptions.builder()
    .model("gpt-5-pro")
    .extraBody(
        mapOf(
            OpenAiResponsesOptions.PREVIOUS_RESPONSE_ID to firstResponse.metadata.id
        )
    )
    .build()

val nextResponse = model.call(
    Prompt(
        listOf(UserMessage("Give it a happier ending")),
        nextOptions,
    )
)

Scope

This change supports server-side conversation continuation for models routed through the Responses API. It does not enable server-side tool execution. Embabel continues to own the tool loop.

Testing

./mvnw -pl embabel-agent-autoconfigure/models/embabel-agent-openai-autoconfigure `
  -Dtest=OpenAiResponsesChatModelTest test

Closes #1610.

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@igordayen igordayen added this to the 2.0.0-Release🔵 milestone Aug 16, 2026
@arnabnandy7
arnabnandy7 marked this pull request as draft August 16, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: OpenAI responses API support

2 participants