Safeguard
Developer Tools•

OpenAI Agents API vs Agents SDK vs Responses API: which runtime

OpenAI describes three runtimes for agents. Who runs the loop in each, how much integration work each needs, and the cleanup steps for separate resources.

Safeguard Security Team
3 min read

OpenAI's agents overview names three runtimes. The Agents API has OpenAI run a managed Codex harness and save session state, with the least integration effort. The Agents SDK has your application run the loop. The Responses API has you call models directly and manage the most yourself.

The three runtimes

From OpenAI's documentation:

  • Agents API: OpenAI runs a managed harness and saves session state. Least integration effort. Extras listed include automatic context compaction, multi-agent orchestration, MCP support and an optional sandbox that is OpenAI hosted, self-hosted or none.
  • Agents SDK: your application runs the agent loop, with custom tools, workflows and deployment control.
  • Responses API: you call models directly and manage more of the integration. Most effort.

The page frames the choice as where you want orchestration to run and who should manage state between tasks.

What agents do

The page says agents can carry out multi-step tasks with tools, coordinate with other agents and keep context across steps. Tools include function calling, MCP servers, hosted capabilities and programmatic tool calling with JavaScript, and tool execution differs by runtime. Reusable instructions can load through skills.

A quick way to choose

  • Want the least code and are fine with managed state? Look at the Agents API.
  • Need your own tools, hosting and control of the loop? The SDK.
  • Building something custom, or already integrated with the Responses API? Stay there.

Cleanup is separate

The page warns that an Agents API session, an SDK session, a Responses conversation and a sandbox are separate resources, each with its own state and cleanup steps. Plan deletion for each, especially if conversations hold customer data.

What this overview does not cover

It is a navigation page. It mentions handoffs only in passing, does not discuss guardrails or tracing, and refers to linked pages for those. Read the linked SDK pages before relying on them.

The security question

Whichever runtime you pick, ask where tools execute, which credentials they hold, and what happens when a tool result contains hostile text. Our Codex sandbox post and remote MCP approvals post cover two of those questions.

Safeguard has agent identity and policy controls for the agents you run, and a free scan at gold.safeguard.sh/scan.

Questions to settle first

Do you need the agent to keep working without your servers? Do you have rules about where conversation data may be stored? Who handles deletion requests? The answers often decide the runtime more than features do. Write them down before prototyping, because moving from one runtime to another later means rewriting state handling and cleanup code.

Pilot with one narrow task and a test conversation, then delete the session, conversation and any sandbox to confirm you know the cleanup path.

Quick check

Which runtime needs the least integration work?

The Agents API, according to OpenAI's overview.

Do sessions and sandboxes clean up together?

No. The page says they are separate resources with separate cleanup steps.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.