Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
Add XFCE provider
f-trycua3053270f7442
diff --git a/libs/docker-xfce/README.md b/libs/docker-xfce/README.mdindex 489d00428d..5d8512c85f 100644--- a/libs/docker-xfce/README.md+++ b/libs/docker-xfce/README.md@@ -99,7 +99,7 @@ docker run --rm -it \## Using with CUA Docker Provider-This container is designed to work with the CUA Docker provider:+This container is designed to work with the CUA Docker provider. Simply specify the docker-xfce image:```pythonfrom computer import Computer@@ -108,8 +108,8 @@ from computer import Computercomputer = Computer(os_type="linux",provider_type="docker",- image="trycua/cua-docker-xfce:latest",- display="1920x1080",+ image="trycua/cua-docker-xfce:latest", # Use docker-xfce instead of Kasm+ display="1024x768",memory="4GB",cpu="2")@@ -128,11 +128,33 @@ async with computer:print(result.stdout)```+### Switching between Kasm and docker-xfce++The Docker provider automatically detects which image you're using:++```python+# Use Kasm-based container (default for Linux)+computer_kasm = Computer(+ os_type="linux",+ provider_type="docker",+ image="trycua/cua-ubuntu:latest", # Kasm image+)++# Use docker-xfce container (vanilla XFCE)+computer_xfce = Computer(+ os_type="linux",+ provider_type="docker",+ image="trycua/cua-docker-xfce:latest", # docker-xfce image+)+```++Both provide the same API and functionality - the provider automatically configures the correct paths and settings based on the image.+## Environment Variables| Variable | Default | Description ||----------|---------|-------------|-| `VNC_RESOLUTION` | `1920x1080` | Screen resolution |+| `VNC_RESOLUTION` | `1024x768` | Screen resolution || `VNC_COL_DEPTH` | `24` | Color depth || `VNC_PORT` | `5901` | VNC server port || `NOVNC_PORT` | `6901` | noVNC web interface port |diff --git a/libs/python/computer/computer/providers/docker/provider.py b/libs/python/computer/computer/providers/docker/provider.pyindex 82ad411ce8..487edc2805 100644--- a/libs/python/computer/computer/providers/docker/provider.py+++ b/libs/python/computer/computer/providers/docker/provider.py@@ -36,7 +36,7 @@ class DockerProvider(BaseVMProvider):"""def __init__(- self,+ self,port: Optional[int] = 8000,host: str = "localhost",storage: Optional[str] = None,@@ -47,13 +47,16 @@ class DockerProvider(BaseVMProvider):vnc_port: Optional[int] = 6901,):"""Initialize the Docker VM Provider.-+Args:port: Currently unused (VM provider port)host: Hostname for the API server (default: localhost)storage: Path for persistent VM storageshared_path: Path for shared folder between host and containerimage: Docker image to use (default: "trycua/cua-ubuntu:latest")+ Supported images:+ - "trycua/cua-ubuntu:latest" (Kasm-based)+ - "trycua/cua-docker-xfce:latest" (vanilla XFCE)verbose: Enable verbose loggingephemeral: Use ephemeral (temporary) storagevnc_port: Port for VNC interface (default: 6901)@@ -62,19 +65,35 @@ class DockerProvider(BaseVMProvider):self.api_port = 8000self.vnc_port = vnc_portself.ephemeral = ephemeral-+# Handle ephemeral storage (temporary directory)if ephemeral:self.storage = "ephemeral"else:self.storage = storage-+self.shared_path = shared_pathself.image = imageself.verbose = verboseself._container_id = Noneself._running_containers = {} # Track running containers by name++ # Detect image type and configure user directory accordingly+ self._detect_image_config()+ def _detect_image_config(self):+ """Detect image type and configure paths accordingly."""+ # Detect if this is a docker-xfce image or Kasm image+ if "docker-xfce" in self.image.lower() or "xfce" in self.image.lower():+ self._home_dir = "/home/cua"+ self._image_type = "docker-xfce"+ logger.info(f"Detected docker-xfce image: using {self._home_dir}")+ else:+ # Default to Kasm configuration+ self._home_dir = "/home/kasm-user"+ self._image_type = "kasm"+ logger.info(f"Detected Kasm image: using {self._home_dir}")+@propertydef provider_type(self) -> VMProviderType:"""Return the provider type."""@@ -277,12 +296,13 @@ class DockerProvider(BaseVMProvider):# Add volume mounts if storage is specifiedstorage_path = storage or self.storageif storage_path and storage_path != "ephemeral":- # Mount storage directory- cmd.extend(["-v", f"{storage_path}:/home/kasm-user/storage"])-+ # Mount storage directory using detected home directory+ cmd.extend(["-v", f"{storage_path}:{self._home_dir}/storage"])+# Add shared path if specifiedif self.shared_path:- cmd.extend(["-v", f"{self.shared_path}:/home/kasm-user/shared"])+ # Mount shared directory using detected home directory+ cmd.extend(["-v", f"{self.shared_path}:{self._home_dir}/shared"])# Add environment variablescmd.extend(["-e", "VNC_PW=password"]) # Set VNC password