tech
OpenAI spills technical details about how its AI coding agent works
Unusually detailed post explains how OpenAI handles the Codex agent loop.

TL;DR
- OpenAI engineer Michael Bolin detailed the technical workings of the Codex CLI coding agent.
- The "agent loop" orchestrates interactions between the user, AI model, and software tools.
- Codex constructs initial prompts from system, developer, user, and assistant components.
- The agent sends the entire conversation history with each API call (stateless) for Zero Data Retention.
- Prompt caching helps mitigate inefficiencies from quadratic prompt growth, but cache misses can occur.
- Codex automatically compacts conversations when token counts exceed a threshold to manage context window limitations.
- AI coding agents like Codex are becoming more useful for rapid prototyping but require human oversight for production work.
- OpenAI and Anthropic open-source their coding CLI clients but not their web interfaces for ChatGPT or Claude.
- Future posts will cover Codex's architecture, tool implementation, and sandboxing model.