OpenAI’s New API Lets Anyone Build Long-Running AI Search Agents With Web Retrieval and Subagents

OpenAI’s New API Lets Anyone Build Long-Running AI Search Agents With Web Retrieval and Subagents
Sponsored

OpenAI is making the infrastructure behind its long-running agents available to developers. The new Agents API, now in public beta, packages the agent harness and cloud infrastructure used by Codex into an API that can manage persistent sessions, search the web, connect to MCP servers, call custom functions, run tools in parallel and delegate independent pieces of a task to subagents.

The company announced the Agents API on September 10, 2026, describing it as a way to build and run cloud agents without recreating the orchestration layer required to keep them working reliably for hours or days. Developers specify the task, model, tools and execution environment while OpenAI hosts and maintains the harness.

For search and research applications, the most important shift is that web retrieval is no longer just a one-shot tool call inside a short interaction. Developers can build agents that search, inspect results, call other systems, divide research among subagents, preserve intermediate work and continue across multiple context windows. That makes the API relevant not only to coding automation but to monitoring, investigation, research and other workflows where finding information is one step in a longer process.

The API exposes the harness, not just the model

Calling a language model and building a reliable agent are different engineering problems. A model can decide what to do next, but a production agent also needs context management, tool selection, execution infrastructure, file handling, recovery and orchestration. Those systems become increasingly important as a task grows from seconds to hours.

OpenAI says the Agents API provides the same harness and infrastructure behind Codex. Instead of manually building a loop that sends prompts, receives tool calls, executes them and reconstructs context, developers can create an agent session through the API and let the managed harness coordinate the workflow.

The abstraction is deliberately broader than a traditional “assistant” endpoint. A session can include a model, a collection of tools, multi-agent configuration, access to stored knowledge or secrets and a compute environment where the agent can work with files and run code. The agent can then create intermediate outputs and continue operating rather than returning a single response and disappearing.

Web search becomes one tool inside a persistent research process

OpenAI lists web search among the built-in tools supported by the Agents API. That gives developers a direct route to building agents whose work depends on current public information, such as competitive research, market monitoring, due diligence, news analysis or technical investigation.

The difference from a basic search integration is orchestration. A long-running research agent can search for an initial topic, identify gaps, launch follow-up searches, combine public information with private systems through MCP, run calculations or code, and save its findings into files. The web is one evidence source in a larger workflow rather than the endpoint of the application.

That architecture can support more sophisticated search products. An agent investigating a market, for example, could delegate company research to several subagents, ask each to gather evidence independently, then have the main agent reconcile conflicting findings and produce a final report. The developer does not have to build the entire parallel orchestration layer from scratch.

MCP and custom functions open the agent to external systems

The API supports Model Context Protocol connections alongside custom functions. MCP gives an agent a standardized way to discover and use capabilities exposed by compatible servers, while custom functions allow developers to connect application-specific operations that do not need to be packaged as MCP services.

This combination is important because useful agents rarely operate only on model knowledge. A support agent may need an internal ticketing system, a research agent may need proprietary databases, and an operations agent may need observability or deployment tools. The API allows those capabilities to sit beside OpenAI's built-in web search in the same agent configuration.

The developer remains responsible for deciding which systems the agent can access and what actions those tools permit. Making tool orchestration easier does not remove the need for authorization, validation and human approval around sensitive operations. The more persistent and autonomous the workflow becomes, the more important those boundaries are.

Programmatic tool calling can parallelize large workloads

OpenAI is also introducing programmatic tool calling as part of the harness. According to the announcement, agents can execute calls in parallel, chain related operations and filter or combine results in code before returning only the relevant information to the model's context.

That addresses a practical limitation of tool-heavy agents. If every raw result from every API call has to be inserted into the language model's context, large investigations can become expensive and noisy. Programmatic processing lets the agent perform more of the mechanical work outside the model's active context and bring back the information that matters.

Parallelism also changes latency. An agent researching ten independent entities does not necessarily need to investigate them sequentially. Where tasks do not depend on one another, tool calls can fan out concurrently and their outputs can be combined later. For applications built around search, data gathering or repeated validation, that can make the difference between an impressive demo and a usable workflow.

Subagents provide a managed form of multi-agent orchestration

The Agents API includes native multi-agent support. A main agent can break a complex assignment into independent pieces and delegate them to subagents that work in parallel. Each subagent maintains its own context, while the parent agent coordinates the overall task and synthesizes the outputs.

This is useful because large tasks often contain several different cognitive workloads. A technical incident investigation might assign deployment history, error logs and dependency health to separate subagents. A research agent might divide a topic by company, geography or evidence type. A coding agent could separate implementation, testing and review.

Keeping those contexts separate can reduce interference. A subagent focused on one assignment does not need to carry every detail collected by the rest of the team. The main agent receives the distilled results and can decide whether another round of work is required.

OpenAI's launch example enables three concurrent subagents to investigate different aspects of an elevated service error rate. The company says the managed multi-agent layer can accelerate research, analysis and coding without requiring developers to build their own orchestration system.

