Codex
Agent session waiting on a cold sandbox? Pre-warm it while the user types
Create and set up an OpenAI-hosted sandbox via the Agents API while the user is still typing, then attach its environment_id to the session so the agent skips cold-boot setup. Unattached pre-warms expire in ~5 min.
What changed
OpenAI's Agents API now lets you create and prepare an OpenAI-hosted sandbox — install packages, load files, run setup commands — before you open an agent session. When the task arrives, attach the prepared environment_id so the user is not waiting on a cold-boot setup.
Kevin Whinnery (OpenAI developer experience) announced the pre-warming flow on Oct 12, 2026 (source). Official docs: https://developers.openai.com/api/docs/guides/agents-api/environments/prewarmed
Who is affected
Developers building on the Agents API where an end user types a request or picks a dataset before the agent needs a sandbox — for example a support agent or a data-analysis agent.
What to do now
- When the user starts interacting (typing in a field, choosing a dataset), create an environment with POST /v1/agents/environments, including the packages, files, and setup_commands your task needs.
- Wait until the environment status is ready (poll retrieve, or use agent.environment.ready / failed webhooks). You can also attach while setup is still running and wait on session environment.ready events.
- Create the session and pass that environment_id under environment.type openai_hosted.
- Pre-warm close to the task: unattached pre-warmed sandboxes expire after about 5 minutes. Pre-warming is free until you attach; after attach, standard container pricing applies. After a session uses it, idle expiry is about 20 minutes of inactivity.
What is not confirmed
Whether the Codex CLI desktop/interactive daemon uses this same Agents API pre-warm path. The docs cover Agents API hosted environments, not a CLI-side pre-warm switch.
Sources
- OfficialKevin Whinnery on Agents API sandbox pre-warming · Oct 12, 2026
Get updates like this every morning
- ① Email
- ② Card on Stripe
- ③ 7 days free
Then $2/month · cancel anytime in one click