Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

Agent Sandboxes

FreeRuns bundled scriptsNot checked

Operate E2B agent sandboxes using the CLI. Use when user needs to run code in isolation, test packages, execute commands safely, or work with binary files in…

dislerby disler★ 395 GitHub stars26 installs in other catalogs

About this skill

Agent Sandboxes

This skill provides access to E2B sandboxes through a streamlined CLI for safe code execution and file operations in isolated environments.

Variables

  • E2B_API_KEY: The environment variable containing the E2B API key (stored in the environment file)
  • SANDBOX_CLI_PATH: .claude/skills/agent-sandboxes/sandbox_cli/
  • ENVIRONMENT_FILE_PATH: ../../../../.env
  • TIMEOUT_DURATION_IN_SECONDS: 43200 (12 hours)

Prerequisites

Before using sandbox operations, validate the environment:

  1. Check for E2B_API_KEY:

    # Verify the API key is set
    grep "E2B_API_KEY" `ENVIRONMENT_FILE_PATH`
    

    If missing, instruct the user:

    Error: E2B_API_KEY not found in .env file
    
    Please add your E2B API key to the .env file in the project root:
    echo "E2B_API_KEY=your_api_key_here" >> .env
    
    Get your API key from: https://e2b.dev/docs
    
  2. Verify CLI is available: The sandbox CLI is located at SANDBOX_CLI_PATH The .env file is automatically loaded from the project root.

Instructions

  • IMPORTANT: Don't create files locally, always use the sandbox. Only do this if the user explicitly asks you to do so.
  • ALWAYS USE --timeout TIMEOUT_DURATION_IN_SECONDS
  • CAPTURE AND REMEMBER SANDBOX ID - Store it in your context, don't use shell variables or files
  • Multi-agent safe - Each agent tracks its own sandbox ID independently
  • Always validate E2B_API_KEY first - Don't proceed without it
  • Change directory to SANDBOX_CLI_PATH - All commands must be run from there
  • Use --shell for complex commands - Enables pipes, redirections, wildcards
  • Use --cwd instead of cd - More reliable for working directory changes
  • Binary files - Use upload/download for images, PDFs, executables
  • Never delete the sandbox unless you're explicitly asked to do so - Sandboxes auto-timeout after TIMEOUT_DURATION_IN_SECONDS

Template Tiers

Pre-built templates with different resource levels. Use --template flag with sbx init:

Template vCPU RAM Cost Best For
fullstack-vue-fastapi-node22 2 2GB $0.13/hr Simple apps (default)
fullstack-vue-fastapi-node22-lite 2 4GB $0.15/hr Browser tests
fullstack-vue-fastapi-node22-standard 4 4GB $0.27/hr Parallel builds
fullstack-vue-fastapi-node22-heavy 4 8GB $0.33/hr Multi-browser
fullstack-vue-fastapi-node22-max 8 8GB $0.44/hr Fastest

Build new templates: uv run build_template.py --tier <tier> or --list-tiers to see options.

When to Use Sandboxes

Use agent sandboxes when the user needs to:

  • Run untrusted or experimental code safely
  • Test packages or dependencies without affecting the local system
  • Execute system commands in an isolated environment
  • Work with binary files (images, PDFs, executables)
  • Clone and test repositories in isolation
  • Install and test different package versions
  • Run long-running processes without blocking

CLI Overview

The sandbox CLI has four core command groups:

  1. sbx init - Quick sandbox initialization
  2. sbx sandbox - Lifecycle management (create, connect, kill, pause, extend-lifetime, info)
  3. sbx files - File operations (ls, read, write, upload, download, rm, mkdir, mv)
  4. sbx exec - Unified command execution (the most powerful command)
  5. sbx browser - Browser automation for UI validation (visual testing)

Get CLI Help: Use sbx --help to see all available commands and options:

cd SANDBOX_CLI_PATH
uv run sbx --help           # Main help
uv run sbx init --help      # Help for init command
uv run sbx sandbox --help   # Help for sandbox commands
uv run sbx files --help     # Help for file operations
uv run sbx exec --help      # Help for exec command

Key Command: sbx exec

The exec command is the primary interface for running commands in sandboxes:

uv run sbx exec $SANDBOX_ID "command" [options]

Options:
  --cwd PATH          Working directory
  --env KEY=VALUE     Environment variables (multiple allowed)
  --root              Run as root user
  --shell             Enable shell features (pipes, redirections, wildcards)
  --timeout SECONDS   Command timeout (default: 60)
  --background        Run command in background

Important: All commands must be run from SANDBOX_CLI_PATH directory.

Key Command: sbx browser

Browser automation for visual validation of sandbox applications using Playwright's isolated Chromium.

Commands (all support --port PORT for parallel agents):

sbx browser init                        # First-time setup (once per machine)
sbx browser start [--headed]            # Start browser (--headed shows window)
sbx browser nav <url>                   # Navigate to URL
sbx browser eval <code>                 # Run JavaScript, returns result
sbx browser scree
Full SKILL.md on GitHub

Install Agent Sandboxes in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

build_template.pycookbook/browser.mdexamples/01_run_python_code.mdexamples/02_test_package.mdexamples/03_clone_and_test_repo.mdexamples/04_process_binary_files.mdexamples/05_host_frontend.mdprompts/browse.mdprompts/browser-testing.mdprompts/build.mdprompts/download.mdprompts/host.mdprompts/plan-build-host-test.mdprompts/plan-full-stack.mdprompts/reboot.mdprompts/sandbox.mdprompts/test.mdsandbox_cli/.gitignoresandbox_cli/.python-versionsandbox_cli/README.mdsandbox_cli/pyproject.tomlsandbox_cli/src/__init__.pysandbox_cli/src/commands/__init__.pysandbox_cli/src/commands/browser.pysandbox_cli/src/commands/exec.pysandbox_cli/src/commands/files.pysandbox_cli/src/commands/sandbox.pysandbox_cli/src/main.pysandbox_cli/src/modules/__init__.pysandbox_cli/src/modules/browser.pysandbox_cli/src/modules/commands.pysandbox_cli/src/modules/files.pysandbox_cli/src/modules/sandbox.pysandbox_cli/temp/banana-pokemon-cards-iicr81igq2rw6a5qm2p65/README.mdsandbox_cli/temp/banana-pokemon-cards-iicr81igq2rw6a5qm2p65/index.htmlsandbox_cli/temp/claude-code-sonnet-4-5--easy_notes_app/App.vuesandbox_cli/temp/claude-code-sonnet-4-5--easy_notes_app/NoteEditor.vuesandbox_cli/temp/claude-code-sonnet-4-5--easy_notes_app/NotesList.vuesandbox_cli/temp/claude-code-sonnet-4-5--easy_notes_app/api.tssandbox_cli/temp/claude-code-sonnet-4-5--easy_notes_app/crud.py

FAQ

What does the Agent Sandboxes skill do?

Operate E2B agent sandboxes using the CLI. Use when user needs to run code in isolation, test packages, execute commands safely, or work with binary files in a sandbox environment. Keywords: sandbox, e2b, isolated environment, run code, test code, safe execution.

How do I install the Agent Sandboxes skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the Agent Sandboxes skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare Agent Sandboxes with