OpenAI Codex is the name OpenAI uses for its code-focused AI models and coding agent, first for a 2021 model that translated natural language into source code and later for an autonomous software engineering agent that works inside repositories. Among AI models & assistants in artificial intelligence, Codex marks the shift from code completion to agentic coding, where the system plans, edits, runs tests and proposes changes.
Because the same name covers two generations of technology, precise usage matters. The original Codex model was a single model available through an API, while the current Codex product is a family of clients, including a terminal tool, editor extensions and a cloud service, driven by reasoning models tuned for software engineering.
Two generations of OpenAI Codex
The first Codex was a GPT-3 descendant fine-tuned on public source code, introduced in 2021 together with the HumanEval benchmark. It powered the first version of GitHub Copilot and was offered through the OpenAI API until those models were deprecated in 2023, when general chat models had absorbed its coding ability.
In 2025 OpenAI revived the name for an agentic coding system. Codex now refers to the open-source Codex CLI, editor integrations and a cloud agent that runs tasks in isolated sandbox environments, powered by models such as codex-1 and later GPT-5-Codex variants. The table summarizes the differences.
| Aspect | Original Codex (2021-2023) | Codex agent (2025 onward) |
|---|---|---|
| Form | Single API model | Agent with CLI, IDE and cloud clients |
| Underlying model | Fine-tuned GPT-3 variant | Reasoning models tuned for coding |
| Typical output | Completion of a function or snippet | Multi-file change with tests and summary |
| Execution | None, text only | Runs commands in a sandbox |
| Interaction | Prompt and completion | Task delegation and review of results |
| Status | Deprecated | Actively developed |
How the Codex agent completes a task
The Codex agent works in an agent loop: it reads the task, inspects the repository, edits files, runs commands such as tests or linters, observes the output and repeats until it judges the task complete. The result is presented as a diff or pull request with a log of the commands it executed, so a developer can verify each step.
Repository conventions are supplied through an AGENTS.md instruction file, which tells the agent how to build the project, which tests to run and which style rules to follow. Well-written instructions are one of the strongest levers on output quality, because the agent cannot guess undocumented build steps.
| Client | Where it runs | Best suited for |
|---|---|---|
| Codex CLI | Local terminal, open source | Interactive work on a local checkout |
| IDE extension | Code editor such as VS Code | Pairing on the file currently open |
| Codex cloud | Remote sandbox container | Parallel background tasks and pull requests |
| Code review integration | Repository hosting workflow | Automatic review comments on pull requests |
Safety controls and approval modes
Because an agent that executes commands can damage data or leak secrets, Codex relies on sandboxing and approval policies. Local sessions restrict file writes to the working directory and can block network access, while cloud tasks run in containers with network access disabled by default during execution.
Developers choose how much autonomy to grant. The trade-off is direct: more autonomy means faster work but larger blast radius when the agent makes a wrong decision.
| Mode | What the agent may do | Recommended use |
|---|---|---|
| Read-only or suggest | Read files and propose changes | Unfamiliar or sensitive repositories |
| Auto in workspace | Edit files and run commands locally | Routine work in a trusted project |
| Full access | Act without approval, including network | Disposable environments only |
A sound practice is to review every diff before merging, keep credentials out of the sandbox and treat repository content, issue text and web pages as untrusted input that may contain prompt injection.
How Codex compares with other coding assistants
Codex belongs to a crowded field of AI coding agents, and the products differ mainly in where they run, how they are licensed and how much they act on their own. Capabilities change quickly, so comparisons describe design emphasis rather than fixed rankings.
| Tool | Primary interface | Design emphasis |
|---|---|---|
| OpenAI Codex | CLI, IDE and cloud | Delegated tasks in sandboxes with OpenAI models |
| GitHub Copilot | Editor and repository platform | Inline completion plus agent features |
| Claude Code | Terminal and IDE | Agentic coding with Anthropic models |
| Cursor | AI-first code editor | Editor-integrated chat and edits |
| Gemini CLI | Terminal | Open-source agent using Gemini models |
Strengths, limitations and common misconceptions
Codex performs best on well-scoped tasks with verifiable outcomes: fixing a failing test, adding a small feature, writing tests or refactoring a module with good coverage. Its reliability falls on vague requirements, large architectural changes and code that cannot be run or tested in the sandbox.
- Passing tests is not proof of correctness: the agent may satisfy weak tests while missing the real requirement.
- Benchmark scores do not transfer directly: results on suites such as SWE-bench measure curated issues, not a specific codebase.
- The 2021 Codex model and the current agent are different systems; older articles about Codex usually describe the deprecated model.
- Context limits still apply: very large repositories require the agent to search selectively, which can miss relevant code.
- Human accountability remains: the developer who merges the change owns its security and licensing consequences.
A plain-language summary
OpenAI Codex is a coding assistant that can do programming work on its own. A developer describes a task in normal words, such as fixing a bug. Codex reads the project, changes the code, runs the tests and reports what it did.
Think of it as a capable junior colleague who works in a locked practice room. It can try things safely there, but a person still checks the work before it becomes part of the real product. The name once meant an older model that only suggested code, so older descriptions can be misleading.
An example from practice
A five-person team maintaining a web application has a backlog of small issues: flaky tests, outdated dependencies and missing input validation. Each morning, a developer delegates six to eight well-defined issues to Codex cloud, each with a link to the failing test and a note on expected behavior. The repository includes an AGENTS.md file listing the build command, the test command and the code style rules.
Within an hour, Codex returns proposed pull requests with diffs and test logs. The developers review them in the same way as human contributions. Roughly half merge with minor edits, some need rework, and a few are rejected because the task was ambiguous. The outcome is that the team clears routine issues faster and spends more of its time on design work, while every change still passes human review.