OpenAI introduced the Agents API on September 10, 2026 as a new way for developers to build and run long-running cloud AI agents. The service is currently in public beta.
Instead of requiring developers to build every part of an agent loop themselves, OpenAI manages important infrastructure such as orchestration, session state, context compaction, and recovery.
As a result, developers can focus more on the tools, business logic, permissions, and workflows that make their agents useful.
If you are new to autonomous systems, first read our AI Agents Explained guide to understand how agents differ from normal AI chatbots.
What Is the OpenAI Agents API?
The OpenAI Agents API gives applications access to a managed version of the Codex harness.
In simple terms, the harness is the system that helps an AI agent continue working across multiple steps instead of answering only one prompt at a time.
OpenAI manages:
- agent orchestration
- durable sessions
- context management and compaction
- recovery
- tool coordination
- long-running execution
Meanwhile, developers control their application, tools, integrations, permissions, and execution environment.
Therefore, the Agents API sits between a simple model API call and a completely custom agent infrastructure.
Why Did OpenAI Launch the Agents API?
Traditional AI APIs are excellent for sending a request and receiving a response.
However, advanced agents often need much more.
For example, an agent may need to inspect files, run code, call tools, research information, ask another agent for help, save intermediate results, and continue working for an extended period.
OpenAI says its experience operating Codex and agent-based products showed that reliable agents need infrastructure for managing context, tools, subagents, files, and long-running tasks.
The Agents API packages much of that infrastructure into a managed service.
How Does the OpenAI Agents API Work?
A simplified workflow looks like this:
User Request → Agent Session → AI Model → Tools → Sandbox → Results
First, your application creates or continues an agent session.
Next, the agent interprets the task and decides what actions are required.
Then, depending on the workflow, it can use connected tools, MCP servers, code execution, files, or other capabilities.
Finally, the agent returns progress and results to your application.
Because sessions are durable, work can continue across multiple turns instead of restarting from zero each time.
Durable Agent Sessions
One of the most important Agents API features is durable sessions.
Traditional API requests are usually short-lived. In contrast, an agent may need to continue the same project across multiple steps.
OpenAI manages the session state so the agent can continue working while maintaining relevant context.
Furthermore, the system can compact context during long sessions. This helps prevent the conversation history from growing inefficiently as the task becomes larger.
For long-running automation, this is particularly useful.
OpenAI-Hosted Sandboxes
Agents can also work inside sandboxes.
An OpenAI-hosted sandbox can allow the agent to:
- execute code
- work with files
- install packages
- produce artifacts
- use configured skills
- perform development-related tasks
OpenAI provisions and manages these environments for developers who choose the hosted option.
However, developers are not forced to use OpenAI-hosted execution.
The Agents API can also connect to infrastructure provided by the developer or supported sandbox providers.
That flexibility can be useful for companies with specific infrastructure or security requirements.
Tool Use and MCP Support
Modern AI agents become far more useful when they can interact with external systems.
The Agents API supports connecting tools and MCP servers.
MCP, or Model Context Protocol, can help agents communicate with external tools and services through standardized interfaces.
For example, an agent could potentially connect to:
- internal business systems
- databases
- productivity tools
- development environments
- search systems
- custom APIs
OpenAI’s documentation specifically notes that developers can connect their own tools and MCP servers to agent workflows.
This capability makes the Agents API relevant for business automation rather than only chatbot development.
Subagents and Parallel Work
Another major feature is support for subagents.
A complex task can sometimes be divided into smaller jobs. Instead of one agent performing every task sequentially, multiple subagents can work on different parts.
For example, one subagent could analyze technical documentation while another examines data. The primary agent could then combine both results.
OpenAI highlights subagent coordination as one of the core capabilities of the managed Codex harness.
Consequently, agent systems can become more efficient for research and complex multi-step work.
OpenAI Agents API vs Responses API
Developers now have several ways to build agentic applications with OpenAI.
| Option | Best suited for |
|---|---|
| Agents API | Managed long-running agent applications |
| Codex SDK | Running the Codex harness in your own infrastructure |
| Responses API | Direct model calls and custom agent loops |
OpenAI currently recommends the Agents API as the starting point for new managed agent applications.
The Responses API remains useful when developers want more direct control over application logic and the agent loop.
Therefore, the correct option depends on how much infrastructure you want OpenAI to manage.
Agents API vs Agents SDK
The names can be confusing.
The Agents API is the newer managed cloud agent runtime.
Meanwhile, the Agents SDK is an SDK developers can use when building agent applications themselves.
OpenAI’s current documentation says the Agents SDK remains supported for maintenance, security fixes, important bug fixes, and compatibility work. However, major new functionality is not currently planned for it.
For new managed agent applications, OpenAI recommends starting with the Agents API.
That distinction is important for developers starting new projects in 2026.
What Can You Build With the Agents API?
The platform can support many types of advanced automation.
Coding Agents
An agent can inspect files, modify code, run programs, test changes, and continue working through multi-step software development tasks.
This makes the API particularly relevant for development assistants and automated engineering workflows.
Research Agents
A research agent could gather information through connected tools, divide a research problem among subagents, compare results, and produce a structured report.
Data Analysis Agents
OpenAI provides examples involving data-analysis agents.
An agent could receive datasets, write analysis code, execute that code in a sandbox, review results, and create outputs.
Customer Support Agents
Companies could connect an agent to documentation and internal systems.
The agent could investigate a customer request, retrieve relevant information, and assist with repetitive support processes.
For related options, see our Best AI Chatbots for Customer Support guide.
Incident Response Agents
OpenAI also provides an example of an incident-response agent that can investigate alerts and request approval before performing recovery actions.
Human approval is particularly important for workflows that can affect production systems.
OpenAI Agents API Pricing
There is currently no separate Agents API platform fee.
Instead, developers pay for the resources their agents actually use.
This can include:
- selected AI model usage
- OpenAI tool usage
- hosted sandbox/container usage
OpenAI’s official documentation states that model usage follows the selected model’s normal API pricing. OpenAI tools use their standard rates, while hosted sandboxes use standard container rates.
Therefore, two agents using the same API can have very different operating costs depending on how long they run and which models and tools they use.
Is the Agents API Free?
Using the Agents API itself does not currently carry an additional API-specific fee.
However, that does not mean operating an agent is free.
You still pay for resources such as model tokens, tools, and OpenAI-hosted sandbox usage when applicable.
Consequently, developers should monitor usage carefully when running long-lived or high-volume agents.
Security and Human Approval
Powerful agents can perform actions rather than simply generating text.
For that reason, developers should design clear guardrails.
Sensitive workflows may require:
- restricted permissions
- limited tool access
- secret management
- audit logs
- spending controls
- approval before important actions
- validation of generated output
For example, a business should avoid giving an autonomous agent unrestricted access to financial systems or production infrastructure without appropriate safeguards.
Human approval remains especially important for irreversible or high-impact actions.
Advantages of the OpenAI Agents API
One major advantage is reduced infrastructure work.
OpenAI handles several difficult parts of operating long-running agents, including session orchestration, context compaction, and recovery.
In addition, developers can use sandboxes, external tools, MCP servers, and subagents.
Another benefit is flexibility. Teams can choose OpenAI-hosted execution or connect other supported infrastructure.
As a result, developers can spend more time designing the actual business workflow.
Limitations to Consider
The Agents API is currently in public beta. Therefore, developers should expect the platform to continue evolving.
Long-running agents can also become expensive if they use large models, many tool calls, or compute-heavy sandboxes.
Moreover, autonomy creates additional security considerations.
Agents should be tested carefully before receiving access to sensitive systems.
Finally, complex workflows still require good tool design, clear instructions, evaluations, and monitoring.
Who Should Use the OpenAI Agents API?
The platform is especially relevant for:
- AI developers
- SaaS companies
- automation agencies
- software teams
- data teams
- internal enterprise automation
- agent-based products
Small businesses usually will not need to interact directly with the API unless they are developing custom automation.
Instead, they may use software that is built on top of agent infrastructure.
Our Best AI Automation Tools for Small Businesses guide covers more ready-to-use options.
OpenAI Agents API vs a Normal Chatbot
A normal chatbot mainly responds to messages.
An agent can potentially continue working toward an objective.
For example:
Chatbot:
“Here are some suggestions for analyzing this dataset.”
Agent:
“Upload the dataset. I will inspect it, write analysis code, run it, review the results, and produce a report.”
That ability to combine reasoning, tools, code execution, files, and persistent sessions is what makes agent systems different.
Is the OpenAI Agents API Worth Using in 2026?
For developers building serious agent workflows, the Agents API is an important addition to OpenAI’s platform.
It reduces the need to build orchestration and long-running session infrastructure from scratch.
Furthermore, integration with sandboxes, MCP servers, and subagents creates a foundation for more capable automation.
However, the service is still in public beta.
Therefore, production teams should evaluate reliability, security, usage costs, and permission boundaries carefully before deploying high-impact workflows.
Overall, the Agents API shows where AI development is moving: from applications that simply answer questions toward systems that can perform multi-step work.
Frequently Asked Questions
What is the OpenAI Agents API?
The OpenAI Agents API is a managed API for building durable cloud AI agents using the Codex harness. OpenAI manages orchestration, sessions, context compaction, and recovery.
When was the Agents API launched?
OpenAI launched the Agents API in public beta on September 10, 2026.
Can Agents API agents run code?
Yes. Agents can work in sandboxes where they can execute code, work with files, and produce artifacts.
Does the Agents API support MCP?
Yes. OpenAI says developers can connect their own tools and MCP servers to Agents API workflows.
How much does the OpenAI Agents API cost?
There is no separate Agents API fee at present. Developers pay for the selected model, tools, and hosted sandbox/container resources they use.
Should new developers use Agents API or Agents SDK?
OpenAI currently recommends starting with the Agents API for new applications that need a managed agent runtime.
Conclusion
The OpenAI Agents API provides developers with a managed foundation for building more capable AI agents.
Rather than manually creating orchestration, session management, context handling, and recovery systems, developers can rely on the Codex harness while focusing on tools and application logic.
Features such as durable sessions, sandboxes, MCP connections, and subagents make it suitable for coding, research, data analysis, customer support, and other advanced workflows.
Nevertheless, businesses should treat autonomous execution carefully. Strong permissions, monitoring, evaluations, and human approval remain important when agents can interact with real systems.
