
"The turn begins with assembling an initial prompt for the LLM. This consists of instructions, which is a system message that contains general rules for the agent, such as coding standards; tools, a list of MCP servers that the agent can invoke; and the input, which is a list of text, images, and file inputs, including things like AGENTS.md, local environment information info, and the user's input message."
"Like all AI agents, the harness consists of a loop that takes input from a user and uses an LLM to generate tool calls or responses back to the user. But because of LLM constraints, the loop also has strategies to manage context and reduce prompt cache misses. Some of these strategies were based on lessons learned the hard way: as bugs reported by users."
Codex harness is the core component of the Codex CLI, implementing an agent loop that accepts user input and uses an LLM to generate tool calls or responses. Each turn assembles a prompt with system instructions, a list of MCP tool servers, and input artifacts such as text, images, AGENTS.md, local environment details, and the user's message. The prompt is packaged as JSON and sent to the Responses API, which streams output events that can trigger tool invocations. The harness includes strategies to manage context and reduce prompt cache misses, some developed after user-reported bugs. The CLI can use any model wrapped by the Responses API, including locally hosted open models.
Read at InfoQ
Unable to calculate read time
Collection
[
|
...
]