As of Sept 10, 2026, running an agent's loop is a buy decision. OpenAI opened its Agents API — the managed Codex harness — so the machinery you used to hand-roll (sessions, context compaction, failure recovery, subagent coordination) is now something you can rent. That makes three real options, and the choice between them is not "which framework is best." It's a single question: how much of the loop, the state, and the infrastructure do you want to own — and what will it cost you to leave later?

Here's the decision in one screen:

The one-line rule: rent the harness to ship this month, but keep your prompts, tools, and a copy of your durable state portable behind a thin gateway — so "buy" never hardens into "locked in." The rest of this piece is the reasoning behind that rule.

What each one actually runs for you#

The clearest way to see the three is by what disappears from your to-do list.

The Agents API takes the whole undifferentiated middle of an agent app. You send an Agent (a model, instructions, tools, MCP servers) and OpenAI keeps a durable Session alive across turns, compacts the context when the window fills, recovers after a step fails, and coordinates subagents. If you've built your own session store and retry loop before, this is exactly the code you get to delete. The cost of that convenience is where your state now lives: on OpenAI's infrastructure, in OpenAI's shape. (For the deeper version of this trade, we mapped who owns agent state when the platform runs the loop.)

The Agents SDK is the same primitives with none of the hosting. It hands you the agent loop, tool-calling, guardrails, and handoffs as a library, and stops there — you build the persistence, the messaging, and the deployment. It's flexible about execution: it supports bring-your-own sandboxes across seven providers (Blaxel, Cloudflare, Daytona, E2B, Modal, Runloop, Vercel), and you can mix it with direct Responses API calls for the low-level fast paths. This is the middle road: OpenAI's orchestration logic, your operational control.

LangGraph is the fully-owned path. You model the agent as a graph — nodes are units of work, edges are transitions, and a typed state object flows between them — and you run it. Its checkpointing is explicit and yours: a MemorySaver while you develop, a Postgres checkpointer in production, or a custom store. You can self-host behind your own API or lean on the managed LangGraph Platform for scaling and observability. It's the only one of the three that is multi-vendor by default and can run on-prem — and the only one where nothing about your loop belongs to someone else.

The decision tree#

Skip the feature matrix; answer these in order.

  1. Do you need multi-vendor model routing, on-prem, or an inspectable/replayable state machine? If yes, use LangGraph and stop — the OpenAI stack won't give you those, and retrofitting them later is more expensive than starting here.
  2. Do you want OpenAI's orchestration but need to control where it runs and where state lives (compliance, an existing cloud footprint, cost)? Use the Agents SDK with your own sandbox and persistence.
  3. Do you mostly want to ship an agent this month with the least plumbing? Use the managed Agents API — and wrap it (next section).

Most solo founders land on #3, because the honest bottleneck early on is time, not architectural purity. The parts the managed harness runs for you are the parts that are hard to get right and identical across every agent product — so paying to skip them is usually the right first move. Just don't let "first move" quietly become "permanent."

How to buy without getting locked in#

The lock-in in a managed harness is not the API surface — it's the state. Your agent's memory and in-flight work sitting in the vendor's session store is what makes leaving expensive. Three cheap habits keep the exit open:

None of this slows down shipping meaningfully, and all of it turns a one-way door into a two-way one.

The bottom line#

There is no universally right answer, but there is a right shape of answer for a small team in 2026: rent the loop, own the seams. Default to the managed Agents API for speed, reach for the Agents SDK when you need your own hosting, and choose LangGraph when control or multi-vendor or on-prem is a hard requirement — but in every case, keep prompts, tools, and a copy of your state portable behind one gateway.

For the wider context on why the managed option arrived now — and the cheaper, multimodal models arriving alongside it — see today's Wire. If you're still choosing a framework rather than a hosting model, our agent-frameworks-by-GitHub-stars ranking and the Agno vs LangGraph vs CrewAI breakdown compare the libraries head-to-head, and where to run a long-running agent covers the hosting side once you've picked one. For the higher-level platform call, start with our AI agent platform decision guide.