How OpenAI Is Speeding Up AI Agents with WebSockets

OpenAI has published a technical breakdown of how it optimized the Codex agent loop in the Responses API. The key change is a move to WebSockets combined with caching at the connection level. Traditional REST APIs require the client to resend context with every request, which badly slows autonomous agents. A persistent two-way WebSocket connection lets the model keep context in fast session memory, so megabytes of data no longer have to be sent again and again. Lower API overhead and shorter response latency matter a great deal for complex multistep AI systems that can write code and carry out tasks autonomously in real time.

AI-processed from OpenAI Blog; edited by Hamidun News
How OpenAI Is Speeding Up AI Agents with WebSockets
Source: OpenAI Blog. Collage: Hamidun News.
Listen to article

The era of slow AI models that pause for several seconds to produce an answer is gradually ending. The real bottleneck in the industry is no longer so much the raw computing power of the foundation models themselves as outdated data-transfer infrastructure. Autonomous agents that can write code on their own, analyze tangled databases and carry out complex multistep tasks need a fundamentally different speed of interaction with servers.

That is the problem OpenAI's latest update addresses: the company has rethought the architecture of its Responses API, adding support for the WebSockets protocol and caching at the level of a persistent connection. This deep technical change marks a major shift in how developers will build the next generation of autonomous software.

To grasp the scale of this infrastructure change, it helps to look at the anatomy of a typical agent workflow, in particular the so-called Codex agent loop. A conventional chatbot gets one specific question from a live user, who then patiently waits for one detailed answer. An autonomous AI agent instead works in a continuous, high-intensity loop.

It plans its next action, writes a piece of code, sends it for testing, receives an error message, instantly analyzes the cause and rewrites the code. Until now, this loop relied on traditional REST APIs. At every new step, however small, developers had to resend the language model the entire previous conversation context and the full history of actions taken.

As the task grew more complex, the volume of transmitted data grew geometrically, clogging network channels and forcing the model to waste valuable compute reprocessing the same information each time. This created enormous overhead and made serious AI agents too slow for real commercial use.

WebSockets change the core logic of how the application and the neural network interact. Instead of opening a new connection each time and resending the entire accumulated payload, WebSockets create a persistent, stable two-way channel between OpenAI's cloud server and the developer's local environment. Conceptually, it is like moving from exchanging long, heavy letters to a live, uninterrupted phone call. The channel stays open, and data can flow almost instantly in both directions. Still, a persistent connection alone would have solved only a small part of the latency problem had the company's engineers not added a second, far more powerful architectural change.

OpenAI's real engineering win is advanced caching directly at the level of the active connection. While the WebSocket is open, the language model physically keeps the entire context of the current working session in its ultra-fast memory. When the agent takes its next step in an endless loop of programming or deep data analysis, the cloud server needs to process only the new piece of information rather than reread the whole multi-page history from the start.

The company's published technical breakdown shows that this approach sharply reduces what is known as model generation latency. Large compute clusters are finally freed from the pointless routine of repeatedly re-ingesting hundreds of thousands of tokens, which naturally yields near-instant responses even in the most tangled and complex multistep scenarios.

It is hard to overstate the economic and technological consequences of this update for the entire IT industry. A dramatic cut in API overhead means not only a multiple-fold increase in raw speed but also a steep drop in the day-to-day cost of running AI agents for mid-sized and large businesses. Ambitious startups and large corporations trying to build full-fledged autonomous digital employees have long run into the harsh economic and technical impracticality of constantly calling heavy flagship models over classic internet protocols.

Today that invisible barrier has finally fallen. The technology community stands on the threshold of a wave of complex automation systems that can work in real time, reacting instantly to any change in source code or incoming data streams without the slightest delay for "thinking."

Ultimately, OpenAI's decisive move to WebSockets for its Responses API vividly illustrates a global transformation of the AI industry's landscape. Basic infrastructure that was originally designed solely for the unhurried imitation of human conversation is now rapidly adapting to the harsh demands of machine-to-machine interaction at extreme speeds. The tech world is finally leaving behind the era in which a human obediently waited for a neural network's reply and entering one in which autonomous agents talk to one another continuously at the speed of light, completing in seconds monumental work that once took hours of manual labor.

And it is infrastructure breakthroughs like this one, invisible to the average user, rather than a mere increase in parameter counts in yet another model generation, that turn this long-awaited transition into present-day reality.

Story
ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…