Automatic context compaction targets sessions that last for hours

Long-running agents eventually encounter a fundamental model constraint: context windows are finite. A session that repeatedly searches, reads files, calls tools and generates intermediate results can accumulate far more history than the model can process in one request.

The Agents API addresses this with automatic context compaction. As a session approaches its context limit, the harness compacts earlier material while preserving information needed to continue the task. OpenAI says this lets developers build workflows spanning multiple context windows without implementing their own compaction logic.

That feature is central to the “long-running” claim. Persistence is not merely storing a conversation ID. The system has to decide which earlier facts, decisions, artifacts and constraints remain relevant after thousands of intermediate operations. Poor compaction can make an agent forget an important requirement or repeat completed work, while retaining everything defeats the purpose of managing context.

OpenAI does not claim that automatic compaction makes agent memory infallible. Developers building high-stakes systems should still externalize important state, preserve durable artifacts and validate outputs rather than assuming every detail from an hours-long session will remain perfectly represented in the model's active context.

Tool search tries to keep large tool catalogs manageable

Another scaling problem appears when an agent has access to many tools. Loading every tool definition into every model call consumes tokens and can make selection harder. OpenAI's tool search capability dynamically loads relevant tool definitions as needed, which the company says can reduce token usage and cost while preserving the model's cache.

This becomes particularly relevant for enterprise agents connected to broad MCP ecosystems. An agent may technically have access to dozens or hundreds of operations but need only a small subset for a given task. Discovering the relevant capability on demand is more efficient than presenting the entire catalog at every step.

Together, tool search and programmatic calling show that the API is addressing the less visible parts of agent engineering: not just whether a model can use a tool, but how to keep tool use economical and tractable as the application grows.

Developers can choose where the agent runs

The Agents API separates the managed harness from the execution environment. OpenAI says developers can run agents in an OpenAI-hosted sandbox, on their own infrastructure or through supported sandbox partners. The company names Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop and Vercel among its ecosystem partners.

The new OpenAI-hosted sandbox provides an environment where an agent can run code, manipulate files and create artifacts. Developers can configure it with their own files, packages, skills and plugins. Other deployment options can offer different CPU, GPU, memory, storage, networking and VPC requirements.

This separation matters for organizations that want the managed orchestration layer but cannot move every workload into the same execution environment. Security, data residency, networking and performance requirements can all affect where an agent should actually run its tools.

The foundation is the open-source Codex harness

OpenAI says the Agents API is powered by the open-source Codex harness. The company operates and maintains the managed version, while developers can inspect the public code that coordinates models, tools and context.

That gives teams two related options: consume the managed Agents API when they want OpenAI to operate the harness, or inspect the underlying approach when they need to understand how the orchestration works. The managed service also gives OpenAI a way to update the harness alongside new model releases without requiring every developer to redesign their agent loop.

This is a meaningful part of the product strategy. Model improvements alone do not automatically translate into better agents if the surrounding harness does not know how to use new capabilities. OpenAI is effectively productizing that orchestration layer as infrastructure that can evolve with its models.

Public beta is available to all developers

OpenAI says the Agents API is available in public beta to all developers. There is no separate Agents API fee; customers pay for the model tokens and tools their agents consume according to the applicable pricing. The company says it will iterate quickly during the beta before moving toward general availability.

That pricing model means the cost of an agent will depend heavily on its behavior. A short task with a few tool calls is fundamentally different from a session that runs for hours, launches multiple subagents and repeatedly searches the web. Automatic compaction and selective tool loading can improve efficiency, but developers will still need budgets, observability and limits around autonomous workloads.

The beta label also matters for production planning. The API is available broadly, but developers should expect interfaces and behavior to evolve as OpenAI gathers feedback. Mission-critical applications will need testing around failure recovery, tool permissions, context preservation and cost before handing long-running workflows significant autonomy.

The Agents API shifts the unit of development from prompts to work

The larger significance of the launch is architectural. Early LLM applications were often built around a prompt and a response. Agent applications are increasingly built around a task that may require many model calls, searches, tools, files, decisions and retries before it is complete.

The Agents API attempts to make that task the primary unit. Developers describe what the agent should accomplish and provide the tools and environment, while the harness manages much of the ongoing coordination. Web search becomes retrieval capability, MCP becomes connectivity, custom functions become application actions, subagents become parallel labor and context compaction becomes the mechanism that keeps the process moving beyond a single model window.

That does not mean anyone can now deploy a reliable autonomous research agent with one line of code. Tool quality, permissions, evaluation, error handling, domain knowledge and human oversight still determine whether an agent is useful in production. A managed harness removes infrastructure work; it does not remove application design.

But the public beta makes a class of systems substantially easier to attempt. Developers can now build an AI search agent that keeps researching after the first query, delegates independent investigations, reaches into external systems and maintains a long-lived working session without implementing every piece of orchestration themselves. The API is less about giving a model one more tool and more about giving developers a managed runtime for agents that are expected to keep working until the job is actually done.

0%