OpenAI spills technical details about how its AI coding agent works

coding robots agents

It’s worth noting that both OpenAI and Anthropic open-source their coding CLI clients on GitHub, allowing developers to test implementations directly, whereas they do not do so for ChatGPT or the cloud web interface.

An official look inside the Loop

Bolin’s post focuses on what he calls the “agent loop,” which is the core logic that orchestrates the interaction between the user, the AI ​​model, and the software tools used by the model to perform the coding work.

As we wrote in December, every AI agent has a repetitive cycle at its core. The agent takes input from the user and generates a text prompt for the model. The model then generates a response, which either generates a final answer for the user or requests a tool call (such as running a shell command or reading a file). If the model requests a tool call, the agent executes it, appends the output to the original prompt, and interrogates the model again. This process is repeated until the model stops requesting the tool and instead generates a helpful message for the user.

That looping process has to start somewhere, and Bolin’s post shows how Codex constructs the initial signal sent to OpenAI’s Response API, which handles model inference. The prompt is composed of several components, each with a specified role that determines its priority: system, developer, user, or assistant.

The directive field comes from either a user-specified configuration file or base directives bundled with the CLI. The Tools field defines what functions the model can call, including shell commands, planning tools, web search capabilities, and any custom tools provided through the Model Context Protocol (MCP) server. The input field consists of a series of items that describe sandbox permissions, optional developer instructions, environment context such as the current working directory, and finally the actual message to the user.



<a href

Leave a Comment