OpenAI Codex: From Code Model to AI Agent Ecosystem
π§ Context
This document captures research on OpenAI Codex as part of a broader study of popular AI code agents. The goal is to understand how production AI agents are designed and evolved β lessons to inform building a custom AI code agent.
Study path: Aider (articles, completed) β Codex (this document) β more agents to follow.
π Naming: What βCodexβ Actually Means
βCodexβ is an overloaded name at OpenAI. It has referred to three distinct things over time:
| Name | What It Is | Status |
|---|---|---|
| Codex (2021 model) | Fine-tuned GPT-3 for code, trained on 159GB of Python from 54M GitHub repos | β Deprecated (Mar 2023) |
| codex-1 (2025 model) | o3 variant optimized for software engineering | β Active (succeeded by GPT-5.x-Codex) |
| Codex (2025+ agent) | Full AI code agent platform β CLI, Cloud, App, IDE extension | β Active |
When people say βCodexβ today, they almost always mean the agent platform, not the original 2021 model.
π Development History
The evolution of Codex tells the story of AI moving from autocomplete β agent β platform:
Era 1: The Model (2021β2023)
| Date | Event |
|---|---|
| Aug 2021 | Codex model launched β fine-tuned GPT-3, API private beta |
| 2021β2022 | Powers GitHub Copilot β inline code completion era |
| Mar 2023 | Codex model deprecated β Copilot moves to GPT-4, name goes dormant |
Era 2: The Agent is Born (2025)
| Date | Event |
|---|---|
| Apr 16, 2025 | Codex CLI open-sourced β TypeScript/Node terminal agent |
| May 16, 2025 | Codex Cloud launched β research preview, powered by codex-1 (o3-based) |
| Jun 3, 2025 | Codex Cloud available to ChatGPT Plus users |
| Jun 2025 | Rust rewrite of CLI begins, beta released |
| Aug 28, 2025 | IDE extension launched β VS Code, Cursor, Windsurf |
| Sep 2025 | GPT-5-Codex model available via API |
Era 3: Full Platform (Late 2025β2026)
| Date | Event |
|---|---|
| Dec 2025 | GPT-5.2 released (400K context window) |
| Jan 14, 2026 | GPT-5.2-Codex β optimized for agentic workflows |
| Feb 5, 2026 | Desktop app launched (macOS) + GPT-5.3-Codex |
| Feb 12, 2026 | GPT-5.3-Codex-Spark β low-latency variant |
| Mar 4, 2026 | Desktop app on Windows |
| Mar 5, 2026 | GPT-5.4 β flagship model with computer use |
| Mar 2026 | Codex Security β dedicated vulnerability-finding agent |
| Apr 2026 | CLI is 95.6% Rust. Full suite: App, CLI, IDE, Cloud |
timeline
title Codex Evolution
section Model Era
Aug 2021 : Codex model (GPT-3 fine-tune)
2021-2022 : Powers GitHub Copilot
Mar 2023 : Model deprecated
section Agent Era
Apr 2025 : CLI open-sourced (TypeScript)
May 2025 : Cloud agent + codex-1 model
Jun 2025 : Rust rewrite begins
Aug 2025 : IDE extension
section Platform Era
Feb 2026 : Desktop app + GPT-5.3-Codex
Mar 2026 : GPT-5.4 + Security agent
Apr 2026 : Full suite mature
The Big Picture
2021 Completion β predict the next token
2023 Conversation β understand and respond to instructions
2025 Agency β plan, use tools, execute autonomously
2026 Platform β multi-model, multi-interface, multi-agent
Each step added a capability layer: completion β conversation β agency β platform.
π The Four Interfaces: Comprehensive Comparison
Basics
| π₯οΈ Desktop App | π§© IDE Extension | β¨οΈ CLI | βοΈ Cloud | |
|---|---|---|---|---|
| Released | Feb 5, 2026 | Aug 28, 2025 | Apr 16, 2025 | May 16, 2025 |
| Open Source | No | No | β Yes (Apache 2.0) | No |
| Built With | Electron + Rust core | TypeScript (VS Code ext) | Rust (rewritten from TS) | OpenAI infra |
| Platform | macOS, Windows | macOS, Linux (Win experimental) | macOS, Linux (Win experimental) | Web browser |
| Runs On | Local machine | Local machine | Local machine | OpenAI cloud containers |
| Pricing | ChatGPT Plus ($20/mo)+ | ChatGPT Plus ($20/mo)+ | Free tool + API key or plan | ChatGPT Plus ($20/mo)+ |
Execution Model
| π₯οΈ Desktop App | π§© IDE Extension | β¨οΈ CLI | βοΈ Cloud | |
|---|---|---|---|---|
| Code execution | Local, sandboxed | Local | Local, sandboxed | Cloud container |
| Internet access | Yes | Yes (web search) | Yes (web search) | β Disabled by default during agent phase |
| Sandbox | Built-in worktree isolation | Editor-level | Configurable (workspace-write / full-access) | Fully isolated, network-restricted |
| Parallel tasks | β Multi-agent side by side | β Single thread | β Single session | β Multiple tasks in parallel |
Feature Matrix
| Feature | π₯οΈ App | π§© IDE | β¨οΈ CLI | βοΈ Cloud |
|---|---|---|---|---|
| Read/edit/run code | β | β | β | β |
| Git integration | Built-in | Via editor | Via terminal | Auto-clone, proposes PRs |
| Worktree support | β Built-in | β | Manual | Auto per task |
| Web search | β | β | β | β (offline default) |
| Image input | β | β Drag & drop | β | β |
| MCP / Plugins | β | β | β | Limited |
| Skills | β | β | β | β |
| Automations / Cron | β | β | β | β |
| Subagents | β | β | β | β |
| Terminal reading | N/A | β | N/A (is terminal) | N/A |
| AGENTS.md | β | β | β | β |
| Model selection | β | β | β | β |
| Native PR proposals | Via git | Via git | Via git | β Built for async PRs |
| Review pane / diff UI | β | Via editor | Terminal diff | β Web review UI |
| Secrets management | β | β | β | β Encrypted, setup-phase only |
Best For
| π₯οΈ Desktop App | π§© IDE Extension | β¨οΈ CLI | βοΈ Cloud | |
|---|---|---|---|---|
| Ideal user | Power users managing multiple agents | Devs who live in VS Code | Terminal-native devs | Async delegation |
| Analogy | Command center | Copilot on steroids | Claude Code / Aider equivalent | Junior dev in background |
| Strength | Multi-agent orchestration + automations | Inline context from open files | Lightweight, scriptable, open source | Fire-and-forget parallel tasks |
ποΈ Architecture Highlights
Desktop App (Electron + Rust)
The architecture spans three process layers:
- Electron/React: windowing, ProseMirror editor, OAuth2 authentication
- Rust core: the actual intelligence β agent loop, sandboxing, tool execution
- 70-method IPC API surface between layers
- Built-in automation/cron system for scheduled background tasks
CLI (Rust)
- Originally TypeScript/Node β rewritten in Rust (95.6% as of Apr 2026)
- Reasons for rewrite: zero-dependency install, native security bindings, lower memory (no GC)
- Sandboxing modes:
workspace-write(default, scoped) anddanger-full-access - MCP support for extensibility via
~/.codex/config.toml
Cloud
- Two-phase runtime: setup (network-enabled, installs deps) β agent (offline by default)
- Each task runs in isolated container with repo pre-loaded
- Container state cached up to 12 hours
- Secrets encrypted separately, available only during setup phase, removed before agent runs
π Models Powering Codex
| Model | Released | Notes |
|---|---|---|
| codex-1 | May 2025 | o3 variant optimized for SWE |
| codex-mini-latest | 2025 | Smaller model for CLI, $1.50/M input tokens |
| GPT-5-Codex | Sep 2025 | First GPT-5 variant for code |
| GPT-5.2-Codex | Jan 2026 | Context compaction, SWE-Bench Pro 56.4% |
| GPT-5.3-Codex | Feb 2026 | Improved performance |
| GPT-5.3-Codex-Spark | Feb 2026 | Low-latency variant for real-time coding |
| GPT-5.4 | Mar 2026 | Flagship, native computer use |
| GPT-5.4 mini | Mar 2026 | Available across all Codex surfaces |
π‘ Lessons for Building an AI Code Agent
From studying Codexβs evolution, several design principles emerge:
-
Start with CLI β Codex started as a simple terminal tool. CLI-first is the fastest way to iterate on an agent loop without UI complexity.
-
Tool use is the core β The agentβs power comes from its tools (file read/write, bash, git, web search), not just the model. Design the tool layer carefully.
-
Sandboxing matters early β Codex invested in sandboxing from day one. Letting an agent run code without guardrails is a non-starter for real usage.
-
Extensibility via protocol β MCP (Model Context Protocol) became the standard plugin mechanism. Building on open protocols beats proprietary plugin systems.
-
The CLI is the open-source part β For studying how agents actually work, the Codex CLI source code (Rust, Apache 2.0) is the primary learning resource.
-
Model-agent separation β The agent layer is model-aware but model-independent in design. The same agent framework ran on codex-1, GPT-5, GPT-5.2, GPT-5.3, and GPT-5.4 β swapping models without rewriting the agent.