-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
component-e2bE2B sandbox integrationE2B sandbox integrationenhancementNew feature or requestNew feature or requestphase-2-multi-providerPhase 2: Multi-provider sandbox architecture (v2.5)Phase 2: Multi-provider sandbox architecture (v2.5)priority-lowLow priority - when convenientLow priority - when convenient
Description
Overview
Automatically select the best sandbox provider based on task characteristics when no explicit provider is specified.
Selection Criteria
Task Duration
- < 5 minutes: Native/Docker (free, instant)
- 5-30 minutes: Native/Docker or E2B
-
30 minutes: E2B (more reliable for long tasks)
Resource Requirements
- Low CPU/memory: Native
- Medium: Docker
- High/GPU: E2B (dedicated VM)
Network Requirements
- No external access: Native (most secure)
- External APIs: Docker or E2B
- Full network: E2B
User Preference
- Cost-conscious: Native > Docker > E2B
- Speed-focused: E2B (parallel VM)
- Security-focused: Native (OS-level isolation)
Implementation
// src/e2b/providers/auto-select.ts
export interface TaskHints {
estimatedDuration?: number; // minutes
requiresNetwork?: boolean;
requiresGpu?: boolean;
resourceIntensity?: 'low' | 'medium' | 'high';
costSensitive?: boolean;
}
export function selectProvider(
hints: TaskHints,
available: string[]
): string {
// Quick tasks → prefer free providers
if (hints.estimatedDuration && hints.estimatedDuration < 5) {
if (available.includes('native')) return 'native';
if (available.includes('docker')) return 'docker';
}
// Long tasks → prefer E2B for reliability
if (hints.estimatedDuration && hints.estimatedDuration > 30) {
if (available.includes('e2b')) return 'e2b';
}
// Cost-sensitive → prefer free options
if (hints.costSensitive) {
if (available.includes('native')) return 'native';
if (available.includes('docker')) return 'docker';
}
// Default: use E2B if available
if (available.includes('e2b')) return 'e2b';
// Fallback to first available
return available[0] || 'e2b';
}CLI Integration
# Let parallel-cc decide
parallel-cc sandbox-run --repo . --prompt "Quick fix" --auto-provider
# Provide hints
parallel-cc sandbox-run --repo . --prompt "Long task" \
--estimated-duration 45 \
--cost-sensitiveFiles to Create
- `src/e2b/providers/auto-select.ts`
- `tests/e2b/auto-select.test.ts`
Acceptance Criteria
- Auto-selection chooses appropriate provider
- User hints influence selection
- Fallback chain works when preferred unavailable
- Clear logging of selection reasoning
- Unit tests cover various scenarios
Dependencies
- Depends on [v2.5] Add provider registry and factory pattern #32 (Provider registry)
- Depends on [v2.5] Implement NativeProvider using srt CLI #33, [v2.5+] Implement DockerProvider #34 (Native/Docker providers)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
component-e2bE2B sandbox integrationE2B sandbox integrationenhancementNew feature or requestNew feature or requestphase-2-multi-providerPhase 2: Multi-provider sandbox architecture (v2.5)Phase 2: Multi-provider sandbox architecture (v2.5)priority-lowLow priority - when convenientLow priority - when convenient