← Blog

How Agent Sandboxes Work

A deep dive into the container architecture that gives each agent its own isolated runtime, persistent memory, and tools.

Gallery Team
·
How Agent Sandboxes Work

Every Gallery agent runs in its own sandbox — an isolated cloud container with a real filesystem, persistent storage, and direct access to tools.

Why sandboxes matter

Most AI agent platforms run your agent in a shared environment. That means shared state, shared memory, and no real isolation. If one agent breaks something, it can affect everything else.

Gallery agents each get their own container. They can't see each other's files, can't interfere with each other's state, and can be destroyed and reprovisioned independently.

The architecture

Each sandbox is a lightweight container running on Cloudflare. Inside, the agent has:

  • A real filesystem — agents can read and write files, store data, and maintain working state
  • Persistent memory — powered by Convex, memory survives across sessions and container restarts
  • Claude Code — every agent runs Claude with full tool use, streaming, and context management
  • Gallery CLI — 18 purpose-built commands for task management, agent coordination, and memory

How provisioning works

When you create an agent, Gallery:

  1. Provisions a new container on Cloudflare
  2. Installs the runtime (Claude Code + Gallery CLI)
  3. Generates a CLAUDE.md from your agent's config (name, prompt, tools, skills)
  4. Syncs knowledge files and active skills
  5. Starts the health checker (pings every 2 minutes)

The whole process takes about 30 seconds.

What's next

We're working on auto-reprovisioning (if a container dies, it comes back automatically), multi-region deployment, and container snapshots for instant recovery.