Submit

OpenAI Agents API brings the Codex harness to any agent

OpenAI's Agents API, live in public beta, gives developers the managed Codex harness: sessions, sandboxes, MCP tools and subagents behind one API call.

Written by AiAgentsListing Team

OpenAI Agents API brings the Codex harness to any agent

What happened

OpenAI opened public beta on the Agents API on 10 September 2026, exposing the same Codex harness and infrastructure that runs Codex and ChatGPT for Work through a plain API call. The API handles session state, context compaction and subagent orchestration, and developers choose where the agent's compute runs.

The Agents API is a managed service built on OpenAI's Codex harness: developers supply the model, tools and environment, and OpenAI runs the session, the tool loop and recovery. A single call to client.beta.agents.sessions.create creates a durable session with a model, a set of tools and an execution environment.

What changed

  • A session is built from four parts: an agent (model, instructions, tools and MCP servers), an environment (a sandbox or no sandbox at all), a session (the durable running instance) and events and items (input and output).
  • Environment choice is the main decision developers make. environment.type can be none (no sandbox, only remote tools), openai_hosted (OpenAI provisions and runs the sandbox), or self_hosted, where the developer runs codex exec-server in their own infrastructure and connects an executor over an outbound WebSocket.
  • OpenAI is partnering with nine sandbox providers for first-class integrations: Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop and Vercel.
  • MCP servers connect one of three ways: HTTP with connection_origin: "service" (the server must be reachable from OpenAI, no environment needed), HTTP with connection_origin: "environment" (the call runs from the session's sandbox, for internal or private-network servers), or stdio, where the executor starts a local server process inside the environment. Authentication can be inline per session, stored in a reusable vault attached through vault_ids, or passed as environment variables for stdio servers.
  • Long sessions get automatic context compaction, so developers do not write their own compaction logic. Tool search loads tool definitions only when needed rather than loading every schema up front, and programmatic tool calling lets an agent chain and parallelize tool calls and filter results in code before they enter context.
  • Multi-agent support lets a session split work across subagents, each with its own context, coordinated and combined by the main agent; a session can run up to a configured max_concurrent_subagents.
  • The API supports US-only data residency and does not support Zero Data Retention; a self-hosted sandbox does not make a session ZDR-eligible.
  • There is no separate fee for the harness itself. Billing is model tokens at standard API rates, OpenAI tool usage at standard rates, and container time for OpenAI-hosted sandboxes.

Why it matters for agent builders

Anyone building an MCP server now has three concrete connection modes to design against, not one abstract "the client calls my server" model: a server reachable from OpenAI's own network works with connection_origin: "service" and no sandbox at all, while a server that only exists inside a customer's private network needs connection_origin: "environment" and a running executor. That split determines whether an MCP server needs to be publicly reachable or can stay behind a firewall and still get called by a hosted agent. Teams currently building their own harness, the session loop, compaction, subagent coordination and sandbox lifecycle, get a directly comparable managed alternative to weigh against the engineering cost of maintaining that stack themselves.

What to watch

On the Hacker News discussion, the most upvoted comment argues the harness question is separate from the model question: builders may want OpenAI's session and sandbox infrastructure without wanting to be locked into OpenAI's own frontier models for the actual reasoning, since a non-lab model provider could pick up agentic workloads the harness doesn't require to run on GPT-6 Astra specifically. Whether OpenAI opens the harness to third-party models, or keeps it tied to its own model lineup, will decide how many builders adopt the Agents API versus building on an open-source harness they can point at any model.

Key takeaways

  • OpenAI's Agents API is a managed version of the Codex harness, in public beta as of 10 September 2026, covering session state, compaction, tool use and subagent orchestration.
  • Environments are none, openai_hosted, or self_hosted; nine partner sandbox providers (Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop, Vercel) get first-class integrations.
  • MCP servers connect via service-origin HTTP, environment-origin HTTP, or stdio, each with a different reachability and authentication model.
  • Multi-agent sessions let a main agent delegate to subagents with independent context, each capped by max_concurrent_subagents.
  • Billing is standard model, tool and container rates; there is no extra harness fee, but the API is US-only for data residency with no ZDR support.

FAQ

What is the OpenAI Agents API?

It is a managed API, in public beta since 10 September 2026, that gives developers the same Codex harness and infrastructure OpenAI uses to run Codex and ChatGPT for Work: session management, context compaction, tool orchestration and subagent coordination, reachable through a single API call rather than infrastructure a developer builds themselves.

How does an MCP server connect to an Agents API session?

Three ways: HTTP with connection_origin: "service" for a server reachable from OpenAI directly with no sandbox required, HTTP with connection_origin: "environment" for a server reachable only from inside the session's sandbox, and stdio for a server process the session's executor starts locally inside the environment.

Does the Agents API cost extra on top of model usage?

No separate harness fee. Billing follows the selected model's standard API rates, standard rates for OpenAI tools, and standard container rates for OpenAI-hosted sandboxes, according to OpenAI's own announcement.

Source: Introducing the Agents API Discussion: Hacker News

Builders wiring an MCP server into a hosted agent can browse working examples in the MCP servers directory on aiagentslisting.com.

Share:

Subscribe to our newsletter

One email a week. New agents, MCP servers and skills, and what is actually getting traction.

More news

  1. Claude Code now reads AGENTS.md when CLAUDE.md is absent

    Claude Code will read AGENTS.md when a project has no CLAUDE.md, adopting the open convention that Codex, Cursor and other coding agents already read.

  2. HarnessTax finds coding harness moves cost, not success

    HarnessTax, a UC Berkeley Sky Lab and Arena study, finds swapping a coding agent's harness changes cost by up to 5x while success rate barely moves.

  3. Ordewell orchestrates Claude Code, Codex and OpenCode tasks

    Ordewell is a new open-source CLI, TUI and VS Code extension that turns one goal into an editable, multi-agent plan for coding agents.