OpenAI has released the Agents API in public beta. The service gives developers access to the same infrastructure that runs Codex. OpenAI hosts and maintains the harness. Developers run the agent’s compute in an OpenAI-managed sandbox, their own infrastructure, or a partner sandbox.
In this article
Data stays US-only, and Zero Data Retention is unsupported.
What OpenAI shipped
The Agents API is a managed service built on the open-source Codex harness. The OpenAI team states that scaling Codex and ChatGPT for Work showed what long-running agents need. They need a harness that manages context, uses tools efficiently, and coordinates subagents. They also need infrastructure that keeps them running reliably for days.
The official docs organise the API around four concepts:
- Agent: the model, instructions, tools, and MCP servers available to it.
- Environment: an optional sandbox where the agent accesses files, loads skills, and runs commands.
- Session: a durable agent instance that works on tasks and responds to input.
- Events and items: the inputs sent to the agent and the output it produces.
A session runs in four steps. You create it and give it a task. Then you follow progress through streaming or webhooks. Finally, you continue with a new task or steer the current turn.
One API call
OpenAI’s announcement shows an incident-investigation agent created in a single call:
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 quickstart covers API key permissions and SDK setup.
Where the agent runs
Environment choice is the main architectural decision. The Agents API supports three sandbox options, and it can also run without a sandbox.
- OpenAI-hosted sandbox: uses the sandboxing infrastructure behind Codex and ChatGPT. You can configure it with files, packages, skills, and plugins.
- Self-hosted: you run codex exec-server inside your environment. It registers with a restricted key and connects over WebSocket. All connections are outbound.
- Partner sandboxes: Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop, and Vercel have first-class integrations.
What the harness handles
OpenAI maintains the harness alongside its models, with versioned access at each model launch.
- Long sessions: The API automatically compacts earlier context as a session nears its limit. Developers do not write their own compaction logic.
- Efficient tool use: Tool search loads tool definitions only when needed. This reduces token usage and cost while preserving the model’s cache. Programmatic tool calling lets agents run calls in parallel and chain operations. Agents filter or combine results in code, so only relevant data returns into context. Supported tools include MCP, custom functions, and built-in tools like web search.
- Subagents: With multi-agent support, the main agent splits complex tasks into independent pieces. Each subagent keeps its own context. The main agent coordinates them and combines the results.
Agents API versus Agents SDK versus Responses API
OpenAI’s runtime comparison positions the three options this way:
| Agents API | Agents SDK | Responses API | |
|---|---|---|---|
| Where the agent runs | OpenAI runs a managed Codex harness | Inside your application | Your application, with optional hosted orchestration |
| Integration effort | Low | Medium | High |
| State between tasks | Saved session configuration, turns, and items | Your storage and SDK sessions | Manual history, response chaining, or Conversations |
| Execution environment | OpenAI-hosted, self-hosted, or no sandbox | Your runtime and sandbox providers | Your own environment |
Early customer results
OpenAI published these customer-reported numbers. They are vendor-supplied, not independent benchmarks.
- Ciridae: evaluation score rose from 0.71 to 0.85, with a 4x latency reduction on subagent flows.
- SafetyKit: 60% lower cost per case after migrating its case review workflow.
- Hypha: 86% fewer failed agent responses after separating the harness from the sandbox.
- Nash.ai: runs thousands of long-running agents across global logistics networks.
What it means
Builders now have a standard way to run long tasks without managing the underlying complexity themselves. The service handles context management and tool execution automatically. You define the task and the tools, then wait for the result. This removes the need to write custom code for memory management or tool orchestration.
There is no extra fee; you pay for tokens, tools, and container time.
US-only data residency and no ZDR limit regulated workloads for now.



