← All posts

Don't Let Your AI Agent Break Your Laptop: The Case for Ephemeral Sandboxes

August 10, 2026 · 4 min read · The xShellz Team

TL;DR

  • Permanent xshellz.boxes keep your agent running 24/7 with a persistent /root home directory, ideal for long-running services like znc or eggdrop.
  • Ephemeral sandboxes isolate risky tasks in a gVisor-backed environment where root is fake, so an AI agent cannot damage your host system.
  • Both ship with 6 preinstalled coding agent CLIs and your xshellz.box manifest, so you can reproduce any environment in seconds.

Use a permanent xshellz.box when your AI agent needs to run around the clock and retain state: an IRC bouncer, a monitoring bot, an always-on coding agent. Use a throwaway sandbox when you are about to let an AI execute untrusted code or perform a sweeping refactor that might delete your home directory. We build and operate xShellz: the borg terminal agent, the Agent Shell boxes and the hosted model gateway behind them. This is the setup we run in production ourselves.

when should I use a throwaway sandbox vs a permanent server for my AI agent?

A permanent box stays on 24/7 with no idle timeout. Its /root directory persists across reboots, so you can install znc, eggdrop, or a development environment and expect it to be there tomorrow. That makes it the right home for long-running agents and services.

A throwaway sandbox is the opposite. Spin it up, give an agent root, let it run a risky command, then shut it down. Because the entire filesystem is ephemeral, nothing the agent does survives the session. This is how you safely test a pull request that pipes a shell script straight into bash, or let an AI refactor an entire codebase without worrying about what gets deleted.

what is an ephemeral sandbox for AI agents?

It is a short-lived Linux container that gives the agent real root inside its own isolated namespace, while the underlying host stays completely protected. Every sandbox runs under a gVisor sandbox kernel with Linux user namespaces and Docker userns-remap. Root inside the box is fake root, mapped to an unprivileged user on the host.

An ephemeral sandbox comes with the same Ubuntu 24.04 image as a permanent box, including the same 6 preinstalled coding agent CLIs and 23 one-click apps. You start it, do the dangerous work, and tear it down. Nothing leaks.

how do I spin up a temporary linux box for an AI to run risky code?

Launch a sandbox through the xShellz dashboard or SDK. You will receive an ssh connection string with a random host and port. Then run any of the preinstalled agents over that SSH connection. For a one-shot agentic task with borg:

ssh -p <port> root@<host> "borg 'apply the patch from #42 and run the full test suite'"

The sandbox ships with borg, Claude Code, opencode, and the other agent CLIs directly in the path. No additional installs needed.

what's the difference between a permanent xshellz.box and a throwaway sandbox?

A permanent Agent Shell box is designed for always-on workloads. Its /root home directory survives image rebuilds, so services like znc, eggdrop, or a persistent tmux session remain intact. You pay a flat monthly fee and the box never goes idle.

An ephemeral sandbox is intended for single jobs. The entire filesystem is transient. There is no persistent /root; when the box stops, all data is gone. Because you only pay for the minutes it runs, a sandbox costs a fraction of a permanent box, making it economical for sporadic risky tasks.

how much does it cost to run an AI agent in a sandbox?

That depends on how long you run it. A permanent box has a fixed monthly cost; the free tier includes one always-on box with zero idle timeout. Ephemeral sandboxes are billed per minute. Spinning up a sandbox for a 20-minute refactor costs pennies, not dollars. There is no charge for a sandbox that is stopped or destroyed, and you are never billed for idle time because the box exists only while you use it.

Frequently asked questions

Does a sandbox have the same AI tools as a permanent box?

Both run the same Ubuntu 24.04 image with the same preinstalled software: 6 coding agent CLIs (borg, Claude Code, Codex, Gemini CLI, opencode, pi), Node 22, Python 3, git, ripgrep, and build-essential. There is no setup gap.

Can I keep my changes after the sandbox stops?

No. The filesystem is ephemeral. Push code to git or export important files before you stop the box. If you need a specific toolset on every sandbox boot, put it in the xshellz.box manifest file in your home directory. It reinstalls on every boot.

How isolated is the sandbox from my host machine?

The sandbox uses a gVisor kernel and userns-remap so that root inside the sandbox is not real root on the host. The agent cannot access your host filesystem, network interfaces, or other boxes. This isolation is what makes it safe to give an AI unrestricted root inside the sandbox.