# OpenAI Agents API The OpenAI Agents API is a **managed agent service** from [[OpenAI]]. It went into public beta on September 10, 2026, for all developers. In short: it's the same harness that runs [[OpenAI Codex|Codex]] and ChatGPT for Work, available behind an API. You don't build the agent loop yourself. OpenAI runs it for you, and you plug in your instructions, tools, and compute environment. It's OpenAI's answer to [[Claude Managed Agents]]. ## Why this exists Building a good [[AI Agent Harness]] is a deep rabbit hole (see [[Harness Engineering]]). You need context management, tool execution, sandboxes, file handling, recovery from interruptions, parallel work... And every new model capability means reworking the harness. The Agents API is built for tasks that run for minutes, hours, or days. OpenAI maintains the harness and gives you versioned access to new capabilities with each model launch. ## The four core concepts - **Agent**: the model, instructions, tools, and MCP servers available to it - **Environment**: an optional sandbox where the agent accesses files, loads skills, and runs commands - **Session**: a durable agent instance that works on tasks and responds to input - **Events and items**: the inputs you send and the outputs the agent produces A session goes through four stages: create it with a task, monitor progress (streaming or webhooks), continue with follow-up tasks, and steer it while it's working. ## Built-in capabilities - **Compaction**: earlier context is compacted automatically as a session nears its limit - **Tool search**: tool definitions load only when needed, which saves tokens and money - **Programmatic tool calling**: the agent chains and parallelizes tool calls, and filters or combines the results - **[[AI Subagents|Subagents]]**: split complex work into subagents with their own context, coordinated by the main agent - **Tools**: [[Model Context Protocol (MCP)]] servers, custom functions, and built-in tools like web search ## Where the code runs This is the interesting design choice. The harness runs on OpenAI's side, **outside** the sandbox, and interacts with it when needed. So agent runs and compute scale independently. You pick the environment: - **OpenAI-hosted**: the same sandboxing infrastructure as Codex and ChatGPT, with configurable files, packages, skills, and plugins - **Self-hosted**: run `codex exec-server` in your own environment (e.g., your VPC). It connects outbound only, over a WebSocket with a restricted key - **Partner sandboxes**: Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop, and Vercel - Or no sandbox at all Keep in mind that even with a self-hosted sandbox, inference, session state, and tool call arguments still go through OpenAI. ## Pricing and limitations - No extra fee. You pay for tokens, tools, and container time - Data residency is **US-only** for now - **Zero Data Retention (ZDR) is not supported**. That's a blocker for many regulated workloads ## Agents API vs Agents SDK vs Responses API | | Agents API | [[OpenAI Agents SDK]] | Responses API | |---|---|---|---| | Where the loop runs | OpenAI (managed) | Inside your application | Your code | | Integration effort | Low | Medium | High | | State | Saved sessions | SDK sessions | You manage history | | Portability | Low | Medium | High | ## What Hacker News thought The thread (346 points) was mostly about **lock-in**: - Many developers prefer to own their harness (often built on open source harnesses like pi and herdr) so they can switch models freely. Open-weight models are often good enough and much cheaper for agentic work - Others pointed out that businesses value managed services for the same reasons they use AWS: security patching, scaling, and uptime become someone else's problem - Several people criticized the missing ZDR and the vague wording about what "don't train on my data" covers (e.g., reasoning traces) - One sharp comment: remote agents are backwards for many use cases. The hard part is accessing local data securely, and moving the agent to someone else's cloud makes that harder - Some remembered being burned when OpenAI retired the Assistants API in favor of the Responses API, and now avoid stateful APIs entirely My take: this is convenient, but it's the opposite of [[Bring your own model (BYOM)]]. You get OpenAI's models, OpenAI's harness, and OpenAI's data policies in one package. For prototypes and internal tools, fine. For anything strategic, I'd keep the orchestration in my own hands. ## References - Announcement: https://openai.com/index/introducing-the-agents-api/ - Hacker News discussion: https://news.ycombinator.com/item?id=49649213 - MarkTechPost coverage: https://www.marktechpost.com/2026/09/10/openai-launches-the-agents-api-in-public-beta-putting-the-codex-harness-behind-one-api-call/ ## Related - [[OpenAI]] - [[OpenAI Agents SDK]] - [[OpenAI Codex]] - [[Codex Cloud]] - [[Claude Managed Agents]] - [[AI Agent Harness]] - [[Harness Engineering]] - [[AI Subagents]] - [[Model Context Protocol (MCP)]] - [[Bring your own model (BYOM)]] - [[herdr]]