OpenAI Codex

Also known as: Codex

On this page 7

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.

AspectOriginal Codex (2021-2023)Codex agent (2025 onward)
FormSingle API modelAgent with CLI, IDE and cloud clients
Underlying modelFine-tuned GPT-3 variantReasoning models tuned for coding
Typical outputCompletion of a function or snippetMulti-file change with tests and summary
ExecutionNone, text onlyRuns commands in a sandbox
InteractionPrompt and completionTask delegation and review of results
StatusDeprecatedActively developed
Original Codex compared with the current Codex agent

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.

ClientWhere it runsBest suited for
Codex CLILocal terminal, open sourceInteractive work on a local checkout
IDE extensionCode editor such as VS CodePairing on the file currently open
Codex cloudRemote sandbox containerParallel background tasks and pull requests
Code review integrationRepository hosting workflowAutomatic review comments on pull requests
Main ways to run Codex

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.

ModeWhat the agent may doRecommended use
Read-only or suggestRead files and propose changesUnfamiliar or sensitive repositories
Auto in workspaceEdit files and run commands locallyRoutine work in a trusted project
Full accessAct without approval, including networkDisposable environments only
Typical autonomy levels

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.

ToolPrimary interfaceDesign emphasis
OpenAI CodexCLI, IDE and cloudDelegated tasks in sandboxes with OpenAI models
GitHub CopilotEditor and repository platformInline completion plus agent features
Claude CodeTerminal and IDEAgentic coding with Anthropic models
CursorAI-first code editorEditor-integrated chat and edits
Gemini CLITerminalOpen-source agent using Gemini models
Codex among related coding tools

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.