It’s price noting that OpenAI open-sources its coding CLI consumer on GitHub, permitting builders to look at the implementation straight, whereas they don’t do the identical for ChatGPT.
An official look contained in the loop
Bolin’s submit focuses on what he calls “the agent loop,” which is the core logic that orchestrates interactions between the consumer, the AI mannequin, and the software program instruments the mannequin invokes to carry out coding work.
As we wrote in December, on the heart of each AI agent is a repeating cycle. The agent takes enter from the consumer and prepares a textual immediate for the mannequin. The mannequin then generates a response, which both produces a last reply for the consumer or requests a device name (akin to operating a shell command or studying a file). If the mannequin requests a device name, the agent executes it, appends the output to the unique immediate, and queries the mannequin once more. This course of repeats till the mannequin stops requesting instruments and as an alternative produces an assistant message for the consumer.
That looping course of has to start out someplace, and Bolin’s submit reveals how Codex constructs the preliminary immediate despatched to OpenAI’s Responses API, which handles mannequin inference. The immediate is constructed from a number of elements, every with an assigned position that determines its precedence: system, developer, consumer, or assistant.
The directions discipline comes from both a user-specified configuration file or base directions bundled with the CLI. The instruments discipline defines what capabilities the mannequin can name, together with shell instructions, planning instruments, net search capabilities, and any customized instruments offered by means of Mannequin Context Protocol (MCP) servers. The enter discipline comprises a sequence of things that describe the sandbox permissions, optionally available developer directions, setting context like the present working listing, and eventually the consumer’s precise message.

