Sandboxes

Containerized execution environments that provide secure, isolated spaces for AI coding assistants to run code and interact with your projects.

What is a Sandbox?

A Sandbox is a persistent Cloudflare Container that provides a secure execution environment for your projects. AI coding assistants like Claude Code, Cursor, and Windsurf connect to sandboxes via WebSocket to execute commands, read/write files, and interact with your codebase.

Containerized

Built on Cloudflare's Sandbox SDK for secure, isolated execution.

WebSocket Connected

Real-time communication with AI assistants via WebSocket gateway.

Persistent

State persists across sessions for continuous development workflows.

Connection Architecture

How AI Assistants Connect

AI Assistant
Claude Code, Cursor, etc.
WebSocket Gateway
api.rizome.dev/v1/sandbox
Sandbox Container
Your project environment
WebSocket Connection URL
wss://api.rizome.dev/v1/sandbox/{sandboxId}/connect?token={jwt_or_api_key}

Creating Sandboxes

From Project

Create a sandbox linked to a specific project (recommended):

API Method
curl -X POST https://api.rizome.dev/v1/sandboxes \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d {{
"name": "feature-auth-sandbox",
"project_id": "proj_123456",
"instance_type": "basic"
}
CLI Method
rizome sandbox create --project feature-auth

Standalone Sandbox

Create a sandbox without a specific project (for experimentation):

CLI Method
rizome sandbox create experiment-sandbox --standalone

Sandbox Operations

Command Execution

Execute commands in the sandbox environment:

WebSocket Message
{
  "type": "exec",
  "id": "req-1",
  "payload": {
    "command": "npm install",
    "cwd": "/workspace/project"
  }
}

File Operations

Read, write, and watch files in real-time:

WebSocket Message
{
  "type": "file.read",
  "id": "req-2",
  "payload": {
    "path": "/workspace/src/index.ts"
  }
}

Port Forwarding

Expose ports for preview and testing:

Expose port 3000
POST /v1/sandboxes/:id/ports
Access at: https://sbx-123-3000.rizome.dev

Git Integration

Full git operations within the sandbox:

git status, git commit, git push
Synced with your project's worktree automatically

AI Assistant Integration

Claude Code

claude --connect-sandbox sbx_123

Direct integration with Claude Code's native sandbox protocol.

Cursor

cursor --remote-ssh rizome://sbx_123

Connect via SSH tunnel to work with remote development.

Windsurf

windsurf --workspace wss://api.rizome.dev/...

WebSocket connection for real-time collaboration.

Instance Types

Basic

Recommended
• 2 CPU cores
• 4GB RAM
• 20GB storage
• Basic networking
$0.10/hour

Standard

Popular
• 4 CPU cores
• 8GB RAM
• 50GB storage
• Enhanced networking
$0.25/hour

Performance

High-end
• 8 CPU cores
• 16GB RAM
• 100GB storage
• Premium networking
$0.50/hour

Security & Isolation

Built-in Security Features

Container Isolation

Each sandbox runs in a fully isolated container with no access to other workspaces

Path Restrictions

All file operations limited to /workspace directory

Resource Limits

CPU, memory, and disk usage capped per instance type

Encrypted Communication

All WebSocket connections secured with TLS encryption

Access Control

JWT and API key authentication required for all connections

Audit Logging

Complete audit trail of all operations and connections

Next Steps

Technical Reference

Detailed technical documentation for sandbox operations and WebSocket protocol.