OpenAI has released an Agents API that manages sessions, orchestration, context compaction, and recovery for multi-step autonomous systems, while applications provide tools and choose their execution environment. The API supports both OpenAI-hosted sandboxes and self-hosted environments, with agents able to run code, edit files, connect to MCP servers, and delegate work to subagents.

The API is built around four core concepts: an Agent (the model, instructions, tools, and MCP servers), an Environment (an optional sandbox or computer where the agent accesses files and runs commands), a Session (a durable instance that works on tasks and responds to input), and Events and Items (inputs and outputs during a session). According to OpenAI's documentation, the managed harness supports running commands and code in a sandbox, applying relevant skills and instructions, connecting to external data through tools or MCP, steering the agent while it works, summarizing previous work to manage context window, breaking work into subtasks and delegating to subagents, and resuming a session where it left off.

A session workflow begins with creating a session and configuring the agent, after which OpenAI provisions the environment. The user then sends a task, which starts a turn of work once the environment is ready. Progress can be streamed or tracked via webhooks. The same session can receive additional tasks or be steered during its current turn. With an OpenAI-hosted session, the application sends input and receives events while OpenAI runs the agent and manages its sandbox.

The API documentation shows agents can be configured with multiple tool types: programmatic tool calling, MCP servers (via HTTP transport), and web search. Multi-agent mode can be enabled with a configurable maximum number of concurrent subagents. The example in the documentation uses gpt-6-astra as the model and shows agents can be given instructions to delegate independent research tasks to subagents when useful. Pricing follows the selected model's API rates, with OpenAI tools using standard rates and OpenAI-hosted sandboxes using standard container rates, though the documentation does not specify what those container rates are.

The API retains session state across turns, eliminating the need to rebuild conversation context between interactions. Sessions and published artifacts can be deleted when no longer needed. A significant operational constraint: the Agents API currently supports data residency only in the United States and does not support Zero Data Retention. Choosing a self-hosted sandbox does not make the API ZDR-eligible, meaning teams with strict data residency or retention requirements outside the US cannot use this service.

For teams evaluating whether to build on OpenAI's platform or self-host, the trade-off is clear: OpenAI handles session management, context compaction, and recovery, but you accept US-only data residency and standard retention policies in exchange.