OpenAI Agents API: A Managed Codex Harness and What Teams Still Own
OpenAI's Agents API runs the Codex harness for you, with sessions, MCP tools, subagents and sandboxes. What your team still owns: verification, access, data.
This article is published in English.
Sources: OpenAI’s Agents API: The Code You May No Longer Need to Write
Picture an agent assigned to a bug that only shows up when a customer retries a failed request. It reads the ticket, searches the code and settles on a probable cause. Then things get untidy. Dependencies need installing, the failure has to be reproduced, a second service needs a look, and tests have to run. Midway through, a colleague adds a key detail: only older clients are affected.
At that point the code surrounding the agent has plenty to do. It has to keep the findings so far, pass the new detail in, maintain the working environment and track what has really been checked. A dropped connection shouldn't force the investigation back to square one.
OpenAI's Agents API goes after this class of work. It offers the Codex harness as a managed service, with OpenAI taking care of sessions, orchestration, context compaction and recovery. The engineering takeaway is that more of the plumbing that keeps an agent productive can become a platform feature, so teams don't have to rebuild it per application. It also moves the place where teams must watch closely.
The harness is the interesting part
A model can conclude that it should open a file or run a test. Some other piece of software still has to carry out that action, hand back the output and set up the next model call. That software is the harness, and its duties grow as tasks get longer: managing the conversation, coordinating tools, surviving interruptions and helping the agent keep its thread.
The Agents API lets other applications use a managed version of the Codex harness. Documented features include summarizing earlier work to manage context, applying skills, handing subtasks to other agents and resuming sessions. OpenAI's own comparison of runtimes separates three options:
- Agents API: OpenAI runs the Codex harness and keeps the agent session.
- Agents SDK: the agent loop runs inside your application, so you control integration and deployment more tightly.
- Responses API: your application works with raw model responses and designs the surrounding workflow.
Because the Responses API has state-management options too, saved conversations aren't the dividing line. What the Agents API adds is session management paired with a managed agent runtime. One reading is that this changes a familiar build decision: before writing another coordination layer, a team can ask how much of it must really be theirs.
Following one investigation
Take the retry bug again. The workflow below is a proposal, not a report of a system that has been run. The application opens a session with instructions, tools and a suitable working environment, then asks the agent to reproduce the failure and explain it, citing relevant code and test results.
Per the session documentation, what persists across turns is the agent's configuration, the dialogue and any work already saved. A turn is one cycle of work. Input that arrives while the session is idle begins a new turn, and input sent during active work steers the current one. Progress can be followed by streaming or by webhooks. That gives the older-clients detail a destination: it joins the existing investigation, without a new request and a rebuilt history.
Evidence from the issue tracker comes next. Through Model Context Protocol, a server can offer tools for searching issues or fetching records, and the Agents API discovers those tools and executes calls to the server, so the application needn't relay each one. Discovery here means finding capabilities on configured servers. Someone still has to wire up the right systems and grant sensible access.
The agent might also divide the work, with one subagent studying retry handling and another checking how older clients form requests. The multi-agent documentation describes separate contexts for subagents while the main agent coordinates and merges their results. That works when questions are independent. If both must edit one function, coordination becomes the problem again, and OpenAI's guidance explicitly points out the need to coordinate edits to shared files. What makes the runtime notable is that all of this hangs together around one continuing piece of work.
A session still needs a place to work
Reading an issue and running a reproduction test need different resources. According to the architecture documentation, the harness, which runs the model and tool loop, is separate from the execution environment, which supplies compute and files when needed. Your application submits work, receives events and handles any function tools it defined. There are three environment options:
- No environment at all: the agent can call its configured tools, with no shell and no workspace files.
- Hosted by OpenAI: a sandbox is created and run for you, where commands execute and files or generated artifacts live.
- Self-hosted: you supply the compute and files, and your application handles setup and teardown.
For the bug hunt, the environment must hold the code, its dependencies and the test setup. A session that remembers the investigation can't make up for a missing package or an unreachable test service. A second distinction matters too. OpenAI documents that a session can outlive its environment, and with self-hosted execution the application keeps responsibility for compute and files. Remembering that a test file was created isn't the same as still having it, and teams should check both before promising smooth resumption.
Preserving work isn't proving it right
Suppose the run ends with a confident explanation and a green test. An engineer still has to ask whether that test reproduced the original failure. Maybe it exercised a current client while the bug lives in an old one. Maybe the agent edited the test until it no longer examined the troublesome behavior.
This is where the line of responsibility falls. The runtime provides mechanisms to do and continue work, and the application team defines what evidence counts as acceptance. For this investigation, that means a failure someone can reproduce, the precise code revision looked at, each command executed along with its output, and whatever doubt remains. Those requirements belong in the workflow even when a platform runs the loop.
Compaction deserves the same care. A summary squeezes earlier work into the model's available context, yet key decisions should also be written to a durable record that people can inspect. Here, "older clients only" must stay attached to the task's acceptance criteria.
A second agent's analysis is useful but shouldn't be mistaken for independent verification. Two agents can share a wrong assumption or lean on the same thin evidence. A reproduction test another engineer can rerun is a firmer basis.
Authority follows the same logic. OpenAI's sandbox security guidance says that code an agent generates can reach the files, credentials and network its environment exposes, so isolation and tight access have to be configured on purpose. For this example, investigation access is plenty. Being allowed to inspect a failed request doesn't call for permission to alter production data.
How to judge it
A sensible trial uses one bounded workflow, such as producing a bug-investigation report for review. Compare it against the team's current approach: how often it yields usable evidence, how much human correction it needs and how reliably it resumes after an interruption. Count the total cost per accepted result, since a long investigation can involve many model calls, tools and subagents.
The API offers session logs, events, saved history and token-usage inspection. The documentation also names a current limitation: trace retrieval and external trace exporters aren't part of the public beta, which matters to teams with established monitoring. Data requirements deserve an early look as well. The overview states that, when it was written, the Agents API supported data residency only in the United States and offered no Zero Data Retention, and a self-hosted sandbox doesn't lift that restriction.
If those limits are acceptable, the question turns practical: does the managed runtime remove enough infrastructure work to justify depending on it? Some teams will like the trade, and others will want the control of an SDK or their own orchestration.
The larger trend is a good one. Keeping context under control, running code, coordinating agents and carrying work forward are now sold as shared infrastructure, which backs up the view that useful agents depend on the systems around the model as much as on the model. The payoff is in spending the engineering time saved on making results easier to trust. In the retry case, that means handing the next engineer a failure they can reproduce and evidence they can inspect.
This reflects OpenAI's official documentation as reviewed on 15 September 2026. The workflow example and evaluation advice are engineering analysis, not benchmark results.