OpenAI Introduced the Agents API, Which Brings a Hosted Version of the Codex Harness

Written by

in

IBL News | New York

OpenAI introduced the Agents API, which brings a hosted version of the Codex harness to developers’ applications.

OpenAI manages sessions, orchestration, context compaction, and recovery while the user provides tools and chooses its execution environment.Agents can operate in a sandbox to execute code, edit files, connect to MCP servers, and produce artifacts.

These agents can perform tasks such as investigating production incidents, connecting to tools through MCP, following a runbook, and delivering a shareable report with evidence and suggested next steps.

The Agents API gives user applications access to the Codex harness through an OpenAI-managed API.

Model usage is billed at the selected model’s API rates. OpenAI tools use their standard rates, and OpenAI-hosted sandboxes use standard container rates.

––

Try these complete examples:

Create and run a directory-tree script in an OpenAI-hosted sandbox.
Compare release notes with subagents and combine their findings into one answer.
Explore complete applications:

Incident response agent: investigate alerts and request approval for recovery actions.
Slack bot: investigate requests using connected workplace tools.
Data analyst: answer warehouse questions with read-only SQL.
GitHub issue investigator: reproduce reported bugs and share findings on GitHub.
Document reviewer: review documents with policy skills and specialist agents.
Core concepts

The Agents API is built around four main concepts:

Agent: The model, instructions, tools, and MCP servers available to the agent.
Environment: An optional sandbox or computer where the agent accesses files, loads skills, and runs commands.
Session: A durable instance of an agent that works on tasks and responds to input.
Events and items: The inputs sent to an agent and the output produced during a session.
A session from start to finish

Start with an OpenAI-hosted sandbox in the quickstart:

Create a session. Configure the agent; OpenAI provisions its environment.
Give it a task. User input starts a turn of work once the environment is ready.
Follow progress. Stream output or use webhooks to learn when the agent finishes or needs input.
Continue or steer. Send another task to the same session, or guide the agent during its current turn.
With an OpenAI-hosted session, your application sends input and receives events, while OpenAI runs the agent and provisions and manages its sandbox. See environment options for setup and limitations.

Your application starts sessions and receives events and output from the Agents API. OpenAI runs the managed Codex harness and provisions and manages its sandbox.
What the managed harness provides

The managed Codex harness supports:

Running commands and code in a sandbox.
Applying relevant skills and instructions.
Connecting to external data through tools or MCP.
Steering the agent while it works.
Summarizing previous work to manage its context window.
Breaking work into subtasks and delegating to subagents.
Resuming a session where it left off.
Check the quickstart prerequisites for API-key permissions and SDK setup. Configure these capabilities when you create a session:

Configure managed-harness capabilities
from openai import OpenAI