Agents API: OpenAI’s Managed Codex Harness for Stateful Health Workflows
OpenAI’s Agents API makes the Codex harness available to applications through a managed API. The important change is not simply another model endpoint: OpenAI takes responsibility for sessions, orchestration, context compaction, and recovery, while your application supplies tools and selects the execution environment. For health-related workflows, that division creates a clearer path to persistent agent tasks, but it also makes data-residency and retention decisions part of the architecture from the beginning.
OpenAI’s Agents API makes the Codex harness available to applications through a managed API. The important change is not simply another model endpoint: OpenAI takes responsibility for sessions, orchestration, context compaction, and recovery, while your application supplies tools and selects the execution environment. For health-related workflows, that division creates a clearer path to persistent agent tasks, but it also makes data-residency and retention decisions part of the architecture from the beginning.
The API turns Codex from a local harness into an application service
An Agents API integration starts with four concepts: an agent, an environment, a session, and the events and items produced during work. The agent defines the model, instructions, tools, and MCP servers. The environment provides a sandbox or computer where the agent can access files, load skills, and run commands. A session is the durable agent instance that continues working on tasks and responds to new input.
That structure matters for health software because a useful workflow rarely ends with one model response. An application may need an agent to inspect files, run code, use an external MCP server, create an artifact, and then continue after a later instruction. The managed Codex harness can apply relevant skills and instructions, summarize previous work when context grows, and delegate work to subagents. The application can stream progress or track it through webhooks, then send another task to the existing session.
A practical integration path follows that architecture: define the agent configuration, choose a sandbox or computer environment, create a durable session, submit work, observe events or webhook updates, and reuse the session for the next task. The resulting artifacts and sessions can be deleted when they are no longer needed. That sequence gives teams a concrete implementation boundary, but sensitive health workflows still depend on what the selected environment can access.
Health deployments must treat the environment as a control boundary
Applications choose the execution environment, and agents can execute code, edit files, connect to MCP servers, and produce artifacts inside sandboxes. An environment can be self-hosted, with a workspace such as /workspace, or it can use an OpenAI-hosted sandbox with network access configured as enabled, disabled, or restricted. The choice determines where operational work occurs and how the application connects the agent to its data and tools.
For a health application, that choice should be made before building the workflow rather than after an agent has been connected to records or operational systems. The Agents API supports data residency only in the United States and does not support Zero Data Retention. A self-hosted sandbox does not change that eligibility. These are platform conditions, not settings that can be corrected by moving the container to infrastructure controlled by the application.
The same boundary applies to MCP and network access. An HTTP MCP server can extend the agent’s capabilities, but the application must decide which tools and services are exposed. Community discussion has raised questions about whether restricted outbound access reliably enforces sandbox boundaries and whether remotely hosted agents should access local infrastructure at all. Those concerns point to a practical design question: which data and commands must remain behind the application’s own controls, and which tasks can safely run in the managed session?
The managed session improves continuity, while billing remains an application decision
OpenAI manages session state across turns, orchestration, context compaction, and recovery, so an application does not have to rebuild the agent’s working context after every event. That is valuable when a health workflow involves review, revision, and follow-up rather than a single request. Streaming and webhooks also give the application two ways to expose progress or coordinate downstream actions.
The cost model remains separate from the session model. Model usage is billed at the selected model’s API rates, OpenAI tools use standard rates, and OpenAI-hosted sandboxes use standard container rates. API access cannot be funded through an existing subscription, according to community discussion. A team therefore needs to estimate model calls, tool activity, container use, and subagent concurrency as part of the integration plan; the example configuration allows four concurrent subagents, but that example is not a promise that every workflow should use four.
Community reactions also show that continuity has trade-offs. Some developers prefer the sandbox experience associated with SDK usage, want externally triggered Codex turns to remain visible in the Codex application, or report that recent tasks consume more usage limits than expected. Others are experimenting with QEMU-based environments and phone-based remote control, while separate multi-harness APIs are being explored to run agents in parallel and reduce integration maintenance. The common issue is not whether agents can act, but where state, tools, visibility, and cost should be controlled.
The right starting point is a narrow, observable workflow
The Agents API is aimed at developers building applications around persistent Codex work, not at users seeking another subscription interface. The concrete access route is the OpenAI developer documentation at developers.openai.com, where an implementation can be shaped around an agent, its environment, its session lifecycle, and its event handling. Start with one bounded task, provide only the tools and MCP servers that task requires, select the execution environment deliberately, and make session and artifact deletion part of the operating procedure.
For health use cases, the first design review should confirm that United States-only residency and the absence of Zero Data Retention are acceptable for the intended data. The next review should test what the sandbox can reach, how restricted network access behaves, how progress is surfaced to users, and how the application handles a resumed session. These checks are more consequential than choosing between a streamed response and a webhook because they determine the trust boundary around the agent.
The durable distinction is therefore between managed continuity and application control. OpenAI supplies the harness capabilities that make agents persistent and operationally useful; the application still owns tool selection, environment choice, user visibility, and deployment suitability. For teams building practical AI systems, that is the central assessment: the API can simplify agent orchestration, but responsible adoption depends on proving that its session and environment model fits the workflow’s data and operational constraints.
Specs
- Example model: gpt-6-astra
- Example environment: self_hosted with workspace directory /workspace
- Example concurrency: Up to 4 concurrent subagents
- MCP transport: HTTP via https://developers.openai.com/mcp
- Data controls: United States data residency only; Zero Data Retention is not supported
Sources
- OpenAI Developers: Agents API — OpenAI
- Epho — Epho
