← All articles

OpenAI Agents API: Managed Cloud Agents, Sandboxes, and Pricing

OpenAI's Agents API puts the Codex agent harness behind one API. Learn how sessions, sandboxes, tools, multi-agent work, pricing, and security fit together.

OpenAI launched the Agents API in public beta on September 10, 2026. It packages the agent harness behind Codex into an API, so developers can start a durable agent session, choose a model and environment, connect tools, and receive structured progress without assembling every orchestration component themselves.

The important shift is operational. A conventional model call returns an answer. An agent session can inspect files, use tools, modify an environment, delegate work, pause for input, and continue over a longer period. That makes the API useful for software engineering, research, operations, data work, and other multi-step workflows—but it also makes permissions, isolation, monitoring, and acceptance testing essential.

Source note: This guide reflects OpenAI’s launch announcement and Agents API documentation available on September 11, 2026. The product is in public beta, so endpoints, supported models, limits, partner availability, and pricing can change. Confirm the current official documentation before production use.

OpenAI Agents API at a glance

The Agents API provides a managed control plane for agent work. A developer can define the task, model, tools, and execution environment in one API workflow, then observe session events and continue the session as needed.

OpenAI’s current documentation includes:

  • persistent sessions for multi-step work;
  • OpenAI-hosted or self-hosted sandboxes;
  • files and artifacts produced during a run;
  • web search, functions, MCP connections, plugins, and vaults;
  • multi-agent delegation;
  • webhooks, tracing, usage data, and observability;
  • long-running context management and compaction;
  • security guidance for isolated execution environments.

The API is available to all developers during the public beta. OpenAI says there is no additional Agents API fee at launch: customers pay for model tokens and billable tools. That does not mean an agent workflow is free. Hosted infrastructure, third-party environments, external APIs, storage, network traffic, and human review can still affect total cost.

How an Agents API session works

A useful mental model is a session with four connected layers.

1. The agent harness

The harness decides how the model works through a task: which context it needs, when to call a tool, how to react to results, and when to report completion or request input. OpenAI says the API is built on the open-source Codex harness, giving developers a managed route to the same general execution pattern.

2. The execution environment

The agent needs somewhere to inspect and change state. OpenAI offers hosted sandboxes and documents self-hosted environments. The launch announcement also names environment partners including Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop, and Vercel.

Choose the environment based on data sensitivity, required software, network access, regional needs, startup time, and recovery requirements. A hosted sandbox can reduce infrastructure work; a controlled environment may be a better fit when the workload must stay near private systems.

3. Tools and data connections

Agents become useful when they can search, read files, call business systems, or operate development tools. The Agents API supports first-party tools plus function calls, MCP connections, plugins, and vault-backed credentials.

Every connection expands authority. Give an agent the smallest tool set and data scope required for its task. Separate read access from write access, require approval for consequential changes, validate destinations, and never assume a model-generated tool argument is safe simply because it is well formatted.

4. Events, artifacts, and continuation

Long-running work needs more than a final text response. The API exposes session events and items, supports webhooks, and preserves artifacts so an application can show progress, recover after interruption, or ask a user for a decision.

Design the product around real states such as queued, running, waiting for approval, failed, cancelled, and accepted. “The agent stopped” is not the same as “the requested outcome was verified.”

Why managed sandboxes matter

An agent that can execute commands or edit files needs containment. Sandboxes provide a controlled boundary for the filesystem, processes, dependencies, and network access used during a run.

For production, define:

  • what files are mounted and whether they are read-only;
  • which domains or services the environment can reach;
  • where secrets are injected and whether the agent can reveal them;
  • maximum runtime, storage, memory, and spend;
  • how the environment is destroyed or reused;
  • what logs and artifacts are retained;
  • how untrusted repository or webpage instructions are handled.

A sandbox reduces blast radius; it does not replace application-level authorization. An isolated agent can still send a harmful API request if it holds an overpowered credential.

