Inside Claude Managed Agents: Architecture, Primitives, and Cost Tradeoffs

Every custom agent harness makes assumptions about what the model can and can’t do on its own. Those assumptions go stale as the model improves. An earlier version of Claude would wrap up tasks prematurely as its context window filled, a behavior sometimes called context anxiety. Teams built context resets into their harness to compensate. When a later model no longer showed that behavior, the resets didn’t just become unnecessary. They actively discarded useful cache and hurt both performance and cost.

Claude Managed Agents exists to solve that problem structurally, not by asking teams to keep re-tuning their harness on every release, but by separating the parts of an agent that need to stay stable from the parts that will keep changing.

Why a new surface was needed

Task complexity handled by Claude and other models has grown from single-turn responses to owning entire outcomes: full-scale code modernization, an end-to-end financial close process, a complete research-to-outreach workflow. The harness surrounding the model has had to evolve alongside it, which is how the platform arrived at three distinct build surfaces.

Messages API. You construct the entire agent loop yourself, own all production infrastructure, and get tokens in, tokens out.

Agent SDK. Anthropic ships the Claude Code harness as software. You get file system access, session primitives, and observability out of the box, but you host and operate it on your own infrastructure.

Managed Agents. Anthropic runs the agent loop within its own hosted servers: secure sandboxes, credential management through a vault, session state preservation, and observability, all without custom setup.

The core architecture: decoupling the brain from the hands

The architecture underneath Managed Agents separates three components that used to live together in a single container: the brain (Claude and its harness, handling reasoning and orchestration), the hands (the sandbox where code executes and tools run), and the session (the durable, append-only log of everything that happened).

The earliest version of this system put all three in one container. That worked, but it created a classic infrastructure problem: the container became a pet instead of cattle. If it failed, the session was lost. If it hung, an engineer had to open a shell and nurse it back to health, and because that container often held user data, even that was a limited option.

Decoupling the brain from the hands solved this directly. The harness calls the sandbox the way it calls any other tool: a name and input go in, a result comes back. If the container dies, the harness treats it as a tool-call error and can provision a fresh one. If the harness itself fails, a new one can wake up, pull the session’s event log, and resume from the last recorded event. Neither the harness nor the sandbox needs to survive a crash for the session to survive it.

This has a concrete performance payoff. Because containers are only provisioned when the agent actually needs one, sessions that don’t need a sandbox right away don’t wait for one to boot. Time-to-first-token, the latency a user actually feels, dropped roughly 60% at the median and over 90% at the 95th percentile after this change.

The three primitives in practice

Building on Managed Agents means working with three configurable pieces:

Agent. A versioned configuration defining the model, system prompt, tools, MCP servers, and skills that shape the agent’s behavior.

Environment. The container configuration, created once and referenced by a shared ID across sessions. Cloud-hosted environments run entirely on Anthropic’s infrastructure. Self-hosted sandboxes let tool execution happen inside a customer’s own infrastructure while the agent loop still runs in Anthropic’s cloud. Running the full agent loop inside a customer’s own VPC, or routing inference through a third-party provider, isn’t supported yet.

Session. An agent paired with an environment, triggered by a webhook, event, or scheduled job, spinning up an isolated container per run. Billing applies only to active session time, which tends to make this cheaper than self-managed container infrastructure, where idle capacity is rarely optimized away.

Sidebar: what’s portable, if you ever build outside Managed Agents

Not every layer of an agent’s context is equally standardized, and it’s worth knowing which parts of a build travel if you ever change platforms.

Skills are the standout. The spec is genuinely open, endorsed by both Anthropic and OpenAI, and roughly 40 platforms became compatible with it within 90 days of publication. A skill built for Managed Agents is largely portable elsewhere.

Tools rest on JSON Schema as a real shared floor, though everything layered on top of it, deferred loading, tool search, structured output modes, doesn’t carry over between platforms.

Connectors have a specified wire format: MCP over Streamable HTTP with OAuth 2.x. This is also why the vault-and-proxy credential pattern described below isn’t a Managed Agents-only trick. It’s implementable on any platform that speaks the same wire format.

System prompts and message history remain convention rather than spec. Expect some rework if you ever move to a different harness.

