Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

OpenAI 16 min read Deep dive mediumAdept

Unrolling the Codex agent loop

Codex CLI's agent loop repeatedly sends a prompt to the Responses API, executes any tool calls the model requests, and appends their outputs until the model returns an assistant message that ends the turn. The initial prompt is assembled from three parts: instructions from config or bundled model files, a tools list (shell, update_plan, web_search, MCP tools), and ordered input items. Those input items cover sandbox permissions, developer instructions, aggregated AGENTS.md user instructions (32 KiB limit), skills and environment context. Responses stream back as SSE events, and reasoning and function-call items are fed back into later requests, so prompt length grows and context-window management becomes a core harness responsibility.

Related posts

  • From model to agent: Equipping the Responses API with a computer environment

    OpenAI mediumAdept

    OpenAI's Responses API now pairs with a shell tool and hosted container workspace so models can run multi-step agent workflows. The API orchestrates the loop itself: it streams command output back to the model, runs multiple commands concurrently in separate sessions, and truncates large outputs while keeping their beginning and end. Native compaction carries long-running sessions across context-window limits. The containers stage files and SQLite databases instead of stuffing prompts, route network egress through a sidecar proxy with allowlists and domain-scoped secret injection, and load versioned 'skills' bundles (SKILL.md plus resources) that the model explores via shell commands.

  • Four minutes after midnight, Codex said the page was live

    Render mediumAdept

    OpenAI's Dominik Kundel argues that with agentic delegation, code is no longer the bottleneck. What matters is the harness around the agent: context, validation and verification. Codex reaches context through plugins (Slack, Notion, Drive, Linear), Memories and Chronicle. It validates its own work with fast tests, linters like Vale for docs, parallel app copies, CDP debugging and deployment-watching plugins. Changes get verified by a separate Codex review session tuned via AGENTS.md to flag only P0/P1 issues, plus deploy previews or videos. Recurring feedback should become skills, lint rules or tests rather than repeated corrections, illustrated by Codex shepherding a midnight docs deploy end to end.

  • You Should Write An Agent

    Fly.io mediumAdept

    An LLM agent is just a loop around a stateless chat API: keep a list of messages, replay it on every call, and when the model emits a function_call, run the tool and append its output. A few dozen lines of Python against the OpenAI Responses API produce a working tool-using agent that decides on its own to ping multiple Google hosts. MCP is barely a technology, just a plugin interface for agents you don't control, and context engineering is a real, legible programming problem of budgeting tokens across sub-agents, tools and summaries. Agent design leaves open problems around nondeterminism, grounding, inter-agent interchange formats and cost, and each design iteration takes about 30 minutes, so engineers should build one themselves.

  • Harness, Scaffold, and the AI Agent Terms Worth Getting Right

    Hugging Face easyNovice

    A glossary of AI agent terms that are often conflated. The model is a stateless LLM. Scaffolding is the behavior-defining layer around it: system prompt, tool descriptions, output parsing and context management. The harness is the execution loop that calls the model, runs tool calls and decides when to stop, and an agent is model plus harness. Further entries cover context engineering, policy, tool use, skills and sub-agents, plus RL training terms (environment, trainer, rollout, reward and rubrics), with pointers to TRL's GRPOTrainer, OpenEnv and Verifiers.

  • Designing the hf CLI as an agent-optimized way to work with the Hub

    Hugging Face mediumAdept

    Hugging Face rebuilt its hf CLI to serve both humans and coding agents. It detects agents via environment variables like CLAUDECODE and CODEX_SANDBOX and switches to untruncated, ANSI-free TSV output, sends hints and errors to stderr, fails fast instead of prompting, and supports idempotent retries, --dry-run and consistent resource+verb commands. In a benchmark of ~1,000 graded runs across 18 Hub tasks on Claude Code (Sonnet 4.6) and Codex (GPT-5.5), agents hand-rolling curl or the Python SDK used 1.3-1.8× more tokens overall, and up to 6× on multi-step tasks. On Sonnet they also succeeded less often (84% vs 94%) and falsely reported success more often. A generated skill file covering the full command surface adds a further small reduction in tool calls.

The quest for software engineering knowledge.

Look:
Layout: