Prompt Buddy logoPrompt Buddy

openai · OpenAI Platform Docs

WebSocket Mode

Implements a persistent WebSocket connection to the Responses API to manage long-running, multi-turn workflows involving frequent tool calls by sending incremental inputs and chaining response IDs.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

WebSocket Mode

Implements a persistent WebSocket connection to the Responses API to manage long-running, multi-turn workflows involving frequent tool calls by sending incremental inputs and chaining response IDs.

When To Use

Use when building agentic loops or orchestration workflows that require many model-tool round trips and need to minimize end-to-end latency through incremental state updates.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/websocket-mode-workflow-guide.mdA guide explaining how to use the WebSocket mode for the Responses API to manage long-running, tool-call-heavy workflows via persistent connections.Questions about a guide explaining how to use the WebSocket mode for the Responses API to manage long-running, tool-call-heavy workfl...
examples/websocket-mode-openai-websocket-mode-python-response-create.pythonA Python script demonstrating how to establish a WebSocket connection to the OpenAI API to send a response.create event.Exact payloads, commands, or snippets shown in A Python script demonstrating how to establish a WebSocket connection to the OpenAI API to send a response.create event.
examples/websocket-mode-openai-websocket-mode-python-response-create-2.pythonA Python code snippet demonstrating how to send a response.create message via a WebSocket connection to the OpenAI API.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to send a response.create message via a WebSocket connection to the OpenAI API.
examples/websocket-mode-openai-websocket-mode-python-compact-and-response-create.pythonA Python example demonstrating how to compact an existing HTTP response window and initiate a new response via a WebSocket connection.Exact payloads, commands, or snippets shown in A Python example demonstrating how to compact an existing HTTP response window and initiate a new response via a WebS...
examples/websocket-mode-openai-websocket-mode-error-response.jsonA JSON object demonstrating an error response structure for a missing previous response ID during a WebSocket session.Exact payloads, commands, or snippets shown in A JSON object demonstrating an error response structure for a missing previous response ID during a WebSocket session.
examples/websocket-mode-openai-websocket-mode-error-response-2.jsonA JSON object demonstrating a websocket connection limit error response from the OpenAI API.Exact payloads, commands, or snippets shown in A JSON object demonstrating a websocket connection limit error response from the OpenAI API.

What This Skill Covers

  • The Responses API supports a WebSocket mode for long-running, tool-call-heavy workflows. In this mode, you keep a persistent connection to /v1/responses and...
  • Main sections: Why use WebSocket mode, Connect and create responses, Continue with incremental inputs, How continuation works, Compaction and creating new responses.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.openai.com/api/docs/guides/websocket-mode.md