Skip to main content

Sandbox Providers

Wit supports two sandbox provider modes for running AI agents in isolated environments:
  • Docker: Self-hosted container-based sandboxes for local development and air-gapped environments
  • ComputeSDK: Cloud sandboxes via ComputeSDK - unified access to E2B, Daytona, Modal, CodeSandbox, Vercel, and more

Overview

Sandbox providers enable:
  • Secure code execution - Isolated environments prevent AI from affecting your local system
  • Full development environments - PTY support, file system access, and command execution
  • Resource limits - Control CPU, memory, and disk usage
  • Network isolation - Optional network restrictions for security

Available Providers

ComputeSDK Underlying Providers

ComputeSDK provides unified access to multiple cloud providers:

Docker Provider

Local container-based sandboxes using Docker. Best for self-hosted deployments.

Features

  • Full PTY support via docker exec
  • Resource limits (CPU, memory, disk)
  • Network isolation
  • Volume mounting for repository access
  • No external dependencies (self-hosted)

Configuration

Environment Variables

Creating a Session

Building the Sandbox Image


ComputeSDK Provider

Unified multi-provider access via ComputeSDK. Provides access to E2B, Daytona, Modal (GPU!), CodeSandbox, Vercel, and more through a single API.

Features

  • Unified API across all cloud providers
  • Zero-config auto-detection from environment variables
  • GPU access via Modal for ML workloads
  • Collaborative sandboxes via CodeSandbox
  • Seamless provider switching without code changes

Configuration

Environment Variables

Auto-Detection Order

ComputeSDK auto-detects the provider based on which credentials are present:
  1. Modal - MODAL_TOKEN_ID + MODAL_TOKEN_SECRET
  2. E2B - E2B_API_KEY
  3. Daytona - DAYTONA_API_KEY
  4. CodeSandbox - CODESANDBOX_TOKEN

Creating a Session

GPU Workloads with Modal


Quick Start

Using the Manager

The recommended way to use sandboxes is through the SandboxManager:

Environment-Based Configuration


Provider Comparison

When to Use Each Provider

Feature Comparison


Health Checks

All providers implement health checks:

Session Management

Listing Sessions

Getting Session Stats

Session Information


Error Handling


Best Practices

  1. Always clean up sessions - Call session.stop() when done
  2. Set appropriate timeouts - Prevent runaway sessions
  3. Use resource limits - Prevent resource exhaustion
  4. Handle errors gracefully - Sessions can fail unexpectedly
  5. Monitor session stats - Track resource usage
  6. Use environment variables - Never hardcode API keys
  7. Choose the right provider - Docker for self-hosted, ComputeSDK for cloud