OpenAI Codex
OpenAI’s coding agent: an open-source CLI, written in Rust, that works in your local repository inside an OS sandbox, plus an IDE extension and Codex cloud for tasks that run on OpenAI’s machines.
- What it is
- AI coding agents (terminal agents)
- Type
- Commercial product
- Made by
- OpenAI
- License
- Apache 2.0 (CLI)
- Facts checked
- 9 October 2026
What it is
Codex CLI is a single native binary (codex) that you run in a project directory and sign into with a ChatGPT plan or an API key. It reads files, edits them and runs commands in a loop, and two settings bound what it does. The sandbox mode (read-only, workspace-write or danger-full-access) is enforced by the operating system: Seatbelt via sandbox-exec on macOS, bubblewrap plus seccomp on Linux. The approval policy decides when it stops to ask. In version-controlled folders it starts in the Auto preset, which edits and runs commands in the workspace freely but asks before writing outside it or using the network; network access is off by default and .git stays read-only even inside the workspace.
Before any work it reads AGENTS.md files: a global one in ~/.codex, then one per directory from the repository root down to where you started, concatenated so the closest file comes last, up to 32 KiB by default. codex exec runs one task non-interactively for scripts and CI, codex mcp adds MCP servers, and codex review reviews a diff without touching the working tree.
The same agent runs elsewhere. The IDE extension works in VS Code, Cursor and Windsurf, with separate integrations for JetBrains IDEs and Xcode. Codex cloud runs each task in its own workspace in an OpenAI-hosted environment built from your GitHub repositories, keeps working while your computer sleeps, and ends with a diff you can turn into a pull request; codex cloud submits and applies those tasks from the terminal. The name is older than the agent: in 2021 “OpenAI Codex” was the model behind GitHub Copilot’s first preview.
Why teams pick it
- The CLI is open source under Apache 2.0 and ships as a native Rust binary, with no Node.js runtime to install
- Sandboxed by default, with the OS enforcing workspace-only writes and no network unless you allow it
- One agent across terminal, IDE, cloud tasks and GitHub code review
AGENTS.md, which OpenAI introduced, is now a vendor-neutral format read by many other agents
Watch out for
- Built around OpenAI models and accounts; OpenAI recommends signing in with a ChatGPT plan
- The Linux sandbox can fail inside Docker when the container blocks namespaces, setuid
bwrapor seccomp; the docs suggest a Dev Container as the outer boundary instead - Codex cloud needs an environment that mirrors yours (repositories, setup, secrets, network rules) and works from GitHub repositories
- Easy to confuse with the 2021 Codex model of the same name, and with the separate Codex Security product
Alternatives
What all terminal agents have in common →
Gemini CLICommercialGoogle’s open-source terminal agent for Gemini models; since 18 June 2026 it serves only paid API keys and business licences, as Google moved free and consumer users to Antigravity CLI.How it fits with other technologies
What OpenAI Codex uses
What uses OpenAI Codex
Choose the sandbox, then run interactively or from a script · bash
curl -fsSL https://chatgpt.com/codex/install.sh | sh # or: npm install -g @openai/codex
codex # interactive, Auto preset in a git repo
codex --sandbox read-only --ask-for-approval on-request # look, don’t touch
# one task, no session: for scripts and CI
codex exec "run the tests and fix the first failure"
codex cloud # browse Codex cloud tasks, apply results locallySee it in a real stack
No architecture uses OpenAI Codex yet. Drop it into the playground and wire it up yourself.Open playground →Where it came from2021–2025
OpenAI launched Codex CLI in April 2025 as a lightweight, open-source coding agent for the terminal, running models such as o3 and o4-mini. A month later, on 16 May 2025, it announced Codex, a cloud agent in research preview: each task ran in its own cloud sandbox preloaded with the repository, typically took 1 to 30 minutes, ran with internet access disabled, and could be guided by AGENTS.md files in the repository. It was powered by codex-1, a version of o3 tuned for software engineering.
The first CLI was written in TypeScript. On 30 May 2025 OpenAI announced it was rewriting it in Rust, describing the core of the project as “an agentic harness, aka calling the model in a loop”, and naming the reasons: a zero-dependency install instead of requiring Node.js 22, native security bindings (it already shipped Rust for Linux sandboxing) and performance. In September 2025 GPT-5-Codex arrived along with an IDE extension for VS Code and its forks, a rebuilt CLI and three simple approval levels. AGENTS.md, released by OpenAI in August 2025, moved to the Linux Foundation’s Agentic AI Foundation that December.
Why it’s built this way
- Open-source the CLI
- The terminal agent runs on developers’ machines with their files and credentials. Publishing it under Apache 2.0 let users inspect what it does and contribute; OpenAI credited community feedback for the September 2025 rebuild.
- Rewrite in Rust
- Requiring Node.js 22 was a blocker for some users, and the Linux sandbox was already Rust. A native binary removed the runtime and the garbage collector from the loop.
- Sandbox first, ask second
- The cloud agent started with internet access off during tasks, and the CLI enforces workspace-only writes at the OS level, so approvals are needed only for leaving the sandbox rather than for every command.
- Instructions in a plain Markdown file
AGENTS.mdgives agents build, test and style instructions without cluttering the README, under a name that isn’t tied to one vendor.
Timeline
- 2021
The original Codex model powers GitHub Copilot’s technical preview
- 2025
Codex CLI launches as an open-source terminal agent (April)
- 2025
Codex cloud research preview, powered by codex-1 (May)
- 2025
Rust rewrite of the CLI announced (May)
- 2025
GPT-5-Codex, the IDE extension and a rebuilt CLI (September)
- 2025
AGENTS.mdmoves to the Agentic AI Foundation (December)
- GitHub blog: Introducing GitHub Copilot, powered by OpenAI Codex (June 2021)
- OpenAI: Introducing Codex (May 2025) · archived copy, original
- openai/codex discussion #1174: Codex CLI is going native (May 2025)
- OpenAI: Introducing upgrades to Codex (Sept 2025) · archived copy, original
- Linux Foundation: Formation of the Agentic AI Foundation (AGENTS.md released by OpenAI in August 2025; Dec 2025)
- AGENTS.md
Sources7 · facts checked 9 October 2026
- openai/codex README (install, sign in with ChatGPT, Apache 2.0)
- Codex docs: Codex CLI (`codex exec`, `codex cloud`, `codex mcp`)
- Codex docs: Agent approvals and security (sandbox modes, approval policies, Seatbelt, bwrap and seccomp, Docker caveat)
- Codex docs: Custom instructions with AGENTS.md
- Codex docs: Codex IDE extension
- Codex docs: Codex Cloud
- OpenAI: Introducing upgrades to Codex (Sept 2025) · archived copy, original