The mental model: the sandbox IS the computer
The wrong way to think about this is "proxy Claude Code's bash calls to a remote API." That's backwards. Claude Code is a TUI — a terminal user interface. It reads files, runs bash, calls git, uses grep. It's designed to run inside a terminal on a real machine.
So give it a real machine. The sandbox IS the machine. You SSH into it, install Claude Code there, run claude, and everything it does happens inside that isolated environment. It has its own filesystem, its own git config, its own package managers, its own processes. It can't see your laptop. Your laptop can't see it.
This is the same pattern developers have used for decades — working on a remote server. The difference is the server is API-provisioned, auto-stops when idle, bills by the minute, and you can spin up 10 of them for 10 different tasks.
Why not just use your laptop?
Claude Code on your laptop is great for pair-programming on a feature branch. It stops being great when:
- You need isolation. Claude Code runs
pip install,npm install, and arbitrary shell commands. A hallucinatedrm -rf /or a malicious dependency has full access to your real filesystem, your SSH keys, your AWS credentials. On a sandbox, the blast radius is a disposable VM. - You need it to run while you sleep. Close your laptop, the agent dies. A sandbox keeps running. Kick off a 4-hour test suite or an overnight research job and check the results in the morning.
- You need more than one. Agent Teams spawns parallel workers in git worktrees, but the compute is still your machine. Eight agents on a MacBook means CPU thrashing. Eight sandboxes means eight independent machines.
- You need a clean room. "Works on my machine" applies to agents too. Your laptop has a hundred things installed. A fresh sandbox has exactly what you put there. Reproducible, every time.
- You need to hand off a workspace. A sandbox with Claude Code installed is a shareable dev environment. Send someone the SSH command and they're in the same workspace the agent built.
Claude Code on your laptop
- Agent has your credentials, your files, your everything
- One machine, shared with Slack, Chrome, and Spotify
- Dies when you close the lid or lose WiFi
- Can't run 10 agents in parallel
- "Works on my machine" environment drift
Claude Code on a sandbox
- Isolated VM — trash it and spin up a new one
- Dedicated CPU and RAM, no resource contention
- Persists across sessions, runs overnight unattended
- Spin up 10 for 10 tasks, each with its own machine
- Fresh Ubuntu every time, reproducible by design
Quickstart: Claude Code on a sandbox in 5 minutes
Create a sandbox
Use the API or dashboard to provision a ab0t.medium (2 vCPU, 4 GB RAM). This takes about 30 seconds.
# Set your API key export SANDBOX_API_KEY="ab0t_sk_live_YOUR_KEY_HERE" export SANDBOX_URL="https://sandbox.dev.ab0t.com" # Create the sandbox curl -s -X POST "$SANDBOX_URL/api/sandboxes" \ -H "Authorization: Bearer $SANDBOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "claude-code-dev", "instance_type": "ab0t.medium", "auto_stop_minutes": 120 }' | jq . # Response: # { # "sandbox_id": "sandbox_a1b2c3d4", # "status": "pending", # "instance_ip": "54.xx.xx.xx", # "hourly_cost": "0.04" # }
Upload your SSH key and connect
Upload your public key so you can SSH in, or use a short-lived certificate.
# Upload your SSH key curl -s -X POST "$SANDBOX_URL/api/ssh-keys" \ -H "Authorization: Bearer $SANDBOX_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"name\": \"my-laptop\", \"public_key\": \"$(cat ~/.ssh/id_ed25519.pub)\" }" # SSH into the sandbox (once status is "running") ssh ubuntu@54.xx.xx.xx
Install Claude Code on the sandbox
You're now inside the sandbox. Install Claude Code and authenticate.
# Install Node.js (Claude Code requires it) curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt-get install -y nodejs git # Install Claude Code npm install -g @anthropic-ai/claude-code # Set your Anthropic API key export ANTHROPIC_API_KEY="sk-ant-YOUR_KEY_HERE" # Verify it works claude --version
Use Claude Code like normal — but it's on the sandbox
Everything Claude Code does now happens on the sandbox VM. Git clones, pip installs, test runs, file edits — all on isolated cloud compute.
# Clone your project git clone https://github.com/your-org/your-project.git cd your-project # Start Claude Code claude # Now use Claude Code exactly as you normally would: > Run the test suite and fix any failures. > Install whatever dependencies are needed. > Make a new branch and commit your changes. # Claude Code runs `pip install`, `pytest`, `git commit` etc. # All of it happens on the sandbox. Your laptop is free.
Claude Code is now running on a dedicated cloud machine. It has its own filesystem, its own packages, its own git config. You can close your terminal, reconnect later, and everything is still there (the sandbox persists). When you're done, stop the sandbox to pause billing.
Automate the setup with a bootstrap script
You'll want to standardize the sandbox environment so every instance starts with Claude Code, your tools, and your config ready to go. Here's a bootstrap script you can pass to the sandbox on creation:
#!/bin/bash # Bootstrap script for Claude Code sandboxes # Upload this and run it after SSH-ing in, or execute via the API: # POST /api/sandboxes/{id}/execute {"command": "bash /workspace/bootstrap.sh"} set -euo pipefail echo "=== Installing system packages ===" sudo apt-get update -qq sudo apt-get install -y -qq nodejs npm git curl jq ripgrep fd-find tmux echo "=== Installing Claude Code ===" sudo npm install -g @anthropic-ai/claude-code echo "=== Setting up git config ===" git config --global user.name "Claude Code Agent" git config --global user.email "agent@your-company.com" git config --global init.defaultBranch main echo "=== Creating workspace ===" mkdir -p /home/ubuntu/workspace cd /home/ubuntu/workspace echo "=== Writing CLAUDE.md ===" cat > CLAUDE.md << 'EOF' # Agent workspace You are running on a cloud sandbox (Ubuntu, ab0t.medium). This is an isolated machine — you have full root access. Install any packages you need with apt-get or pip or npm. ## Guidelines - Commit frequently with descriptive messages. - Run tests after every change. - If a test suite takes longer than 10 minutes, break it into parallel runs. - Save important outputs to /home/ubuntu/workspace/output/. EOF echo "=== Ready. Run: claude ==="
You can automate this further by using the execute API to run the bootstrap right after sandbox creation — no SSH needed:
# Create sandbox and run bootstrap in one go SANDBOX=$(curl -s -X POST "$SANDBOX_URL/api/sandboxes" \ -H "Authorization: Bearer $SANDBOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"claude-agent","instance_type":"ab0t.medium","auto_stop_minutes":120}') SANDBOX_ID=$(echo "$SANDBOX" | jq -r '.sandbox_id') echo "Created: $SANDBOX_ID — waiting for boot..." sleep 45 # Run bootstrap curl -s -X POST "$SANDBOX_URL/api/sandboxes/$SANDBOX_ID/execute" \ -H "Authorization: Bearer $SANDBOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{"command": "curl -sL https://your-company.com/bootstrap-claude-code.sh | bash"}' | jq . echo "Sandbox ready. SSH in with:" echo " ssh ubuntu@$(echo $SANDBOX | jq -r '.instance_ip')"
Running multiple agents in parallel
This is where the sandbox model really shines. Want to test your project across three Python versions? Create three sandboxes.
# Create 3 sandboxes, one per Python version for pyver in 3.10 3.11 3.12; do RESULT=$(curl -s -X POST "$SANDBOX_URL/api/sandboxes" \ -H "Authorization: Bearer $SANDBOX_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"name\":\"test-py${pyver}\",\"instance_type\":\"ab0t.small\",\"auto_stop_minutes\":60}") SID=$(echo "$RESULT" | jq -r '.sandbox_id') echo "Python $pyver sandbox: $SID" done # Wait for all to boot, then SSH into each in a separate tmux pane # and run: claude "Clone myrepo, install Python $VER, run pytest" # Each agent works independently on its own machine. # # Cost: 3 x ab0t.small x 20 min = $0.02 total
Or use Claude Code's Agent Teams feature. With sandboxes already provisioned, the team lead assigns each worker to an SSH session on a different sandbox:
> I have three sandboxes running:
> - sandbox_py310 at 54.1.2.3 (Python 3.10)
> - sandbox_py311 at 54.4.5.6 (Python 3.11)
> - sandbox_py312 at 54.7.8.9 (Python 3.12)
>
> Use Agent Teams to SSH into each one and run the full test suite
> for github.com/myorg/myproject. Report which tests pass/fail on
> each version. Use the execute API at $SANDBOX_URL/api/sandboxes/{id}/execute
> if SSH isn't available yet.
Run agents overnight
The sandbox persists even when you disconnect. Set a generous auto_stop_minutes (or 0 for never), SSH in, start Claude Code inside tmux, detach, and close your laptop.
# Start a tmux session tmux new -s agent # Inside tmux: set your key and start Claude Code export ANTHROPIC_API_KEY="sk-ant-YOUR_KEY" cd /home/ubuntu/workspace/my-project # Give it a big task claude "Refactor the entire authentication module from callbacks to async/await. Update all call sites. Run the test suite after each file change. Keep going until all 847 tests pass. Commit each logical change separately. I'll check the results in the morning." # Detach from tmux: press Ctrl+B, then D # Close your laptop. Go to sleep. # Tomorrow: ssh back in and run `tmux attach -t agent`
A ab0t.medium running for 8 hours costs $0.32. That's less than a cup of coffee for a full night of autonomous coding. Set auto_stop_minutes: 0 for overnight tasks so the sandbox doesn't idle-stop between Claude Code's thinking pauses.
What to run on sandbox Claude Code
Now that Claude Code has its own machine, here are the tasks that benefit most:
Large refactors
Give it a multi-hour refactoring job. It won't compete with your local dev environment for CPU. It won't die when your laptop sleeps. Let it churn through hundreds of files while you do other work.
Dependency audits
Clone an unfamiliar repo, install its dependencies, and audit what runs during installation. All in a disposable VM — if a postinstall script is malicious, it can't reach your real machine.
Test matrix
Spin up N sandboxes for N configurations. Python versions, Node versions, OS versions, database versions. Each runs the full suite in parallel. Collect results.
PR review with execution
For every PR, spin up a sandbox, checkout the branch, run the tests, check for regressions. Post results as a PR comment. The sandbox dies after the review.
Exploring new codebases
Clone a large open-source project and tell Claude Code to read it, run it, and explain the architecture. All on a sandbox — the project's dependencies don't pollute your machine.
What it costs
| Task | Instance | Duration | Cost |
|---|---|---|---|
| Quick test run | ab0t.micro | ~10 min | $0.002 |
| Feature development session | ab0t.medium | ~2 hrs | $0.08 |
| Overnight refactor | ab0t.medium | ~8 hrs | $0.32 |
| 3-way test matrix (parallel) | 3x ab0t.small | ~20 min each | $0.02 |
| Full-day coding with idle gaps | ab0t.medium, auto-stop | ~4 hrs active | $0.16 |
| GPU ML experiment | ab0t.gpu | ~30 min | $0.27 |
Devin charges ~$9/hour ($2.25 per 15-min ACU). A ab0t.medium sandbox costs $0.04/hour and you bring your own model. For a 2-hour coding session, that's $18 with Devin vs $0.08 + your Anthropic API costs with a sandbox.
Tips for production use
Always use tmux or screen
If your SSH connection drops, tmux keeps Claude Code running. Without it, a network blip kills your agent mid-task. Install tmux in your bootstrap script.
Set auto_stop_minutes appropriately
For interactive sessions: 60–120 minutes. For overnight jobs: 0 (never auto-stop). For CI-like tasks: 30 minutes. The #1 cause of unexpected bills is forgetting to stop a sandbox with auto-stop disabled.
Use ab0t.micro for simple tasks
Not every task needs 4 GB of RAM. Linting, formatting, simple test suites, and code review all run fine on a ab0t.micro at $0.01/hr — 4x cheaper than ab0t.medium.
Pre-bake your bootstrap into a custom Docker image
If your team uses the same setup every time (Node + Python + Claude Code + your internal tools), build a Docker image with everything pre-installed. Pass it as docker_image when creating the sandbox. Cold start drops from 2 minutes to 30 seconds.
Set up a CLAUDE.md in your bootstrap
The bootstrap script writes a CLAUDE.md to the workspace. Claude Code reads this automatically. Use it to tell the agent about the sandbox environment, coding standards, and what tools are available.
Troubleshooting
SSH connection refused
The sandbox takes 30–60 seconds to boot. Wait until the status is running (poll GET /api/sandboxes/{id}). Also verify your SSH key was uploaded before the sandbox was created.
Claude Code says "command not found"
The bootstrap script didn't run, or Node.js isn't installed. SSH in and run the bootstrap manually. Check that node --version and claude --version both return output.
Agent runs out of disk space
Default sandboxes have 8 GB of disk. For large repos or ML datasets, use a ab0t.large (16 GB) or ab0t.xlarge (32 GB). Check usage with df -h.
Sandbox stopped unexpectedly
Check auto_stop_minutes. If Claude Code was thinking (not executing commands) for longer than the idle timeout, the sandbox may have stopped. Set a higher timeout or use 0 for long tasks.
Can't authenticate Claude Code inside the sandbox
Set ANTHROPIC_API_KEY as an environment variable inside the sandbox. Add it to your bootstrap script or ~/.bashrc. Don't hardcode it in CLAUDE.md.
What's next
Give your agent its own machine
SSH in. Run claude. Walk away. Isolated, metered, instant.
Get Started Free