Skip to content
The AI Agent Factory

The sandbox and its state

Approved by
Panaversity ·
12 min read

The session cloud workspace

[Vendor-documented] Each cloud session runs in its own temporary sandbox, on computers that Anthropic manages. No state is shared between sessions or between organizations.1 [Observed] In the session examined, the sandbox was a Linux microVM with Python, Node, a shell and file tools. This is the borrowed desk from Where the work happens.

AspectHow it worksBasis
ScopeOne sandbox for each session, not shared with other chatsVendor-documented
PersistenceFiles and installed packages last from one turn to the next within the sessionObserved
Lifetime (end of session)Destroyed when the session endsVendor-documented
Lifetime (idle time)Paused and later restored, or reclaimed and replacedVendor-documented for Claude Code cloud sessions. Inferred for the chat examined here
Background workA process the shell detaches (with nohup or &) usually stops a few minutes after a reply ends. The harness's own background jobs run until their time limitTool-documented (the session's environment notes)
NetworkOutbound traffic goes through a proxy, to allowed places only (an allowlist). Web lookups use separate toolsVendor-documented and observed
Your computerReached only through the Claude desktop app, and only in the folders you connectVendor-documented and observed

[Vendor-documented] Availability depends on the product and plan. Cloud tasks in a conversation are available on Pro, Max and Ultra, in beta on Team, and on Enterprise once an owner turns them on.1 Claude Code cloud sessions are available on Pro, Max and Team plans, and for Enterprise users with premium seats or Chat + Claude Code seats.2 The desktop app's Code tab also lets you choose Local, Cloud, SSH or WSL for each session.3 The settings that shape a cloud sandbox are in Cloud environments and self-hosted runners.

Demo: a Python program in the VM

[Observed] On November 8, 2026, a script named hello_vm.py was created, saved and run inside the session workspace.4 It printed:

Hello from the session VM!
Python: 3.13.18
OS: Linux-6.18.44-fc-v310-x86_64-with-glibc2.39
Working dir: /home/claude
Time (UTC): 2026-11-08 04:34
Squares 1-10: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] sum = 385

[Observed] Between writing the file and running it, the session was interrupted and resumed. The run had not happened. The file came back as a read-only copy from the conversation. [Inferred] The workspace had been replaced, because a restored VM keeps its own files. So anything installed or running was lost. A second change on November 9 is weaker evidence, as explained below.

The lesson: treat the VM as scratch space, a place for temporary work. Keep anything that matters in a delivered file, an artifact, Drive or a repository.

Where chat history lives

[Vendor-documented] Sessions and files are saved to the user's Claude account.1 [Observed] The harness held its own working copy of the conversation in the VM. [Inferred] The browser also holds only a copy. The saved record is the one on the account.

PlaceWhat it holdsSurvives a replaced VM?
Anthropic backendThe stored conversation, reachable from any deviceYes
Browser or appA cached copy, kept for displayIt reloads from the backend (inferred)
Harness in the VMThe working context for each model call, plus a transcript on diskNot if the VM is replaced. It is rebuilt from the backend (inferred)

The chat survived the replaced VM in the demo, because the backend copy counts. In local Claude Code, the transcript lives on your machine.

When the VM is paused, restored or replaced

[Vendor-documented] The sandbox is destroyed when the session ends.1 For Claude Code cloud sessions, Anthropic also documents what happens to an idle VM. "After a few minutes without activity, a session's VM pauses with its files saved. Your next message restores the same VM and starts Claude Code again." But "if the paused VM has since been reclaimed, reopening the session provisions a fresh VM." Reclaiming also stops background work that was still running.2,5

[Observed] In the session examined here, two things were seen. During the demo, the file came back only as a read-only copy from the conversation. On November 9, PID 1 had been running for about 19 minutes, after a long idle gap.

[Inferred] The demo fits a reclaimed VM and a fresh one, because a restored VM keeps its files. The uptime is weaker evidence. A restored VM may not count paused time as uptime. So a short uptime alone does not prove a new machine. [Unknown] Whether this chat session follows the documented Claude Code rules, and how long a paused VM is kept before it is reclaimed.

[Inferred] Pausing and reclaiming save computing power and keep each session clean.

Survives a reclaimed VMLost when the VM is reclaimed
The chat itselfInstalled packages
Files from the conversation (restored as copies)Running servers and background jobs
Artifacts and docsEnvironment variables and temporary files
Memory and connected appsAnything not written back into the conversation
Anything saved to your computer, Drive or a repository

In practice, plan for a fresh VM after a break, even though a short break may only pause it. Scripts should check for what they need and install it. Save important output outside the VM. Projects build this habit into the product.

Stateful sessions on a stateless model

The model is stateless, but the session around it remembers. The harness makes the difference.

  • Stateless model. The model keeps no memory between calls. For each call, the harness builds the context from instructions, the relevant history, tool results and the current state. When the context grows too large, the harness may compact it, summarize it, or fetch only what it needs. The session examined was configured to auto-compact at 80%. Prompt caching makes repeated context faster to process, but it is not memory.
  • Stateful session. Between calls, the harness holds a transcript, the VM's files, packages and tool results.
LayerState it holdsLifetime
Anthropic backendThe conversationSaved to the account (vendor-documented). How long it is kept is not covered here
Harness and VMWorking files, the environment, the transcript on diskUntil the VM is reclaimed or the session ends
Outside stores (memory, artifacts, Drive, repositories)Whatever you save thereAs long as you keep it

How long each layer keeps state. Each layer keeps state longer than the one above it. Relative lifetimes, not to scale, drawn as bars along an arrow labeled longer-lived. One model call: a tiny bar, nothing kept between calls. Harness and VM: a short bar, until the session ends or the VM is replaced. Backend conversation: a longer bar, saved to the account. Outside stores: the longest bar, highlighted, as long as you keep them. Design for this layer.

The model is a stateless function. The harness turns it into a stateful agent. With the API or the Agent SDK, your own code holds that state.

Check yourself

Question 1 / 4

0 answered

In the Python demo, what happened when the session was interrupted and resumed?

  1. As verified on November 9, 2026. Claude Cowork architecture overview, Anthropic.↑↑2↑3↑4
  2. As verified on November 9, 2026. The page quotes the idle pause and restore. Configure cloud environments, Anthropic.↑↑2
  3. Claude Desktop: Code tab docs, Anthropic.↑
  4. Panaversity's inspection of a cloud Claude session. The method is in the appendix.↑
  5. As verified on November 9, 2026. "Cloud sessions stop after a period of inactivity and the session's VM is reclaimed." Use Claude Code in the cloud, Anthropic.↑
Owner
Panaversity