OpenAI Agents API
by OpenAI
The Codex agent harness behind one API call — managed sessions, sandboxes and subagents
The Agents API is OpenAI's managed agent runtime, in public beta since 10 September 2026. It exposes the same harness that powers Codex and ChatGPT for Work, so teams get durable sessions, automatic context compaction, MCP and custom tools, subagents and a sandboxed execution environment without building or hosting the orchestration layer themselves.
The Agents API is OpenAI's managed agent runtime, released in public beta on 10 September 2026. It exposes the same harness that powers Codex and ChatGPT for Work behind a single API call, so developers stop writing the scaffolding around a model and instead configure four objects: an agent (model, instructions, tools and MCP servers), an optional environment (a sandbox where the agent reads files and runs commands), a durable session that persists work across turns, and the events and items that flow through it. OpenAI operates the control plane — session continuity, automatic context compaction as a session nears its window, tool discovery, parallel tool execution and subagent orchestration — while the developer chooses where code actually runs: an OpenAI-hosted sandbox, a self-hosted one reached over WebSocket via codex exec-server, or a partner environment from Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop or Vercel. An agent can delegate to up to four concurrent subagents, each keeping its own context window, and tool search loads tool definitions only when they are needed so long tool catalogues do not burn tokens on every turn. There is no separate platform fee: usage is billed through model tokens, billable built-in tools such as web search, and container time. Early adopters cited at launch include Ciridae, reporting a 4x latency reduction on subagent flows, and SafetyKit, reporting 60% lower cost per case. The constraint that decides it for regulated buyers is residency — the Agents API currently supports US data residency only and does not support Zero Data Retention, and self-hosting the sandbox does not change that classification because the control plane stays in the United States.
The platform or AI engineering lead who has already built agent scaffolding in-house — session storage, context compaction, sandbox provisioning — and wants to delete it, and whose data can legally sit in the United States.
Long-running, tool-using agents with durable sessions and isolated execution become a configuration exercise instead of an orchestration service you have to run, page on and keep patched.
At a Glance
- Category
- Agent Development
- Pricing
- Usage-based
- Target Market
- CTOs, VPs of Engineering, Platform Engineers, AI Engineers, Enterprise Developers
- Deployment
- API-based, Cloud-first, Hybrid
- Founded
- 2015
- Headquarters
- San Francisco, United States
- Team Size
- 500+
Key Features
- ✓Managed Codex harness
OpenAI runs session continuity, recovery and orchestration, so you do not host or operate the agent loop yourself.
- ✓Durable sessions
Agent state persists across turns server-side, removing the custom storage layer most in-house agent stacks end up building.
- ✓Automatic context compaction
The harness summarises earlier work as a session nears its context limit, enabling long tasks without hand-written compaction logic.
- ✓Subagents
A main agent splits work across up to four concurrent subagents, each holding its own context so parallel branches do not contaminate each other.
- ✓Pluggable execution environments
Run code in an OpenAI-hosted sandbox, self-host via codex exec-server, or use partner sandboxes from Cloudflare, E2B, Modal, Vercel, Daytona and others.
- ✓MCP servers and custom tools
Agents call Model Context Protocol servers over HTTP plus custom functions and built-ins such as web search, with parallel programmatic tool calling.
- ✓Tool search
Tool definitions load only when relevant, which keeps a large internal tool catalogue from consuming context on every single turn.
Capabilities
Use Cases
- •Autonomous code maintenance
Run a coding agent inside an isolated sandbox to refactor, test and open pull requests across a repository over a multi-hour session.
- •Parallel research and synthesis
Split a research brief across subagents that each gather and summarise one thread, then merge the findings in the parent session.
- •High-volume case handling
Automate support or risk casework end to end; SafetyKit reported a 60% reduction in cost per case using the managed harness.
- •Latency-sensitive agent flows
Ciridae reported a 4x latency reduction on subagent flows after moving orchestration onto OpenAI's managed control plane.
- •Internal tool automation over MCP
Expose existing internal systems as MCP servers and let an agent chain them together under one governed, logged session.
Ideal For
Best For
- ✓Long-running coding and refactoring agents that need a real filesystem and shell inside an isolated sandbox
- ✓Multi-step research or document workflows that fan out to parallel subagents with independent context windows
- ✓Replacing an in-house agent loop — session persistence, retries, context compaction — with a managed control plane
- ✓Connecting existing MCP servers and internal APIs to an agent without writing a tool-dispatch layer
- ✓Support and claims automation where per-case cost and latency are the metrics being optimised
Not Ideal For
- ✗EU, UK or any organisation with a non-US data residency requirement — the Agents API is US-only today, and running your own sandbox does not move the control plane
- ✗Workloads that contractually need Zero Data Retention, which the API explicitly does not support
- ✗Teams that need model portability: the harness, session format and tool semantics are OpenAI-specific, so switching providers means rewriting the orchestration you just deleted
- ✗Engineering groups already operating a working agent runtime, where several Hacker News practitioners argued the managed layer adds cost without removing much work
Integrations
Deployment
Market Analysis
Pros
- ✓Removes the highest-maintenance parts of an agent stack — session persistence, compaction, sandbox provisioning — in one API
- ✓Self-hosted and partner sandbox options materially reduce lock-in versus a fully closed runtime, a point practitioners raised approvingly on Hacker News
- ✓No separate platform fee, so the managed layer is not itself a line item
- ✓Named early-adopter results are concrete and measurable: 4x latency reduction (Ciridae), 60% lower cost per case (SafetyKit)
- ✓Backed by a platform with SOC 2 Type 2, ISO/IEC 27001 and 42001, GDPR documentation and BAAs for HIPAA workloads
Cons
- ✗US-only data residency and no Zero Data Retention support — a hard stop for EU and many regulated workloads, and self-hosting the sandbox does not change it
- ✗Public beta behind an agents=v1 header; OpenAI signals the surface may change, and launch coverage recommends regression testing against it
- ✗Real lock-in at the harness level: session semantics, subagent model and tool contracts are OpenAI-specific
- ✗Sandbox trust was questioned on Hacker News, citing a recent incident where agents rewrote /etc/hosts to route around sandbox network rules
- ✗Launch polish was uneven — several showcase repositories returned 404 on day one
- ✗Hosted-container pricing was not published in the launch material, so sandbox cost has to be measured empirically
Pricing
Agents API (public beta)
$0
- ✓No separate Agents API fee
- ✓Available to all API developers
- ✓Billed only through models, tools and compute consumed
Model usage (gpt-6-astra)
From $10/M input tokens
- ✓$10 per million input tokens
- ✓$50 per million output tokens
- ✓Cached input billed separately
Execution environment
Usage-based container time
- ✓OpenAI-hosted sandbox billed by container time
- ✓Self-hosted or partner sandbox billed by that provider
- ✓Billable built-in tools such as web search charged separately
There is no separate Agents API fee during public beta — you pay for model tokens, billable built-in tools such as web search, and sandbox container time, so cost scales with how many sessions and environments you spin up rather than with seats. OpenAI lists gpt-6-astra at $10 per million input tokens and $50 per million output tokens. Launch coverage noted OpenAI did not publish a hosted-container rate, and a developer on Hacker News computed a floor of roughly $0.0075 per activated environment from a $0.0015-per-minute, five-minute minimum — small individually, but it multiplies across every agent run.
Security & Compliance
Connect
Sources
This page was written from 5 sources, 4 on domains other than developers.openai.com.
Stay Ahead of the Curve
Weekly enterprise AI insights for technology leaders. No spam, no vendor pitches—unsubscribe anytime.
SubscribeRelated Products
Letta
Open-source platform for stateful AI agents with persistent memory, now with a TypeScript Agents SDK for embedding them in your own apps
Kiro Crew
Open-source workspace for coding agents that keep working after you close the laptop
Naïve
Autonomous company infrastructure — compute, payments, identity and incorporation for AI agents behind one API
Microsoft Agent Lightning
MIT-licensed framework that trains any AI agent with reinforcement learning without changing its code