Skip to content

[v2.5] Implement NativeProvider using srt CLI #33

@frankbria

Description

@frankbria

Overview

Implement a native sandbox provider using Anthropic's srt (sandbox runtime) CLI tool. This enables free, local sandboxing without cloud costs.

What is srt?

The srt CLI is Anthropic's sandboxing tool that uses:

  • macOS: Seatbelt sandboxing
  • Linux: bubblewrap (bwrap)

It provides secure, isolated execution environments on the local machine.

Implementation

// src/e2b/providers/native-provider.ts

export class NativeProvider implements SandboxProvider {
  readonly name = 'native';
  readonly version = '1.0.0';
  
  static async isAvailable(): Promise<boolean> {
    // Check if srt CLI is installed
    try {
      execSync('srt --version', { stdio: 'pipe' });
      return true;
    } catch {
      return false;
    }
  }
  
  async create(config: SandboxConfig): Promise<SandboxInstance> {
    // Create sandbox using srt
    // srt create --name <name> --workdir <path>
  }
  
  async execute(instanceId: string, command: string): AsyncGenerator<string> {
    // Execute in sandbox
    // srt exec <instanceId> -- <command>
  }
  
  // ... implement remaining interface methods
}

Key Differences from E2B

Aspect E2B Native (srt)
Startup ~150ms Instant
Cost $0.10/hr Free
Isolation Full VM OS-level sandbox
Timeout 1 hour max Unlimited
Network Full access Configurable
Resources Cloud scale Local machine

Use Cases

  • Quick tasks (<5 min)
  • Development/testing
  • Offline work
  • Cost-conscious users

Files to Create

  • src/e2b/providers/native-provider.ts
  • tests/e2b/native-provider.test.ts

Acceptance Criteria

  • Works on macOS with Seatbelt
  • Works on Linux with bubblewrap
  • File upload/download works
  • Command execution with output streaming
  • Proper cleanup on destroy
  • Integration tests pass

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    component-e2bE2B sandbox integrationenhancementNew feature or requestphase-2-multi-providerPhase 2: Multi-provider sandbox architecture (v2.5)priority-mediumMedium priority - next milestonetype-featureNew feature implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions