Agentic AI

Agentic AI

From Software Engineering to Harness Engineering: What OpenAI's Codex Actually Builds

Ken Huang's avatar
Ken Huang
Aug 21, 2026
∙ Paid

On August 19, 2026, OpenAI published Codex as a platform: build on the open agent harness, emphasizing that the most valuable reusable asset inside Codex is not the chat interface. It is the harness: the execution system that sits between a model and a task. This harness gathers context, invokes tools, enforces sandbox and approval boundaries, streams execution progress, and carries work across multi-turn sessions.

That publication offers a clear admission from a frontier AI laboratory: building capable agents demands a distinct engineering discipline. I examined that admission by exploring the open-source openai/codex repository, spanning over 100 crates and tens of thousands of lines of Rust. In this article, I map those concrete architectural patterns to a framework for engineering agentic AI systems.

OpenAI's Core Argument for the Agent Harness

The Codex release outlines four foundational claims:

  1. The harness represents the primary reusable component in modern agent architectures. A capable agent requires more than raw model prompts; it requires robust context assembly, safe tool dispatch, resilient error recovery, human approval gates, and multi-turn state management. OpenAI reported that harness-level optimizations such as retained reasoning and context compaction boosted GPT-5.6 Sol's ARC-AGI-3 benchmark score from 13.3% to 38.3% while cutting token consumption sixfold.

  2. The open-source codex-rs repository provides an inspectable reference implementation on GitHub. Developers can audit the boundary layer that separates client applications from foundation models rather than relying on closed abstractions.

  3. The platform supports three distinct integration tiers: codex exec for non-interactive background tasks, the programmatic Codex SDK for custom scripts, and the app-server protocol (managing threads, turns, streamed events, and approval requests) for embedding persistent agent loops into existing applications.

  4. The primary commercial opportunity centers on embedding agent loops into existing products. Instead of migrating all user workflows into generic conversational interfaces, developers can embed the harness directly into domain-specific dashboards, ticket queues, and operations portals.

OpenAI demonstrated this embedding concept through "Relay," a prototype shipment-operations dashboard where an agent proposes actions via application-owned Model Context Protocol (MCP) tools while human operators review sensitive updates.

The Shift from Software Engineering to Harness Engineering

In my foundational article, Harness Engineering as the Umbrella Discipline, I argued that Harness Engineering serves as the overarching discipline for the agentic AI era. As the AI community moved from Prompt Engineering to Context, Loop, Graph, and Memory Engineering, each concept identified an essential component of the agent runtime. Earlier in my analysis of The Claude Code Leak: 10 Agentic AI Harness Patterns That Change Everything and Chapter 1: The Harness Paradigm, I showed how leading frontier systems decouple the conversational interface from the execution substrate. Furthermore, in What a Secure Harness for Agentic AI Actually Is, I outlined the multi-layered security and defense-in-depth boundaries that production agents demand.

Classical software engineering assumes predictable system behavior. Software developers write explicit logic, verify edge cases against deterministic test pyramids, and deploy predictable branch logic to production environments.

Figure 1 illustrates how agentic harness engineering shifts focus from writing static code paths to governing non-deterministic model actions through runtime sandboxes and policy gates. The harness encloses the model, transforming unconstrained token generation into reliable, bounded actions.

Figure 1: Classical Software Engineering vs Agentic Harness Engineering

Figure 1: Classical Software Engineering vs Agentic Harness Engineering

Agentic systems break the classical software assumption because the foundation model selects branch paths at runtime. Harness engineering therefore focuses on bounding, observing, and governing an autonomous runtime whose exact trajectory no developer can predict in advance. OpenAI's Codex release offers direct, code-level validation of this framework.

The Four Core Disciplines of Harness Engineering

I structure Harness Engineering into four foundational disciplines:

  1. Prompt Engineering: Assembling structured, composable instructions rather than maintaining monolithic prompt strings.

  2. Context Engineering: Constructing dynamic, testable environment slices that supply relevant evidence per execution turn.

  3. Loop Engineering: Implementing bounded state machines that handle retries, token compaction, and clean cancellation across multi-turn tasks.

  4. Graph Engineering: Orchestrating multi-agent collaboration, delegation boundaries, and independent review gates across complex workflows.

Figure 2 shows the three-tier architecture of the codex-rs harness, connecting modular prompt and context generators to loop execution, multi-agent graphs, and OS sandboxes. This structure provides a repeatable blueprint for production agent architectures.

Figure 2: The Core Disciplines and Supporting Infrastructure in codex-rs

Figure 2: The Core Disciplines and Supporting Infrastructure in codex-rs

The Nine Supporting Components in a Complete Harness

Nine specialized subsystems support these four core disciplines across the codex-rs implementation:

  1. Automation: Providing persistent interactive shell environments and structured file-patch primitives.

  2. Identity and Intent: Managing PKCE authentication, enterprise workload federation, and explicit approval policies.

  3. Memory: Serializing thread rollouts, supporting historical branching, and executing proactive summarization.

  4. Observability: Exporting structured OpenTelemetry spans and consent-gated telemetry events.

  5. Runtime Control: Enforcing filesystem boundaries through operating-system sandboxes across Linux, macOS, and Windows.

  6. Evaluation: Verifying harness outputs against structural snapshot suites and in-loop review agents.

  7. Scalability: Managing concurrent thread lifecycles and isolating compute workloads across cloud tasks.

  8. Token Budget: Regulating context consumption through proactive compaction hooks and budget monitors.

  9. Extensions: Loading validated skills, managing plugin trust policies, exposing bidirectional MCP servers, and triggering lifecycle hooks.

For an in-depth treatment of the first 7 patterns plus data government, please see my newly published book on Amazon; the book was a top new release book recently.

In the following technical deep dive, I walk through the actual Rust implementations for all thirteen categories across the openai/codex repository, connecting each pattern to the architectural principles I established in my earlier harness investigations.

User's avatar

Continue reading this post for free, courtesy of Ken Huang.

Or purchase a paid subscription.
© 2026 ken · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture