Xiaobai
Developer · Builder
Building AI engineering systems, developer tools and long-term digital assets at XBSTACK.
About Xiaobai & XBSTACK →
OpenAI Agents API vs Agents SDK vs Responses API: Who Should Own the Agent Loop?
OpenAI now has three overlapping-looking agent layers: Responses API, Agents SDK, and the new Agents API. This guide compares who owns the agent loop, state, recovery, tools, sandbox, subagents, cost, portability, and business control so production teams can choose the right runtime boundary.
OpenAI Agents API vs Agents SDK vs Responses API: Who Should Own the Agent Loop?
Here is the shortest useful answer: OpenAI Agents API, Agents SDK, and Responses API are not three competing products at the same layer, and they are not a basic/pro/enterprise ladder. The real difference is where the agent control loop runs. Responses API gives you model and tool primitives while your application owns most orchestration. Agents SDK moves the common loop, tool execution, guardrails, handoffs, and session behavior into an application-side runtime. Agents API goes one layer higher and turns a Codex-style harness into a managed runtime, including long sessions, context compaction, tool search, programmatic tool calling, subagents, and selectable execution environments.
That is also why the launch is easy to misunderstand. A feature checklist can tell you that all three paths touch tools or state, but production failures are rarely caused by the absence of a checkbox. They happen because teams cannot answer more important questions: Who owns the state? Who owns recovery? Who is allowed to execute an external side effect? Where can we reconstruct what happened after a failed run? What can we still move if we change model providers next year?
If you remember one sentence from this guide, make it this:
Responses API is an execution interface, Agents SDK is an application-side agent runtime, and Agents API is a hosted agent harness. The architecture decision is about control ownership, not feature count.
This is not an apples-to-apples cloud benchmark. I reviewed OpenAI’s September 10, 2026 Agents API launch, the current managed Session API, Agents SDK documentation, and Responses API documentation. XBSTACK also ran a local no-network SDK surface probe on openai JavaScript 7.15.0 and confirmed that both client.responses.create and client.beta.agents.sessions.create are present. We also maintain a separate Agents SDK RunState recovery lab. The current execution environment does not have an OpenAI API credential, so I did not run a live Agents API cloud task and will not invent latency, cost, recovery-rate, or subagent-performance numbers. This article is an architecture decision guide, not a disguised benchmark.
1. Stop comparing features first: these are three different control planes
Ignore the product names for a moment and look at what a production agent actually has to own:
User task
↓
Business identity / tenant / authorization
↓
Agent Loop
├─ call model
├─ decide whether to use tools
├─ execute tools
├─ feed results back
├─ retry / pause / recover
└─ decide when the task is complete
↓
State / Session / Context
↓
Sandbox / files / code / MCP / external systems
↓
Business DB / approval / idempotency / audit

Responses API, Agents SDK, and Agents API move responsibility across the middle of that chain.
| Dimension | Responses API | Agents SDK | Agents API |
|---|---|---|---|
| Abstraction | Model/tool execution interface | Application-side agent runtime | Hosted agent harness |
| Agent loop | Mostly yours | SDK Runner manages it | OpenAI-managed harness |
| Tool dispatch | You dispatch local calls or use hosted tools | SDK can run function/hosted tools | Harness coordinates a broader tool workflow |
| State | previous_response_id, Conversations + your DB | Session / RunState + your DB | Managed Agent Session + your business DB |
| Long context | Your overall strategy | SDK/Responses plus your strategy | Automatic context compaction is part of the managed harness |
| Multi-agent | Build it yourself | Handoffs / agent-as-tool | Native multi-agent/subagent support |
| Execution environment | Primarily your infrastructure | Your process / chosen tool environment | OpenAI-hosted, your infrastructure, or partner sandboxes |
| Portability | Highest | Medium | Deeper harness dependency |
| Operational burden | Highest | Medium | Lowest harness maintenance, deeper platform dependency |

The crucial detail is that Agents SDK already uses the Responses API by default for OpenAI models. OpenAI’s own SDK docs say the distinction is orchestration: if you want to own the loop, use Responses API directly; if you want a runtime to manage turns, tools, guardrails, handoffs, and sessions, use Agents SDK.
Agents API moves the boundary again. OpenAI describes it as a Codex harness that OpenAI hosts and maintains while developers choose the compute environment: an OpenAI-managed sandbox, their own infrastructure, or an ecosystem provider. That is a different proposition. It is not a renamed Responses API; it is an attempt to productize the hardest part of long-running agents: the harness itself.
2. Responses API: maximum control, maximum responsibility
If I were building a new agent with strict business semantics, I would not automatically move away from Responses API just because Agents API exists. Responses API remains the cleanest option when you want model capability to stay a thin layer inside your own system.
That matters most when the dangerous state is not “what the model remembers” but “what the business already did.” Consider a financial agent that reads an invoice, checks policy, and proposes a payment. The risky failure is not whether the model can call lookup_invoice; it is whether a retry, duplicate event, reconnect, or double-click can execute approve_payment twice.
That state belongs in your business database, not in a conversation object.
Application State Machine
├─ task_id
├─ user / tenant / permission
├─ approval_ticket
├─ idempotency_key
└─ execution_status
↓
Responses API
↓
tool request
↓
Policy Gate / Tool Executor
The benefit is explicit ownership. Tool requests, results, transitions, retries, provider routing, and business state can all be recorded in your system of record. One step can use OpenAI, another can use a local model, and another can be deterministic code.
The cost is equally explicit: the loop is yours. You have to decide how to dispatch tool calls, retry failures, recover broken streams, compact context, coordinate workers, persist partial runs, and decide when the task is actually finished.
That is why Responses API is not the “low-level option for simple projects.” In regulated workflows, multi-tenant systems, cross-provider orchestration, and strict state machines, it can be the most professional choice precisely because critical state is not hidden behind a runtime abstraction.
3. Agents SDK: stop rewriting the loop without giving up your runtime
Agents SDK standardizes the part of agent infrastructure most teams eventually reinvent.
Its current primitives include Agent, Runner, Tools, Guardrails, Handoffs, Sessions, and tracing. The Runner implements the common loop: call the model; stop if the result is final; execute tool calls and feed results back; switch agents on a handoff; continue until the run finishes or a limit is hit.
That removes a large amount of glue code while keeping the runtime in your own application process. You can still use your own database, queue, policy engine, secrets system, telemetry, and domain objects. You can also choose between client-managed session state and OpenAI-managed continuation mechanisms depending on the workload.
XBSTACK has already tested one of the places where that boundary matters. In our separate Agents SDK RunState approval/resume lab, we verified that a paused Tool Approval run can be serialized and resumed by another process. We also verified that replaying the same approved state in two workers can execute the external side effect twice.
That result is more important than it looks:
Agents SDK can restore agent runtime state, but it does not create business exactly-once semantics for you.
That is the right boundary for the SDK. Let it manage how the agent runs. Keep the definition of business success, authorization, approval validity, and external-side-effect deduplication in your application.
I would prefer Agents SDK when:
- the service primarily uses OpenAI models but needs several tools, guardrails, or handoffs;
- human approval is required, but approval truth remains in the application backend;
- a consistent runtime and trace model is valuable;
- the team is tired of rewriting while-loops and tool-dispatch glue;
- databases, queues, permissions, and the actual worker process still need to remain under application control.
The tradeoff is framework behavior. As the SDK owns more of the runtime, version changes to serialized state, session persistence, tool ordering, or resume behavior become part of your regression surface. Official SDK does not mean “operational correctness is now someone else’s problem.”
4. Agents API: the thing OpenAI wants to host is the harness
On September 10, 2026, OpenAI introduced Agents API in public beta. The most important part of the announcement is not the single-call example. It is the responsibility model.
OpenAI says it hosts and maintains the harness, while developers choose the agent’s compute environment: an OpenAI-managed sandbox, their own infrastructure, or a partner environment.
That sentence separates Agents API from Agents SDK.
With Agents SDK, the Runner still lives in your service. Your service can crash, workers can restart, long jobs can span hours, context can approach model limits, tool definitions can become huge, and subagent coordination can become its own subsystem. Those are still your runtime problems.
Agents API is an attempt to absorb more of that into the platform harness. OpenAI currently documents capabilities including:
- long-running managed Agent Sessions;
- automatic context compaction as sessions approach context limits;
- Tool Search that loads relevant tool definitions on demand;
- Programmatic Tool Calling for parallel calls, chaining, filtering, and code-mediated coordination;
- native multi-agent/subagent support;
- MCP, custom functions, and built-in tools;
- OpenAI-hosted sandboxes, plus your own or partner environments;
- files, code execution, and artifact production.
The value is not ten fewer lines of code. The value is that you may no longer need to maintain an agent harness as a continuously evolving product.
That cost is real. As models gain better tool search, programmatic calling, subagents, and long-context behavior, the harness is not a one-time library. Teams repeatedly retune context management, tool schemas, concurrency, recovery, and environments. Agents API is OpenAI turning that maintenance layer into a managed service.
This is especially relevant for coding, research, operations, and data-analysis agents where the work is long-running, file-heavy, tool-heavy, environment-dependent, and artifact-producing. In those workloads, the expensive part often stops being “call the model” and becomes “keep the agent alive, focused, recoverable, and productive.”
5. The real boundary is where business truth lives
A shallow comparison ends with “Responses API is flexible, Agents SDK is balanced, Agents API is convenient.” Production architecture needs a harder question:
When an agent run fails, where do you go to reconstruct the truth?
Imagine an operations agent receives: “Investigate the elevated 5xx rate and roll back after approval.” The flow can include monitoring, subagents, repository inspection, a rollback recommendation, human approval, deployment, validation, and completion.
There are at least five different kinds of state in that one job:
- Model-context state — what the model currently knows;
- Agent-runtime state — which tools ran and where the loop is paused;
- Execution-environment state — files, processes, and artifacts inside the sandbox;
- Business state — whether the approval is valid and whether a rollback reservation exists;
- External-world state — whether production was actually rolled back.

No API choice should make the last two exist only inside an agent session.
My most important rule for production agents is therefore:
The agent runtime can be managed. Your business system of record cannot be replaced by an agent run.
Agents API can manage context, subagents, and a sandbox. Agents SDK can manage Runner and Session state. But deployment_id, tenant permission, payment state, approval status, idempotency keys, and audit records still need independently verifiable records in your own system.
Otherwise the biggest risk is not vendor lock-in. It is that the only place you can ask what happened is the runtime that just failed.
6. Choose by task lifetime, not company size
“Startups use API, enterprises use SDK” is not a useful rule. A two-person company can own a high-risk payment workflow; a large enterprise can have a trivial internal summarizer.
A better selector is task lifetime plus state complexity.
Short request to tens of seconds: start with Responses API
If the job is a structured extraction, a search, or a small number of tool calls with little recovery complexity, Responses API is usually the clearest option.
Examples:
- structured document extraction;
- one-shot financial summary;
- database lookup plus explanation;
- business assistant with one to three function calls;
- a mature workflow engine that treats the LLM as one node.
Do not introduce a large runtime just to call the workflow an “agent.”
Tens of seconds to minutes, several tools or handoffs: prefer Agents SDK
If the job spans several turns, uses guardrails, tools, handoffs, approvals, or sessions, but you already have a reliable application runtime, Agents SDK is a natural middle layer.
You remove agent glue while keeping business code and process control.
Minutes to hours, environment-heavy and subagent-heavy: evaluate Agents API
Once the task starts to look like Codex—open a repository, manipulate files, install packages, execute commands, create artifacts, cross several context windows, delegate to subagents, and continue for a long time—the harness becomes expensive infrastructure.
That is the strongest fit for Agents API.
Not because it is “higher end,” but because what you want to outsource is no longer one model call. It is long-running agent operations.
7. Cost is not token price: each layer buys something different
OpenAI’s launch material says there is no additional fee simply for using Agents API; developers pay for the tokens and tools/resources their agents use. That does not mean Agents API and Responses API have identical real-world cost.
For production, cost should be decomposed as:
Model Token Cost
+ Tool / Search / Container / Sandbox Cost
+ Runtime Infrastructure Cost
+ Engineering & Operations Cost
= Cost per Verified Outcome
Responses API can produce the cleanest platform bill while leaving you to pay for workers, queues, state stores, observability, recovery, and harness maintenance. Agents SDK removes some engineering work but your runtime is still yours. Agents API may introduce sandbox, long-session, or additional agent-execution resource usage while reducing the engineering burden of maintaining the harness.
The metric that matters is therefore cost per verified business outcome.
If a self-hosted agent consumes only $0.30 of model usage per task but requires a week every month to maintain context compaction, tool registries, and worker recovery, token price is not the real cost. The opposite is also true: if the task is a short deterministic flow, a managed long-running agent runtime may be unnecessary complexity.
XBSTACK has not yet run all three paths with the same model, task, tool permissions, and success criteria. So there is no “Agents API is 20% more expensive” or “SDK is 2x faster” claim here. No measurement, no number.
8. Security: a hosted harness does not replace your policy gate
The more capable the managed runtime becomes, the easier it is to assume authorization can move into it as well.
It should not.
An agent having a tool and a specific invocation being authorized are separate questions. A delete_file, deploy_release, or refund_order tool should not become valid for every tenant, resource, argument, and risk level merely because the tool is visible to the model.
A production path should still look like:
Agent requests tool
↓
Policy Gate
├─ identity
├─ tenant
├─ resource
├─ scope
├─ arguments
├─ risk level
└─ approval state
↓
Idempotency / Execution Reservation
↓
Tool Executor
↓
Audit Log
A sandbox reduces the blast radius of code execution; it does not replace business authorization. A Session stores runtime state; it does not replace an approval database. Context compaction helps long tasks continue, but it is another reason to maintain an external audit trail because compressed model context should not be the only evidence of what happened.
For finance, health, enterprise data, or production infrastructure, teams also need to inspect retention, secret injection, network egress, artifact lifecycle, logging, and deletion semantics. “Managed by OpenAI” is not a substitute for your own security model.
9. Migration: do not rewrite every agent because a new API launched
I would not rewrite an existing Responses API or Agents SDK system just because Agents API is new.
A more disciplined migration strategy is workload-based:
| Existing workload | Recommendation |
|---|---|
| Short request, structured output, few tools | Keep Responses API |
| Application-side multi-tool / guardrail / handoff flow | Keep or upgrade Agents SDK |
| Existing LangGraph / Temporal / custom workflow | Do not migrate mechanically; evaluate only high-harness-cost tasks |
| Coding / research / operations long task | Run an isolated Agents API PoC |
| High-risk transaction or production write | Keep business state and approval outside the agent runtime regardless |
The best PoC candidate is not “our easiest demo.” It is a task where harness maintenance already costs more than the business logic.
A code-review agent that clones a repository, installs dependencies, runs tests, delegates analysis, saves artifacts, and recovers from failures is a good candidate. That workload can show whether a managed harness actually removes engineering burden.
A flow that reads three CRM records and writes a sales summary is not. Responses API may already be simpler.
10. What XBSTACK has verified—and what it has not
To keep vendor documentation separate from XBSTACK evidence, here is the boundary explicitly.
Verified locally
The current lab lives at:
experiments/openai-agents-api-sdk-responses-comparison/
Using openai JavaScript 7.15.0, a no-network surface probe confirmed:
client.responses.create -> present
client.beta.agents.sessions.create -> present
That verifies the current official SDK exposes both API surfaces as distinct, coexisting entry points.
XBSTACK also maintains a separate OpenAI Agents SDK RunState approval/resume test that verifies serialization, approve/reject, cross-process resume, duplicate delivery, and business-idempotency boundaries. That is the evidence behind the claim that Agents SDK can own runtime recovery without owning business exactly-once semantics.
Not yet verified
The current environment does not expose an OpenAI API credential, so we have not run:
- a real Agents API managed Session over a long task;
- actual context-compaction fidelity;
- multi-subagent latency and quality;
- OpenAI-hosted sandbox cold-start, persistence, and cost;
- identical-task token and total cost across Responses API / Agents SDK / Agents API;
- cloud recovery behavior after network/process loss;
- large MCP Tool Search savings.
Those tests are what would justify a future performance or cost verdict. Until then, this page makes architecture decisions, not benchmark claims.
11. Final decision: ask who should own the loop
My shortest decision tree is:

