Esprit automatically selects the runtime based on your configuration:
esprit/interface/main.py
def _should_use_cloud_runtime() -> bool: """Check if scan runtime should be routed to Esprit Cloud.""" from esprit.auth.credentials import get_user_plan, is_authenticated, verify_subscription if not is_authenticated(): return False model_name = Config.get("esprit_llm") if not _is_cloud_subscription_model(model_name): return False # Verify subscription with server verification = verify_subscription(force_refresh=True) if verification.get("valid", False): cloud_enabled = verification.get("cloud_enabled") return bool(cloud_enabled) if cloud_enabled is not None else True # Fallback to local plan data if server unreachable error = str(verification.get("error", "")) return error.startswith("Subscription verification failed:") and _is_paid_subscription_plan(get_user_plan())
def _cleanup_orphaned_cloud_sandboxes(console: Console) -> None: """Best-effort cleanup for cloud sandboxes left by abrupt previous exits.""" from esprit.auth.credentials import get_auth_token from esprit.runtime.cloud_runtime import CloudRuntime access_token = get_auth_token() if not access_token: return api_base = os.getenv("ESPRIT_API_URL", "https://esprit.dev/api/v1") try: cleaned = asyncio.run(CloudRuntime.cleanup_stale_sandboxes(access_token, api_base)) except Exception: logging.debug("Failed to run stale cloud sandbox cleanup", exc_info=True) return if cleaned > 0: suffix = "sandbox" if cleaned == 1 else "sandboxes" console.print(f"[dim]Cleaned up {cleaned} stale cloud {suffix} from previous runs.[/]")
Orphaned sandboxes are automatically cleaned up on the next run.
def pull_docker_image() -> None: console = Console() client = check_docker_connection() image_name = Config.get("esprit_image") preferred_platform = (Config.get("esprit_docker_platform") or "").strip() or None # On macOS, always request linux/amd64 unless explicitly overridden. if preferred_platform is None and platform.system() == "Darwin": preferred_platform = "linux/amd64" # Proactively use linux/amd64 on ARM hosts if preferred_platform is None and platform.machine() in ("arm64", "aarch64"): preferred_platform = "linux/amd64"
Esprit automatically selects linux/amd64 on macOS and ARM hosts since the sandbox image only publishes AMD64 manifests.
def ensure_docker_running() -> None: """Check if Docker daemon is running; auto-start on macOS if possible.""" import subprocess import time console = Console() # Try to start Docker on macOS if sys.platform == "darwin": console.print("[dim]Docker daemon not running. Starting Docker Desktop...[/]") try: subprocess.Popen( ["open", "-a", "Docker"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) except Exception: console.print("[red]Could not start Docker Desktop.[/]") sys.exit(1) # Wait for Docker to become available for i in range(60): time.sleep(1) try: import docker as docker_lib docker_lib.from_env() console.print("[green]✓ Docker started.[/]") return except Exception: pass