OpenAI Agents API Guide: The Codex Harness, Now a Managed Service (2026)
Quick verdict
OpenAI's Agents API entered public beta on September 10, 2026, exposing the same harness and infrastructure that powers Codex through a single API call. It bundles four objects — agent, environment, durable session, and event stream — and handles orchestration, context compaction, and subagents for you. There is no fee for the API itself; you pay for tokens, tools, and container time.
What Shipped
OpenAI opened the Agents API to public beta on September 10, 2026. The pitch is unusually concrete: the same agent harness and infrastructure that powers Codex and ChatGPT for Work — previously internal — is now available to any developer through a single, flexible API call.
The problem it targets is one that teams building agents keep rediscovering. A capable model is not enough. Long-running agents need a harness that manages context, uses tools efficiently, and coordinates subagents; and they need infrastructure that keeps them running reliably for days in an environment where they can read and write files, execute code, and save intermediate results. Most teams end up building that scaffolding themselves, and then maintaining it against every model release.
The Agents API's answer is: specify a task, a model, your tools, and an environment. OpenAI runs the loop.
The Four Core Objects
The design is built around four things:
| Object | What it holds |
|---|---|
| Agent | The model, instructions, and tools — the definition of what your agent is |
| Environment (optional) | Where the agent's code actually runs |
| Session | A durable session that persists across a task — the thing that keeps work alive |
| Events | A stream the session emits as it works, so you can observe and react |
Every request carries a beta header, and OpenAI's documentation lists GPT-6 Astra as the reference model. The subagent side is configured declaratively — a shape closer to infrastructure-as-config than to prompt engineering:
"agent": {
"model": "gpt-6-astra",
"multi_agent": {
"enabled": true,
"max_concurrent_subagents": 3
}
}
Three Problems the Harness Solves
These are the parts most teams have previously rebuilt by hand:
1. Automatic context compaction. As a session approaches its context limit, the harness compacts earlier content while trying to preserve what is relevant. That is what makes hour-long and day-long agent runs viable without custom summarization logic.
2. Tool search. Rather than loading every tool definition into every request, the harness loads the relevant definitions on demand — a direct cut to token spend on agents with large tool inventories. Parallel tool calls are supported.
3. Native subagents. A main agent can split a complex task into pieces that run in parallel, each with its own context, and merge the results. Coordination is handled by the harness rather than by your code.
There is also an open-source foundation: the harness derives from the open-source Codex codebase. That matters because it means the coordination logic — how tools, memory, and context are managed — can be inspected rather than treated as a black box. OpenAI operates and maintains it; you can read it.
Sandboxes: Where the Code Runs
Where an agent executes code is left to you, and this is where the design is most flexible.
- OpenAI-hosted sandboxes: your agent can run code, work with files, and produce artifacts; you supply files, install packages, and add skills and plugins while OpenAI provisions and manages the environment. These use standard container rates, billed separately from model usage.
- Your own sandbox: bring your own, or connect a provider. OpenAI lists first-class integrations with Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle Cloud, Runloop, and Vercel, spanning managed environments, deployments inside your own VPC, and CPU/GPU/memory profiles.
For teams with compliance constraints or GPU requirements, the self-hosted path is what makes the API usable at all — and it is also why the separation between harness and sandbox is the most consequential architectural decision here.
What Early Customers Report
OpenAI published figures from launch customers. These are vendor-selected, so read them as existence proofs rather than benchmarks:
| Customer | Reported result |
|---|---|
| Ciridae | Evaluation score 0.71 → 0.85, with a 4x latency reduction on subagent workflows |
| SafetyKit | 60% lower cost per case after migrating its case-review workflow |
| Hypha | 86% fewer failed agent responses after separating harness from sandbox |
| Nash.ai | Runs thousands of long-running agents managing hundreds of millions of deliveries |
The Hypha result is the one worth pausing on. A large share of agent failures in production are not model-quality problems — they are infrastructure problems: a session dies, context is lost, a retry starts from nothing. Decoupling the harness from the execution environment cutting failures by 86% says more about where the difficulty has been than any benchmark table.
Adoption Model and Pricing
There is no additional fee for the Agents API. You pay for:
- Tokens at the selected model's API rates
- Tools, as they are used
- Container time, if you use OpenAI-hosted sandboxes, at standard container rates
That last item is the one people underestimate. One early commenter in OpenAI's developer forum put it plainly after discovering the pricing page: calculate costs before spinning up containers, because they bill independently of model usage. Running many parallel agents in hosted sandboxes is a compute bill, not just a token bill.
The Trade-Off: Orchestration Lock-In
The honest assessment of any managed harness is about ownership, and this one is no exception.
Adopting the Agents API means your application's orchestration layer is OpenAI's implementation, versioned against OpenAI's model releases. For teams whose differentiation lives in their tools, data, and workflows — not in the agent loop itself — that is a straightforward trade: you get Codex-grade infrastructure instead of maintaining your own.
Teams building agent platforms intended to work across multiple model providers will look at this differently. For them, the more relevant artifact may be the open-source Codex harness on GitHub, which can be run against their own infrastructure and models, rather than the hosted API. The API and the harness are the same code; the API just comes with OpenAI operating it.
Two other constraints are worth knowing before you commit: during the beta, data processing stays in the United States, and the service does not support zero data retention — not even when you supply a self-hosted sandbox.
Should You Use It?
| Your situation | Recommendation |
|---|---|
| Building a product on OpenAI models with long-running agents | Strong fit — this removes months of infrastructure work |
| Prototyping an agent that must survive restarts | Start here; the durable session model is the point |
| Existing custom harness that works | Migrate only if maintenance is actually costing you; measuring that is harder than it sounds |
| Multi-provider architecture | Evaluate the open-source harness instead of the hosted API |
| Compliance-bound workloads (EU data residency, ZDR requirements) | Not yet — the beta constraints rule it out today |
| Cost-sensitive fan-out workloads | Model the container bill first, then decide |
Summary
The Agents API is OpenAI productizing the least glamorous and most decisive part of agent engineering. Model quality stopped being the bottleneck a while ago; keeping long-running agents alive, compacting their context, and coordinating parallel work is where teams lose time. Handing that to a managed service with no API fee is a reasonable trade for most teams building on OpenAI's stack.
The cost is dependency, and the alternatives are clear: adopt the hosted API, run the open-source harness yourself, or keep building your own loop. What is no longer defensible is treating agent infrastructure as a small detail to be solved later.
For the model it references, see our GPT-6 Astra review; for the competing orchestration model, see Cursor Projects; and for the fundamentals, our AI agents guide.
Related Articles
Keep reading