Plugins are shape-only right now, with no cross-vendor registry yet. Treat any plugin packaging as disposable.

The practical takeaway: skills, tools, and the MCP wire format are durable investments regardless of platform. The harness and the primitives around it are specific to Managed Agents.

Security model

The security boundary here is structural rather than procedural. In a coupled design, untrusted code Claude generates runs in the same container as credentials, which means a prompt injection only has to convince Claude to read its own environment to expose those tokens. Decoupling removes that path by making sure credentials are never reachable from the sandbox where generated code executes.

Two patterns enforce this. For resource-bundled auth, like Git, an access token is wired into the local remote at sandbox initialization. Push and pull work from inside the sandbox without the agent ever handling the token directly. For custom tools, credentials live in a vault outside the sandbox, and Claude calls tools through a dedicated proxy that resolves the right credential and makes the call on the agent’s behalf. The harness itself is never made aware of any credential.

Context and memory beyond the context window

Long-horizon agent work routinely exceeds a single context window, and the usual fixes, compaction and trimming, involve irreversible decisions about what to discard. It’s hard to know in advance which tokens a future turn will actually need.

The session in Managed Agents solves this differently. Rather than treating the context window as the only place state can live, the session is a durable, queryable event log outside of it. The harness can pull positional slices of that log: picking up from where it last stopped reading, rewinding a few events to see what led up to a moment, or rereading context before a specific action. Any events it pulls can be transformed before they reach Claude’s context window, including reorganizing for cache efficiency. The session guarantees durability and availability; what happens with that context is left to the harness, deliberately, because future context engineering needs can’t be fully predicted today.

On top of this sits a memory mechanism, sometimes called dreaming, where Claude reviews its own past session logs, detects recurring patterns, and prunes, edits, or creates memory files without an engineer having to intervene. Paired with outcome-based configuration, where an agent is given a goal and a rubric and iterates its own process until the rubric is satisfied, this shifts a meaningful amount of tuning work from the engineering team to the agent itself.

What this looks like in real builds

A prospect research agent takes only a company name and a contact as input, researches the account and its likely pain points inside a cloud sandbox, and generates a ready-to-use output file. Because all reading and writing happens inside the sandbox, running many instances concurrently is safe by default.

A skill-based deck-building agent uses an orchestrator that spins up a parallel sub-agent per slide. Each sub-agent loads only the skill it needs, a bar chart skill or a scatter plot skill, builds its slide, and terminates. The orchestrator reviews the output with a vision-based QC pass against reference slides and can re-run a sub-agent if the result falls short. Swapping the underlying model while keeping the same skill format cut the cost of building a deck from $30 to $50 down to under $4.

An insurance claims intake demo creates a new session per policyholder interaction, streams every session event directly to the front end through the sessions API, and supports hooks that transform tool results, like stripping large identifiers, before they reach the model.

Frequently asked questions

What does “decoupling the brain from the hands” mean in Claude Managed Agents?

It means separating the reasoning and orchestration layer (the brain) from the execution environment where code runs and tools are called (the hands), so either can fail or be replaced without losing the session’s state.

Can Claude Managed Agents connect to a private VPC?

Self-hosted sandboxes allow tool execution inside a customer’s own infrastructure, but running the full agent loop inside a customer’s VPC, or routing inference through a third-party provider, isn’t supported yet.

How does Claude Managed Agents keep credentials secure?

Credentials are never reachable from the sandbox where Claude’s generated code executes. They’re either bundled with the resource itself, as with Git tokens wired in at initialization, or held in a vault and resolved through a dedicated proxy for custom tools.

Key Takeaways

  • Define the rubric or success criteria before building the agent, not after.
  • Never architect a path where the agent’s execution environment can access credentials directly. Route everything through a vault or proxy.
  • Treat the session log, not the context window, as the source of truth for long-horizon state.
  • Expect model-level assumptions embedded in any custom harness to become outdated. This is the specific problem Managed Agents aim to address.
  • Keep skills small and versioned like code. Automated, self-improving skill pipelines remain an open problem, not a solved one.

author avatar
Vivian Kim VP of Strategic Alliances & Marketing
Scroll to Top