Two Paths to the Same Agent Loop
Anthropic now ships two ways to put a Claude agent into production, and they are easy to confuse because both run essentially the same loop. The Claude Agent SDK is a library, available in Python and TypeScript, that runs that loop inside your own process on your own infrastructure. Claude Managed Agents, launched in April 2026, is a hosted REST API where Anthropic runs the harness, the sandbox, and the session log for you.
The capabilities overlap almost entirely. Both give the model code execution, file manipulation, bash, web browsing, and MCP tool integrations. So the decision is not really about what the agent can do. It is about who operates the runtime, who absorbs the failure modes, and how you get billed for it. Framing the choice that way turns a confusing product comparison into a normal infrastructure decision.
What Each Option Actually Is
The Agent SDK is the same loop that powers Claude Code, packaged so you can embed it. You import it, define your tools, and execute the loop inside your own service: a background worker, an API handler, a container in your cluster. Because the loop runs in your process, you own everything around it — the steps, the fallbacks, the error states, the retry logic, and where session state lives.
Managed Agents flips that. You call a REST API and Anthropic provisions and tears down the sandbox, manages context across a long session, persists the session log, and handles scaling. There is no runtime for you to operate. The tradeoff is that the run happens on Anthropic's infrastructure, so the reasoning trace, tool inputs and outputs, and intermediate files all live there for the duration of the session.
- Delivery — a library you embed versus a hosted API you call.
- Runtime ownership — your process versus Anthropic's infrastructure.
- Sandbox and session state — you provision and persist versus fully managed.
- Human-in-the-loop approvals — you implement the gate versus built in.
- Pricing — token costs only versus tokens plus a per-session-hour runtime charge.

When the SDK Wins
Choose the Agent SDK when the agent has to live inside systems you already operate. If it needs to share a database transaction with your application, call internal services over a private network, or run as one step in a larger pipeline, embedding the loop is the only option that fits cleanly.
It also wins when compliance draws a hard boundary around your infrastructure. A VPC-only, on-prem, or air-gapped deployment rules out the hosted path entirely, because the SDK runs wherever your code runs. And if you need to customize the loop itself — unusual retry semantics, bespoke approval logic, or a context strategy tuned to your domain — you need access to the loop that a hosted API abstracts away by design.
The cost argument is subtler than it first appears. Without a runtime charge, your bill is a direct function of tokens, which makes high-volume workloads easier to model and cap. For a small team with strong platform skills, that predictability can matter as much as the raw number.
When Managed Agents Win
Choose Managed Agents when the work is long-running and operational burden is the real constraint. Session persistence, context management, and sandbox lifecycle across a multi-hour run are genuinely hard to build well. Small teams without platform engineering support get to production dramatically faster by not owning workers, sandboxes, and session storage.
The pricing structure has a pleasant surprise. Runtime is reported at roughly eight cents per session-hour, with the first fifty hours per day free across all sessions. For teams running a modest number of agent sessions, that free allowance means the runtime cost rounds to zero and the entire bill is tokens. That can beat self-hosting on economics alone.
Managed Agents also shine when the model decision is already settled. If you are committed to Claude for reasons beyond cost, the main argument for operating your own runtime weakens considerably, and you can spend that engineering time on the product instead.

The Constraint Both Options Share
Here is what the comparison cannot resolve, because it is true of both: the SDK and Managed Agents are Anthropic-only. Self-hosting the SDK buys you infrastructure control. It does not buy you model control. Every task still runs on a Claude model, which means every task is billed at frontier rates whether or not it needed frontier capability.
On an agent that runs thousands of times a day, most tasks do not need the most expensive model available. The loop re-processes the system prompt and tool definitions on every turn, and every tool round-trip ships the growing context back to the model. The single largest cost lever in any agent platform is routing a task to a cheaper model when the task does not require an expensive one, and neither of these options exposes it.
The real decision space is larger than two choices. Alongside who hosts the runtime sits which model runs the task — and that question is only available if the harness itself is model-neutral.
A Practical Decision Framework
Start with the constraint, not the feature list. If data residency or network boundaries forbid the hosted path, the answer is the SDK and the conversation is over. If they do not, ask whether you have the appetite to operate a runtime: workers, sandboxes, session storage, and the on-call rotation that comes with them.
If the answer is no, Managed Agents is the faster path, and the free session-hours make it cheap to try. If the answer is yes and you need the loop inside an existing service, the SDK gives you control you cannot otherwise get. Prototype on the SDK, then graduate to the managed path only if operations become the bottleneck — that is the sequence most teams should follow, even though it is the opposite of what infrastructure-first shops tend to assume.
Whatever you pick, measure cost per accepted task rather than cost per call. A cheaper model that fails more often and sends more work to human reviewers is not cheaper at all. The runtime is the visible decision. The model underneath it is the one that determines whether the agent is a business or an expensive experiment.



