OpenAI's Agents API, in public beta since Sept. 10, lets developers build cloud agents on its Codex harness, with OpenAI handling sessions, recovery and context compaction.

Key Takeaways

  • The Agents API gives an application access to the Codex harness through an OpenAI-managed API
  • OpenAI manages sessions, orchestration, context compaction and recovery
  • Agents can run code, edit files, connect to MCP servers and produce artifacts in a sandbox
  • Model usage is billed at the selected model's API rates, and hosted sandboxes use standard container rates

OpenAI published documentation describing the Agents API as a way to build durable cloud agents with a managed Codex harness. The application provides the tools and chooses its execution environment.

Also Read: OpenAI Sets 5 Rules To Stop AI Agents Going Off Script

How A Session Works

The docs say a session is a durable instance of an agent that works on tasks and responds to input. With an OpenAI-hosted session, the application sends input and receives events. OpenAI runs the agent and provisions and manages its sandbox.

The docs list five steps. First, create a session. Second, configure the agent while OpenAI provisions its environment. Third, give it a task, which starts a turn of work once the environment is ready. Fourth, follow progress by streaming output or using webhooks to learn when the agent finishes or needs input. Fifth, send another task to the same session or guide the agent during its current turn.

The Four Core Concepts

The Agents API is built around four main concepts, according to the documentation.

Concept What the docs say
Agent The model, instructions, tools and MCP servers available to the agent
Environment An optional sandbox or computer where the agent accesses files, loads skills and runs commands
Session A durable instance of an agent that works on tasks and responds to input
Events and items The inputs sent to an agent and the output produced during a session

Sandboxes, Examples And Pricing

Agents can operate in a sandbox where they can execute code, edit files, connect to MCP servers and produce artifacts. A code sample in the docs sets up a self-hosted environment with a workspace directory at /workspace. The same sample turns on multi-agent mode with a maximum of 4 concurrent subagents and uses the model gpt-6-astra. Requests in the curl example carry an OpenAI-Beta header set to agents=v1.

The docs point to several complete examples. They include an incident response agent, a Slack bot, a data analyst that answers warehouse questions with read-only SQL, a GitHub issue investigator and a document reviewer. Another example compares release notes with subagents and combines their findings into one answer.

On cost, the docs say model usage is billed at the selected model's API rates. OpenAI tools use their standard rates. OpenAI-hosted sandboxes use standard container rates.

Read Next: OpenAI’s 10,000 Agents Run 36 Hours Straight With Zero Human Checks

Originally published on Fathom News.