One container per Codex session! Cloudflare becomes an execution environment for the OpenAI Agents API
Hey everyone, it's me! I found some news today where Cloudflare and OpenAI intersect, and it's got me really excited!
Cloudflare ChangelogWhat was announced?
According to the Cloudflare Changelog, Cloudflare Containers can now serve as an execution environment for OpenAI's Agents API. The Agents API lets applications access Codex through an OpenAI-managed API, where OpenAI handles session management, orchestration, context compaction, and recovery, while your application supplies the tools and can now use Cloudflare Containers as the place where the actual work runs.
To support this, Cloudflare also published an open-source reference implementation called the OpenAI Agents API Workers template.
Why it matters
The Agents API itself is a brand-new service that OpenAI also announced today (I've got a separate article on that one too!), and it's meant to be the foundation for running Codex sessions in the cloud. But you still need somewhere for that code to actually execute. This announcement is about Cloudflare Containers becoming an officially supported option for that execution layer. OpenAI mentions other ecosystem partners too, like E2B, Modal, and Vercel, but Cloudflare stands out by shipping a ready-to-use reference implementation built on its own edge infrastructure.
What changes
Developers building Codex-powered agent apps no longer need to design the execution environment from scratch — they can build on top of Cloudflare's template instead. The Worker handles the container lifecycle for each Codex session, so developers don't have to write their own logic for spinning up, reconnecting, and tearing down containers.
Dive Deep
The reference implementation's Worker does the following:
- Maintains a dedicated Cloudflare Container for each Codex session
- Keeps active work running
- Reconnects when it receives follow-up input
- Shuts down automatically when idle
Developers can customize this reference setup by extending the Container to provide controlled access to data and the network, or by integrating it with other Cloudflare products. For getting started, there's a tutorial called "Run Codex on Cloudflare using the OpenAI Agents API."
Wrap-up
- Cloudflare Containers are now available as a self-hosted execution environment for the OpenAI Agents API
- One dedicated container is maintained per Codex session, with automatic shutdown when idle
- An open-source OpenAI Agents API Workers template is available as a reference implementation
- You can customize it by extending the container or integrating with other Cloudflare products
If you're building Codex-powered agent apps and want to run them in the cloud, this is exactly the kind of option you've been waiting for!