Multi-agent work: useful, but not automatically better

The Agents API supports delegation to subagents. This can improve throughput when a large task contains independent, clearly bounded pieces—for example, researching separate sources or testing different modules.

More agents also mean more model calls, more tool activity, and more state to reconcile. Use delegation when the parallel work is genuinely independent. Set a maximum number of workers, token and tool budgets, cancellation behavior, and a final acceptance step owned by the parent workflow.

The parent should combine evidence, identify contradictions, and verify the requested result. Five confident agent summaries do not equal one end-to-end test.

Pricing: calculate the full workflow

The launch pricing statement is straightforward: no separate charge for the Agents API during beta; model tokens and billable tools are charged normally.

Estimate more than tokens. Include:

  • sandbox or partner compute;
  • external API and database usage;
  • web search and other paid tools;
  • artifact storage and log retention;
  • repeated attempts and recovery runs;
  • human approvals and review time;
  • observability and evaluation infrastructure.

Track cost per accepted outcome, not only cost per run. A low-cost run that produces an unverified change may create more expense in review and remediation than a better-scoped workflow with stronger checks.

Where the API could create value

Good early projects have a measurable result and a reversible operating boundary:

  • prepare a pull request from a well-defined engineering issue;
  • research a market or vendor set and attach source evidence;
  • classify operational requests and draft proposed actions;
  • transform files using a fixed schema and validation suite;
  • investigate a support case without changing the customer account;
  • run scheduled maintenance checks and notify only on meaningful changes.

The Hermes and OpenClaw agent setup shows the broader value of giving an agent clear infrastructure, tools, and operational boundaries. The same principle applies to the Agents API: useful autonomy comes from a carefully designed system, not from an unrestricted prompt.

A safe pilot plan

Start with one workflow that a person can currently complete and verify.

  1. Write a precise success condition and list prohibited actions.
  2. Give the agent read-only access first.
  3. Use a disposable sandbox with narrow network rules.
  4. Add one tool at a time and log every call.
  5. Build deterministic checks for files, schemas, tests, or downstream state.
  6. Require approval immediately before external writes or production changes.
  7. Test interruption, timeout, cancellation, duplicate execution, and recovery.
  8. Compare quality, time, cost, and failure rate against the existing process.

Public beta is the right time to prototype and measure. It is not a reason to give an untested agent broad production authority.

How I can help

I provide AI consulting and custom AI development for teams evaluating the Agents API, designing tool and sandbox boundaries, connecting business systems, and building evaluation and observability into the first release.

I can also deliver the surrounding product through SaaS product engineering, workflow automation, website development, and mobile app development.

Book a free strategy call to scope a focused agent pilot around a real workflow and a measurable acceptance test.

Official sources

FAQ

Frequently asked questions

What is the OpenAI Agents API?

The Agents API is a public-beta API that lets developers run the Codex agent harness with managed sessions, environments, tools, files, and multi-agent orchestration. A request can run in an OpenAI-hosted sandbox, a self-hosted environment, or a supported partner environment.

Is the Agents API generally available?

No. OpenAI launched the Agents API in public beta on September 10, 2026. Developers should expect the interface and limits to evolve and should use staged rollouts, observability, and rollback plans.

How is the Agents API priced?

OpenAI says there is no separate Agents API fee during the public beta. Customers pay for model tokens and any billable tools they use. Infrastructure, partner sandboxes, storage, networking, and external services may add separate costs.

Can the Agents API use MCP and custom tools?

Yes. OpenAI documents MCP connections, function tools, plugins, web search, vaults, and other integrations. Every tool still needs narrow permissions, validated inputs, output checks, and an audit trail.

Does the Agents API support multiple agents?

Yes. It supports multi-agent workflows in which a primary agent can delegate bounded tasks to subagents. Teams should set clear scopes, concurrency limits, budgets, cancellation rules, and acceptance checks.

Need help with AI consulting and custom development?

Turn the idea into a working system.