OpenAI introduces Agents API for building AI agents
OpenAI has launched Agents API in public beta, allowing developers to build AI agents that can run code, use tools and work for extended periods. The platform includes automatic context management, subagents and managed or customizable execution environments.

OpenAI has just opened its Agents API to public beta. The tool lets developers build AI agents capable of working for hours or days, using tools, running code and coordinating tasks without having to build all that infrastructure from scratch.
The API brings to other products the technology OpenAI uses in Codex and ChatGPT for businesses. To create an agent, a developer defines the task, model, available tools and computing environment in a single call.
A work environment for agents
A useful agent needs more than a model that responds with text. It also needs to preserve context, manipulate files, run programs and save intermediate results. Agents API coordinates these pieces through a system OpenAI calls a harness, the layer that organizes the model's work.
Developers can choose where the agent runs:
- In an environment managed by OpenAI.
- On their own infrastructure.
- On services from partner providers such as Cloudflare, Vercel, Modal, Oracle or DigitalOcean.
These options make it possible to tailor the setup to each use case, with different combinations of memory, processors, GPUs, storage, security and cost. Some companies, for example, may run the agent inside their own private network, while others may prefer to start with an environment managed by OpenAI.
OpenAI is also introducing a company-managed sandbox. It is an isolated environment where the agent can run code, work with files and generate results, with packages, files, skills and add-ons that can be configured for each task.
Agents that work for longer periods
One problem with long sessions is that the model can run out of room to remember everything that has happened. Agents API includes automatic compaction: when the conversation approaches the context limit, it summarizes and reorganizes earlier information so the agent can continue.
This makes it possible to create workflows that span multiple context windows without requiring developers to program how important data is stored and retrieved.
The API also aims to reduce cost and clutter when an agent has many tools available. Tool search loads only the relevant definitions when they are needed. Programmatic calls can then run operations in parallel, chain them together and filter results before returning them to the model.
The platform supports MCP, custom functions and built-in tools such as web search.
Multiple agents for one task
Agents API supports dividing complex jobs among multiple subagents. A lead agent could assign information gathering to one, data analysis to another and code review to a third, for example.
Each subagent maintains its own context and works on its part while the lead agent coordinates the results. This can be useful for research, analysis and programming, where several independent tasks can run at the same time.
The system is based on Codex's open-source harness. OpenAI maintains and operates it within the API, but developers can inspect its code to understand how it coordinates models, tools and context.
Agents API is now available to all developers in public beta. It does not add a separate fee: users pay for the tokens and tools each agent uses, according to OpenAI's pricing.
For you, the important change is that creating an agent capable of working for extended periods no longer requires a complete infrastructure setup from day one. The real test will be reliability: whether it knows when to use a tool, preserves the right information and avoids wasting resources while carrying out complex tasks. During the beta, OpenAI will continue adjusting the system before its general release.