Does the task need an agent loop?
├─ No -> Responses API
└─ Yes
↓
Should the loop run in your application?
├─ Yes -> Agents SDK
│ (or Responses API + your own runtime for stricter control)
└─ No
↓
Is it long-running, environment-heavy, tool-heavy, or subagent-heavy?
├─ Yes -> Evaluate Agents API
└─ No -> Agents SDK is usually enough
Then add the production rule that matters more than the tree:
No matter which layer you choose, users, tenants, permissions, approvals, idempotency, and external side effects need a source of truth outside the agent runtime.
So I would not say Agents API “replaces” Agents SDK, and I would not call Responses API obsolete. OpenAI is effectively splitting the agent stack into layers: Responses API remains the low-level model/tool interface; Agents SDK serves developers who want to run the runtime themselves; Agents API starts to absorb the hardest cloud-agent harness responsibilities.
That is the larger change. Agent infrastructure is beginning to look like databases, object storage, and containers: teams now have a serious build-versus-managed decision.
For the last few years the headline question was, “Which model is smarter?” The production question is increasingly different:
The model can supply the agent’s intelligence—but how much of its loop, state, execution environment, and operational truth are you willing to hand to the model platform as well?
That is the durable boundary between Responses API, Agents SDK, and Agents API.
FAQ
Will Agents API replace Agents SDK?
Not in the simple sense. Agents SDK is an application-side runtime; Agents API is a hosted harness. They place runtime responsibility in different locations, and one company can use both in different services.
Is Responses API still a good choice for new projects?
Yes. Short tasks, explicit state machines, cross-provider orchestration, existing workflow engines, and systems with strict control requirements can benefit from using Responses API directly.
What is the biggest value of Agents API?
Not a smarter model. The value is that OpenAI starts maintaining the long-running harness: managed sessions, context management, tool coordination, subagents, and selectable execution environments.
What is the biggest risk of Agents API?
Deeper platform dependency and a more complicated responsibility boundary. As harness operations move out of your stack, business state, authorization, auditability, exit strategy, and cost monitoring become even more important.
Should teams migrate immediately?
No. Pick a long-running task where harness maintenance is already painful, define the same success criteria, and compare engineering effort, recovery behavior, and cost per verified outcome before expanding usage.
Official references
- OpenAI: Introducing the Agents API
- OpenAI Agents API Docs
- Agents API Sessions Reference
- OpenAI Agents SDK
- Running Agents
- Agents SDK Sessions
- Responses API Reference
Continue reading
- OpenAI Agents SDK RunState: Cross-process Tool Approval and Resume
- Why a Responses API stream abort can lose a Tool Call
- Migrating OpenAI Assistants API to Responses API
- AI Agent Production Governance
- AI Agent Tool Authorization and Policy Gates
Continue from protocol details to production MCP governance
The MCP hub connects protocol fundamentals, transports, authentication, security, JSON-RPC debugging and production deployment without splitting the search intent across isolated guides.
More to Explore
Topic hub →AI Engineering Weekly
Production changes, real failures, experiments and new XBSTACK assets.
DISCUSSION
Questions, verification and corrections
Sign in to comment. Every new comment is reviewed before publication; while pending, it is visible only to you and the administrator.