Key Changes
WebSocket Mode for OpenAI Responses API
This version adds WebSocket mode support for OpenAI's Responses API. This is a new opt-in feature, so the default behavior is unchanged. If you want to switch all Responses API calls to WebSocket mode, call setOpenAIResponsesTransport('websocket') to enable it for all OpenAI Responses model agents.
You can also use withResponsesWebSocketSession o enable a reusable WebSocket connection, as shown below:
import { Agent, withResponsesWebSocketSession } from '@openai/agents';
const agent = new Agent({
name: 'Assistant',
instructions: 'You are a helpful assistant.',
model: 'gpt-5.2-codex',
});
await withResponsesWebSocketSession(async ({ run }) => {
const streamed = await run(agent, 'Say hello in one sentence.', {
stream: true,
});
for await (const _event of streamed.toStream()) {
// Drain the stream.
}
console.log(streamed.finalOutput);
});References:
What's Changed
Documents & Other Changes
- docs: add missing changes by @seratch in #1002
- docs: update translated document pages by @github-actions[bot] in #1003
- chore: change #1004 to minor version changes by @seratch in #1007
- chore: update versions by @github-actions[bot] in #1006
Full Changelog: v0.4.15...v0.5.0