Skip to content

[P4] Phase 6.0 Sandbox execution environments (E2B, Docker, and others) #49

@frankbria

Description

@frankbria

Summary

Allow users to launch Ralph in isolated sandbox environments rather than directly on the local machine. This provides security isolation, reproducible environments, and protects the host system from autonomous code execution.

Problem Statement

Ralph currently executes Claude Code directly on the local machine, which has risks:

  • Code can modify/delete local files unexpectedly
  • Code can access sensitive data on the host
  • No isolation between different projects
  • Difficult to reproduce exact environments
  • Security concerns with autonomous code execution

First-Class Sandbox Providers

Three sandbox platforms are implemented as first-class backends:

Provider Type Best For
E2B Cloud-hosted, ephemeral AI-agent workloads, pay-per-use
Daytona Self-hosted Corporate environments, persistent workspaces
Cloudflare Edge compute Global distribution, Cloudflare ecosystem

Additional Backends

Other sandbox platforms (Gitpod, Codespaces, Modal, Replit, etc.) can be added as plugins via the generic sandbox interface (Phase 6.5).

Proposed CLI Interface

# Local Docker container
ralph --sandbox docker

# Cloud providers
ralph --sandbox e2b
ralph --sandbox daytona
ralph --sandbox cloudflare

# Common options
ralph --sandbox <type> --sync-strategy snapshot|realtime
ralph --sandbox <type> --ephemeral|--persist
ralph --sandbox <type> --max-duration 30m

Sub-Issues

Phase Issue Description
6.1 #74 Local Docker Sandbox Execution (foundation)
6.2 #75 E2B Cloud Sandbox Integration
6.3 #76 Sandbox File Synchronization
6.4 #77 Sandbox Security and Resource Policies
6.5 #78 Generic Sandbox Interface (plugin architecture)
6.6 #79 Daytona Sandbox Integration
6.7 #80 Cloudflare Sandbox Integration

Cross-cutting Concerns

All sandbox implementations must address:

  1. File Synchronization ([P4] Phase 6.3 Sandbox File Synchronization #76) - Getting code in and artifacts out
  2. Secret Management ([P4] Phase 6.4 Sandbox Security and Resource Policies #77) - Secure credential injection
  3. Monitoring Integration - ralph-monitor with remote execution
  4. Cost Management - For cloud-based sandboxes
  5. State Persistence - Ephemeral vs. persistent environments

Implementation Order

Recommended implementation sequence:

  1. Docker ([P4] Phase 6.1 Local Docker Sandbox Execution #74) - Foundation, no external dependencies
  2. File Sync ([P4] Phase 6.3 Sandbox File Synchronization #76) - Needed by all backends
  3. Security Policies ([P4] Phase 6.4 Sandbox Security and Resource Policies #77) - Needed by all backends
  4. E2B ([P4] Phase 6.2 E2B Cloud Sandbox Integration #75) - First cloud provider
  5. Generic Interface ([P4] Phase 6.5 Generic Sandbox Interface and Plugin Architecture #78) - Abstract the pattern
  6. Daytona ([P4] Phase 6.6 Daytona Sandbox Integration #79) - Self-hosted option
  7. Cloudflare ([P4] Phase 6.7 Cloudflare Sandbox Integration #80) - Edge compute option

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions