The GenAI Field Guide · Trending

OpenAI Agents API

OpenAI's own Codex agent harness offered as a managed API: you send a task to a durable session, and OpenAI runs the loop, the context management and the recovery.

The Agents API, in public beta since 10 September 2026, gives your application the same harness that runs Codex, so OpenAI keeps the agent loop, session state, context compaction and recovery on its side while you supply tools and choose where code runs. On 29 September it gained computer use in an OpenAI-hosted browser. Teams that have been building their own orchestration on the Responses API should look at it, and teams with data residency or zero-retention requirements should read its limits first.

What it is

OpenAI's changelog records the Agents API as released in public beta on 10 September 2026, described as a way to build agents with a managed Codex harness while OpenAI handles session orchestration, context compaction and recovery. A harness is the code around a model that turns it into an agent: the loop that calls the model, runs tools, feeds results back, trims the context and survives crashes. Until now, a developer on OpenAI's platform wrote that loop themselves on the Responses API, or ran it inside their own process with the Agents SDK. The Agents API moves the loop onto OpenAI's servers.

OpenAI's own agents guide places the three options on one line. The Responses API is for calling models directly or building an agent from scratch, with high integration effort. The Agents SDK runs inside your application, for custom tools and workflows, with medium effort. The Agents API is for long-running tasks where OpenAI manages the agent and saves its progress, with low effort. Under the marketing, it is hosted agent infrastructure: the same thing several sandbox and agent-platform startups sell, now offered by the model maker with its own harness attached.

At DevDay on 29 September OpenAI added computer use, letting an agent work in an OpenAI-hosted browser. One DevDay recap describes the Agents API as entering public beta at DevDay; the changelog and launch-week coverage date the beta to 10 September, with DevDay adding the browser.

How it works

The docs define four objects. An agent is the model, instructions, tools and MCP servers. An environment is an optional sandbox or computer where the agent reads files, loads skills and runs commands. A session is a durable instance of an agent that works on tasks and accepts input. Events and items are what goes in and what comes out. You create a session with an agent configuration, OpenAI provisions the environment, you send a task, and you follow progress by streaming or webhooks.

The harness always runs on OpenAI's infrastructure; the environment does not have to. The environment type can be none (the harness calls remote MCP tools directly and needs no compute), openai_hosted (OpenAI's sandbox, where the harness runs commands itself), or self_hosted (your code starts the machine and connects an executor to the session). OpenAI also names sandbox integrations with Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop and Vercel. For your own function tools, your code receives each call, runs the function and returns the result, so business logic stays on your side.

Sessions hold the conversation and work across turns. Sending a message to a busy session steers the turn in progress; sending one to an idle session starts a new turn with the existing history. Turns end as completed, failed or cancelled, and the docs warn that a completed turn does not mean every tool succeeded. Streams do not replay missed events, so after a disconnect you fetch the session and its saved items. Message submission takes an idempotency key, which is what makes retries safe.

Computer use adds a computer_use tool and a hosted desktop. The agent looks at browser screenshots and chooses its next action. The browser asks for the user's approval before visiting each new website origin, public sites included, and your application must collect that decision. When a site needs a login, only the main agent (not a subagent) can request it, and your application supplies email, password or verification code; passkeys and QR-code sign-in are not supported.

How to use it

Any developer with an OpenAI Platform account can use the beta. You need an application API key with the api.agents.read, api.agents.write and api.responses.write permissions, the latest openai Python package, and the OpenAI-Beta: agents=v1 header, which the SDK's beta namespace sends for you. The quickstart below is copied from OpenAI's docs.

  1. In your OpenAI Platform project, create an application API key and grant it api.agents.read, api.agents.write and api.responses.write. Export it as OPENAI_API_KEY.
  2. Run pip install --upgrade openai so the client has the beta agents namespace.
  3. Save the quickstart as quickstart.py and run it. It creates a session on gpt-6-astra with an OpenAI-hosted environment, sends one task, and prints every streamed event.
  4. Read the event stream: note the turn completion event and check tool results yourself, because a completed turn does not guarantee every tool call succeeded.
  5. Send a second message to the same session id to continue or steer the work, with an idempotency key saved alongside each message.
  6. Before anything real, decide where code runs (none, openai_hosted or self_hosted), which function tools your application executes, and how your users will answer website approvals and sign-in requests if you enable computer use.

Use cases

Sources

  1. Changelog, OpenAI API docs, 2026-09-29
  2. Agents API overview, OpenAI API docs, 2026-09-10
  3. Agents API quickstart, OpenAI API docs, 2026-09-10
  4. Agents API architecture, OpenAI API docs, 2026-09-10
  5. Agents API sessions, OpenAI API docs, 2026-09-10
  6. Computer use in the Agents API, OpenAI API docs, 2026-09-29
  7. Agents, OpenAI API docs, 2026-10-02
  8. Pricing, OpenAI API docs, 2026-10-02
  9. Introducing the Agents API and hosted sandboxes, OpenAI Developer Community, 2026-09-10
  10. Introducing the Agents API (returned 403 when fetched), OpenAI, 2026-09-10
  11. OpenAI Launches the Agents API in Public Beta, Putting the Codex Harness Behind One API Call, MarkTechPost, 2026-09-10
  12. OpenAI Agents API Public Beta: What It Actually Does, ExplainX, 2026-09-10
  13. Everything OpenAI announced at the DevDay 2026 keynote, RuntimeWire, 2026-09-29
  14. OpenAI DevDay 2026, BenchLM, 2026-09-29