OpenAI Introduces Agents API to Bring Codex-Style Cloud Agents to Developers
OpenAI has launched the Agents API in public beta, giving developers a managed way to build long-running cloud agents with the Codex harness, tools, sandboxes, context management and multi-agent workflows.
Xcademia Team
Xcademia Research Team

OpenAI has introduced the Agents API, a public-beta API designed to help developers build and run long-running AI agents using the same underlying harness and infrastructure that powers Codex.
The announcement, published on September 10, 2026, positions the API as a way to move beyond simple model calls and build agents capable of working through complex, multi-step tasks over extended sessions.
According to OpenAI, the API lets developers specify an agent's task, model, tools and execution environment through a single API call. OpenAI manages the agent harness, while developers can choose where the agent's computation takes place.
This can include an OpenAI-managed sandbox, a developer's own infrastructure or supported sandbox partners.
From model calls to managed agents
Traditional AI applications often require developers to build much of the surrounding infrastructure themselves.
An application may need to manage context, tool calls, execution environments, long-running sessions and coordination between multiple agents.
OpenAI says its experience scaling Codex and ChatGPT for Work showed that useful long-running agents need infrastructure capable of managing context, efficiently using tools and coordinating subagents.
The Agents API packages those capabilities into an API designed for developers building their own agentic applications.

A single API call can configure an agent
OpenAI's example shows an agent being configured with a model, an MCP-based observability tool, multi-agent support, a vault, an execution environment and a task.
The agent can then investigate a service issue, delegate different parts of the investigation to subagents and save findings and recommended mitigation to a workspace.
Code example
The following example is adapted from OpenAI's official announcement to illustrate the structure of an Agents API session:
import OpenAI from "openai";
const client = new OpenAI();
const session = await client.beta.agents.sessions.create({
agent: {
model: "gpt-6-astra",
tools: [
{
type: "mcp",
server_label: "observability",
transport: {
type: "http",
server_url: "https://observability.example.com/mcp",
},
},
],
multi_agent: {
enabled: true,
max_concurrent_subagents: 3,
},
},
vault_ids: ["vault_YOUR_VAULT_ID"],
environment: {
type: "openai_hosted",
capability_directories: [
"/workspace/capabilities/skills",
],
},
input:
"Investigate service-api's elevated 5xx rate over the last 30 minutes. " +
"Delegate deployment, error, and dependency analysis to subagents. " +
"Save findings, evidence, and recommended mitigation in /workspace/outputs.",
});The example demonstrates the core idea: the developer defines what the agent should do and what resources it can access, while the managed harness handles much of the underlying agent orchestration.
Developer note: The code above reflects the structure shown in OpenAI's announcement. Developers should consult the current Agents API documentation before using it in production because the API is in public beta.
OpenAI-hosted sandboxes
One of the major components of the announcement is the OpenAI hosted sandbox.
OpenAI says these environments use the same sandboxing infrastructure that powers Codex and ChatGPT. Developers can configure the environments with files, packages, skills and plugins that an agent needs to complete its work.
The sandbox is designed to allow agents to run code, work with files and produce artifacts.
This creates an important distinction between an AI model and an AI agent.
A model primarily generates responses. An agent can operate within an execution environment, use tools, manipulate files and continue working through a task.
Developers can choose the execution environment
OpenAI is not limiting the Agents API to its own hosted environment.
The company says developers can choose between OpenAI-managed environments, their own infrastructure or sandbox partners.
OpenAI also announced first-class integrations with ecosystem providers including Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop and Vercel.
This approach separates the agent's orchestration layer from the environment in which its work is executed.
For organisations with specific infrastructure, compliance or deployment requirements, that separation could become an important architectural consideration.

Longer-running agents get context management
Long-running agents introduce a practical problem: context can eventually exceed a model's context window.
OpenAI says the Agents API automatically compacts earlier context as a session approaches its context limit.
The goal is to allow agents to continue working across multiple context windows without requiring developers to implement their own context-compaction system.
This matters particularly for tasks that can take hours rather than seconds or minutes.
An agent investigating a production problem, analysing a large dataset or completing a multi-stage engineering task may need to preserve important information while discarding less relevant historical context.
Tool search aims to reduce unnecessary context
The Agents API also includes tool search capabilities.
OpenAI says relevant tool definitions can be loaded when needed rather than keeping every tool definition in the agent's active context.
The API also supports programmatic tool calling, allowing agents to execute calls in parallel, chain operations and filter or combine results before bringing relevant information back into context.
OpenAI says the Agents API supports MCP, custom functions and built-in tools such as web search.
Multi-agent workflows
Another major feature is support for subagents.
OpenAI says complex tasks can be divided into independent pieces and delegated to subagents that work in parallel.
Each subagent maintains its own context, while the main agent coordinates the overall workflow and combines the results.
For example, a software troubleshooting agent could potentially divide an investigation into separate deployment, error and dependency analysis tasks.
This changes the architecture from a single model handling every step sequentially to a coordinated system in which several specialised agent processes can work simultaneously.

The Codex connection
The Agents API is built around the Codex harness, which OpenAI describes as the infrastructure responsible for coordinating model calls, tools and context.
OpenAI says the harness is open source, allowing developers to inspect and learn from its public codebase, while OpenAI operates and maintains the version used by the Agents API.
This gives developers visibility into part of the architecture behind the agent orchestration layer rather than treating the entire system as a closed component.
What this means for developers
The announcement highlights a broader shift in AI development from building applications around individual model calls toward building systems that can continuously reason, use tools and execute work.
For developers, the attraction is reducing the amount of infrastructure required to create these systems.
Instead of separately implementing context management, tool orchestration, sandbox execution and subagent coordination, developers can use capabilities provided by the Agents API and concentrate more heavily on their application's tools, data and workflows.
For enterprises, the choice of execution environment could be equally important.
Applications can potentially combine OpenAI's agent orchestration with infrastructure that fits their existing architecture, depending on their requirements and the capabilities available through the API.
Public beta availability
OpenAI says the Agents API is available today in public beta to all developers.
The company says there are no additional fees specifically for using the Agents API. Developers pay for the tokens and tools their agents use according to OpenAI's pricing.
OpenAI also notes that the API will continue to evolve during the public beta as developers provide feedback.
The bigger picture
The Agents API represents another step toward treating AI agents as software infrastructure rather than simply conversational interfaces.
The important development is not only the ability to call a model. It is the combination of model reasoning with persistent sessions, tool access, execution environments, context management and coordinated subagents.
For developers experimenting with autonomous workflows, this could reduce the amount of custom infrastructure required to move from an AI prototype to a more complete agent system.
However, the API remains in public beta, so developers should evaluate its behaviour, operational requirements and evolving capabilities before depending on it for critical production workloads.
Source: OpenAI
About the Author