Scaling Managed Agents: Brains, Hands and Sessions
An architecture blueprint for long-running AI agents: a stateless brain, disposable hands and a durable session log. Updated for Claude Managed Agents, Grok Bot's always-on agents and multi-model teams built on Opus 5.5, Fable 5.2, Gemini 4 Neon and GPT-6.2.
The first agent most teams build is a loop inside a container: give the model a shell, a file system and some credentials, and let it work. In a demo, that is enough. Once agents run for hours, act on real systems and serve many users at once, the single container becomes the problem.
By late 2026 this is no longer a research question. Anthropic runs it as a product — Claude Managed Agents, with durable sessions, cloud or self-hosted sandboxes and credential vaults. SpaceXAI’s Grok Bot gives each always-on agent its own cloud computer that keeps working while you are away. Google and OpenAI ship their own agent platforms. Underneath the branding, the successful designs converge on the same split, which Anthropic described in its engineering write-up Scaling Managed Agents: Decoupling the brain from the hands.
Harnesses encode assumptions about what models cannot do yet, and those assumptions go stale with every release. Put the agent behind stable interfaces — the brain, the hands and the session — that outlast any particular model generation.
1. The bitter lesson in harnesses: don’t adopt a pet
Scaffolding built around one model’s weaknesses becomes dead weight on the next. Anthropic’s own example: an earlier model tended to wrap up tasks prematurely as its context filled, so the harness added aggressive context resets. On the next model the behaviour had gone, and the resets only got in the way.
The pace has since accelerated. Between September and November 2026, Anthropic shipped Opus 5.5 and then Fable 5.2, OpenAI shipped GPT-6.2 Sol and Astra, Google shipped Gemini 4 Neon, and SpaceXAI shipped Grok 4.7. If your architecture needs rework each time, you will always be behind.
The single-container “pet”
Early designs put the session log, the harness and the sandbox in one container:
┌──────────────────────────────────────────────────────────┐
│ COUPLED CONTAINER (A "PET") │
│ │
│ ┌────────────────┐ direct syscalls ┌─────────────┐ │
│ │ Agent harness │ ──────────────────► │ Sandbox + │ │
│ │ (model loop) │ │ credentials │ │
│ └───────┬────────┘ └─────────────┘ │
│ │ in-memory log │
│ ▼ │
│ ┌────────────────┐ │
│ │ Session data │ │
│ └────────────────┘ │
└──────────────────────────────────────────────────────────┘
It avoids designing network boundaries, but:
- The container becomes a pet. Pets are hand-nursed and irreplaceable; cattle are interchangeable. When this container dies, the session dies with it.
- Failures are opaque. From outside, a hung harness, a dropped connection and an out-of-memory crash look the same — and opening a shell inside to debug exposes user data.
- Everything must live next to the model. Reaching a client’s private network means peering networks or running the whole stack inside it.
2. Decoupling the triad: brain, hands and session
Operating systems solved hardware diversity by virtualising devices into processes and files: read() works the same on a tape drive and an NVMe disk. Managed agents apply the same idea:
| Component | Responsibility | Failure domain | Interface |
|---|---|---|---|
| The brain | Model inference and the orchestration loop | Stateless — restart anywhere | wake(sessionId), emitEvent(id, event) |
| The hands | Sandboxes, browsers, devices, MCP tools | Disposable cattle — re-provision on demand | execute(name, input) → string |
| The session | Append-only, durable log of everything that happened | Highly available storage | getSession(id), getEvents(id, slice) |
┌─────────────────────────────────┐
│ THE BRAIN │
│ stateless harness + model │
└────────┬───────────────┬────────┘
│ │
getEvents() / │ │ execute(name, input)
emitEvent() │ │
▼ ▼
┌────────────────────┐ ┌──────────────────────┐
│ THE SESSION │ │ THE HANDS │
│ append-only log │ │ sandboxes · browsers │
│ (durable storage) │ │ devices · MCP tools │
└────────────────────┘ └──────────────────────┘
- Sandboxes become cattle. The brain talks to every hand through one tool interface. If a container dies, the brain sees an ordinary tool error, tells the model, and provisions a fresh one.
- Harnesses become cattle. Because the session lives outside the brain, a crashed harness is replaced by a new worker that calls
wake(sessionId), reads the log and continues from the last event.
export interface AgentBrain {
wake(sessionId: string): Promise<void>;
step(sessionId: string): Promise<StepResult>;
}
export interface SessionStore {
getSession(sessionId: string): Promise<SessionMeta>;
emitEvent(sessionId: string, event: AgentEvent): Promise<void>;
getEvents(sessionId: string, slice?: { start?: number; limit?: number }): Promise<AgentEvent[]>;
}
export interface Hand {
provision(spec: { image: string; cpu: number; memoryMb: number }): Promise<string>;
execute(handId: string, tool: string, input: Record<string, unknown>): Promise<string>;
destroy(handId: string): Promise<void>;
}
The same shape shows up across the 2026 products: sessions that resume after pauses, sandboxes that can run in the vendor’s cloud or in yours, and agents that keep a computer of their own between tasks.
3. See it fail — and recover
Run a task, then kill the harness or the sandbox mid-flight, or try a prompt injection. Watch what the session log does.
- Press “Run task”, then try breaking things while it works.
4. Zero-trust credentials: keep secrets away from generated code
If model-generated code runs where credentials live, a prompt injection only has to persuade the agent to print its environment. Narrowly scoped tokens shrink the blast radius but do not remove it.
The structural fix is to never put credentials in the sandbox:
┌────────────────────────────────────────────────────────┐
│ MANAGED AGENT │
│ │
│ ┌─────────────────┐ token-free tool call ┌───────┐ │
│ │ Brain │ ──────────────────────► │Sandbox│ │
│ └────────┬────────┘ └───┬───┘ │
│ │ session identity │ │
│ ▼ outbound HTTPS │ │
│ ┌─────────────────┐ ◄──────────────────────────┘ │
│ │ Egress proxy / │ │
│ │ MCP gateway │ ── fetch secret ──► ┌───────────┐ │
│ └────────┬────────┘ │ Vault │ │
│ │ request + real credential └───────────┘ │
│ ▼ (allowed hosts only) │
│ ┌─────────────────┐ │
│ │ External API │ │
│ └─────────────────┘ │
└────────────────────────────────────────────────────────┘
Two patterns cover most needs:
- Credential substitution at egress. The sandbox makes ordinary HTTPS requests. A proxy outside it injects the real secret only for hosts the credential is allowed to reach. Claude Managed Agents’ vaults work this way; the secret never enters the sandbox.
- Pre-authenticated resources. For Git, the host clones the repository and configures the remote during set-up, so
git pullandgit pushwork inside the sandbox without the agent ever seeing a token. MCP servers that need OAuth sit behind a gateway that holds the tokens.
For universities and NGOs, also check where the session log lives. It contains every document the agent read. At the time of writing, Anthropic’s docs note that hosted Managed Agents is not covered by zero-data-retention arrangements, while a self-hosted option keeps the harness, sandboxes, credentials and session history in your own cloud. Read the current terms against your data policy before you choose.
5. The session is not the context window
Compaction — trimming turns, summarising old steps — means deciding, irreversibly, what to forget. If step 12’s raw tool output was summarised away and step 40 needs one detail from it, the agent fails.
Keeping the full log outside the model changes the question from “what do we keep?” to “what do we load now?”. The harness assembles each prompt from the log:
- Resume from the last checkpoint after an interruption.
- Rewind to the events just before a tool error to diagnose it.
- Look up a specific past decision instead of carrying it on every turn.
export class ContextBuilder {
constructor(private store: SessionStore, private cacheablePrefix: string) {}
async build(sessionId: string, budgetTokens: number): Promise<ModelRequest> {
const events = await this.store.getEvents(sessionId);
const recent = events.slice(-8); // verbatim
const older = events.slice(0, -8).map(digest); // one line each, keeps IDs and statuses
return fitToBudget({
system: this.cacheablePrefix, // stable prefix → high prompt-cache hit rate
messages: [...older, ...recent],
tools: [{ name: 'get_events', description: 'Read earlier events from this session by index range.' }],
}, budgetTokens);
}
}
With 1M-token context windows now common at the frontier (Opus 5.5 and Gemini 4 Neon both offer about a million tokens), it is tempting to skip this. Don’t: long prompts are slower and more expensive on every turn, and a stable cached prefix plus a retrieval tool over the log usually beats stuffing everything in.
6. Many brains, many hands
Start thinking before the sandbox exists
When brain and hands are coupled, every session waits for a container to boot, clone and install before the first token. Decoupled, the brain starts inference immediately and calls provision() only when the model actually needs a tool. Anthropic reported that this change cut median time-to-first-token by roughly 60% and p95 by over 90%.
One brain, many hands
A single orchestrator can drive a Linux sandbox, a headless browser, a phone emulator and remote MCP servers through the same execute() interface — and hand a live sandbox to another agent without copying it.
Many brains, chosen per role
Multi-agent teams are now a product feature rather than a research project. The 2026 twist is that the brains need not share a model. We choose per role from harness results:
| Role | What matters | Typical choice (Nov 2026) |
|---|---|---|
| Planner / orchestrator | Long-horizon reasoning, tool judgment | A top-tier model such as Claude Fable 5.2 or Opus 5.5 at high effort |
| Workers | Throughput and cost on well-scoped subtasks | A mid-tier model such as Gemini 4 Neon or GPT-6.2 Sol |
| Reviewer / judge | Independence from the worker | A different model family from the worker |
| Always-on watcher | Low cost, persistent presence | The smallest model that passes your fixtures |
Fable 5.2 costs twice as much per token as Opus 5.5, and the mid-tier models are cheaper again, so routing by role matters. The table is a starting point, not a recommendation: run your own fixtures, because the ranking changes with every release.
┌───────────────────────────┐
│ Orchestrator (brain) │
└─────────────┬─────────────┘
┌───────────────────────┼───────────────────────┐
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Worker brain A │ │ Worker brain B │ │ Reviewer brain │
│ hand: Linux box │ │ hand: browser │ │ hand: MCP (DB) │
└──────────────────┘ └──────────────────┘ └──────────────────┘
└──────────── shared session log ───────────────┘
7. Production checklist
- Decoupled triad: session, harness and sandbox run as separate services with narrow interfaces.
- Cattle sandboxes: any sandbox can be destroyed and rebuilt from a declarative recipe in seconds.
- Stateless harnesses: kill any harness process; a new one resumes with
wake(sessionId)and no data loss. - No secrets in sandboxes: credentials are injected at egress for allowed hosts only.
- Session ≠ context: the full log lives in durable storage; context assembly happens per turn.
- Lazy provisioning: inference never waits for a container.
- Model-portable: each role’s model is configuration, re-validated by the evaluation harness on every release.
- Data residency checked: you know where session logs live and who can read them.
8. Building agents with Gigantic Work
We design and build agent systems for universities, grant-funded projects, NGOs and SMEs — on Claude Managed Agents, other vendors’ platforms, or a self-hosted stack when data must stay on your infrastructure:
- Agent architecture: brain/hands/session separation, recovery and observability.
- Secure tool access: sandboxes, egress proxies, vaulted credentials and MCP gateways.
- Evaluation: fixtures and gates so you can change models with evidence.
Next steps: AI assistants & automation · start a project · [email protected]
Product names, release dates and figures are as published by Anthropic, Google, OpenAI and SpaceXAI up to November 2026. Check vendors’ current documentation and terms before relying on them.
Building an AI agent or assistant?
We design agent architectures, evaluation harnesses and secure tool access for universities, NGOs and SMEs — model-agnostic across Claude, Gemini, GPT, Grok and open-weight models, hosted where your data policy requires.