# Setting up agent sandbox For a VM-focused checklist, see [`VM_SETUP.md`](VM_SETUP.md). This file keeps the original full setup notes; `VM_SETUP.md` is the recommended entry point for fresh VMware setup and smoke testing. 1. Suppose you are operating on a system that has not been virtualized (e.g. your desktop, laptop, bare metal machine), meaning you are not utilizing a virtualized environment like AWS, Azure, or k8s. If this is the case, proceed with the instructions below. 2. First, install [VMware Workstation Pro](https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html) (for systems with Apple Chips, you should install [VMware Fusion](https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware+Fusion)) and configure the `vmrun` command. The installation process can refer to [How to install VMware Workstation Pro](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/providers/vmware/INSTALL_VMWARE.md). For macos, you need to get across the firewall (Go to **System Settings > Network > Firewall** and toggle it on/off.). Verify the successful installation by running the following: ``` `vmrun -T ws list` ``` 3. Download the virtual machine at **Username: user, Password: password *(ignore this step if you have the pre-setup virtual machine)*** ``` `https://huggingface.co/datasets/xlangai/ubuntu_osworld/blob/main/Ubuntu-x86.zip`. ``` For M1/M2 chip machines, download at ``` https://huggingface.co/datasets/xlangai/ubuntu_osworld/blob/main/Ubuntu-arm.zip ``` ``` Installation of bio softwares: (around 1 hour setup) 1. install miniconda wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh bash Miniconda3-latest-Linux-aarch64.sh 2. don't activate any environment, directly (cellprofiler environment is older and may interfere with swe-rex version) pip install swe-rex # run a test: swerex-remote -h 3. install cellprofiler, we are not entirely following https://github.com/CellProfiler/CellProfiler/wiki/Ubuntu-20.04, as sudo install gtk3 affect GUI conda create -n python39 python=3.9 sudo apt update sudo apt -y upgrade conda config --env --add channels conda-forge conda install gtk3 wxpython sudo apt-get install -y openjdk-11-jdk-headless default-libmysqlclient-dev export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 export PATH=$PATH:/home/ubuntu/.local/bin (reopen the bash window) pip install cellprofiler # test with cellprofiler (a gui window should open) 4. install QuPath, following https://qupath.readthedocs.io/en/stable/docs/reference/building.html#building It is very hard to build from source on aarch64 linux, so I uploaded a precompiles one here: https://drive.google.com/drive/folders/1uquZgq88OVMq739m6I3N5do7-MP8nzQx?usp=sharing There's the executable QuPath in the bin/ folder. sudo chmod 777 QuPath ./QuPath 5. setup Napari # The host folder Orion/tools/napari_viewer_tools/napari_server/ is now pushed # to /home/user/server/napari_server automatically by run_orion.py # (see deploy_napari_server_to_vm in sweagent/run/run_orion.py) on every # reset_desktop_for_problem call. You only need to install the runtime: pip install napari[all] # Manual sanity check (optional — only needed if you want to launch outside # the Orion runner): cd ~/server/napari_server && bash launch_napari_loop.sh ``` This is the clean docker for Ubuntu. For the one with all bio softwares installed (arm version, installed Napari, CellProfiler, QuPath): 4. Setup the local conda environment: ``` git clone https://github.com/chang-github-00/SWE-agent cd SWE-agent pip install -r requirements_minimal.txt pip intall -e ./ # install the sweagent package locally ``` 5. Run simple tasks to check everything's going well: ``` 1. python -c "import sweagent" 2. use vmware gui interface to start the virtual machine, also use vmrun list to make sure the vm is running ``` # Running the agent 1. Setup the .env file for all the apis ``` ANTHROPIC_API_KEY="sk-..." AZURE_OPENAI_API_KEY_EUS2="" AZURE_OPENAI_API_KEY_SC="" GEMINI_API_KEY="" ProjectRoot="/Users/machang/Documents/research-work/CellMMAgent/SWE-agent" # path to the working folder HF_API_TOKEN="" # your token from https://huggingface.co/settings/tokens — used for downloading datasets ENV_NAME="python39" GITHUB_API_KEY="" # used for automatically pushing results to github QUPATH_PATH="" # link to qupath executable ENV_NAME="" # ``` 2. Download problem files: huggingface-cli login ``` huggingface-cli login (use the token) ``` CellProfiler: https://huggingface.co/datasets/changma/CellProfiler-Benchmark QuPath: https://huggingface.co/datasets/changma/Pathology-Dataset (some large files require separate downloading) JUMPDiscovery: https://huggingface.co/datasets/changma/JUMPDiscovery 3. Run the scripts -- for cellprofiler learning ``` #!/bin/bash # echo "Executing CellProfiler learning script..." # echo export RESUME_MODE="true" export RESUME_OUTPUT_DIR="/Users/machang/Documents/research-work/CellMMAgent/results/AWM_COCO_Online_gui_swe" # export HOST_TRAINING_DIR=... the path to training data CellProfiler-Training should download from huggingface echo "RESUME_MODE set to $RESUME_MODE" echo "RESUME_OUTPUT_DIR set to $RESUME_OUTPUT_DIR" # # Set environment variables if needed # export PYTHONPATH="/Users/machang/Documents/research-work/CellMMAgent/SWE-agent:$PYTHONPATH" # Execute the script with Python from parent directory so it can find .env file # these are fake flags that I have not cleaned up yet, just ignore them python sweagent/run/train_cocoagent.py run --agent.model.name=claude-sonnet-4-20250514 --agent.model.per_instance_cost_limit=2.00 --env.repo.github_url=https://github.com/SWE-agent/test-repo echo echo "Script execution completed!" ``` `bash scripts/run_cellprofiler.sh` # Extending the Space The default is not quite large for this vm and could easily run out of space. Extending a Linux partition after increasing the virtual disk size in VMware requires two main steps: **resizing the partition** and then **resizing the filesystem** within that partition. The easiest and safest method for most Linux setups (especially Ubuntu with LVM) is to use the command-line tools `growpart` and LVM commands, as these often work without rebooting or a Live CD. ## **1. Prerequisites (VMware Steps)** 1. **Shut Down the VM:** Power off the virtual machine completely (do not just suspend it). 2. **Increase Disk Size:** In VMware, go to **VM Settings** → **Hard Disk** → **Expand/Increase Size** . Set the new, larger size and apply the change. 3. **Power On the VM:** Start the virtual machine and log in. ## **2. Extend the Partition (Standard or LVM)** First, you need to adjust the partition table to recognize and utilize the new unallocated space. 1. **Identify Disk and Partition:** Find your main disk (usually `/dev/sda` or `/dev/sdb`) and the partition number you want to extend (e.g., `3`). **Bash** `sudo lsblk` 2. **Extend the Partition Table:** Use `growpart` to expand the specified partition to fill the new space. (If `growpart` is not found, install it with `sudo apt install cloud-guest-utils`). **Bash** `sudo growpart /dev/sda 3 # Replace 'sda' with your disk and '3' with the partition number` --- ## **3. Extend the Filesystem (Choose Your Path)** The commands in this step depend on whether your system uses **Standard Partitioning** (e.g., just `/dev/sda3`) or **LVM** (e.g., `/dev/mapper/vgname-lvname`). ### If you see your root filesystem mounted directly to `/dev/sda3`, use `resize2fs` (for Ext4/Ext3) or `xfs_growfs` (for XFS). **For Ext4 (Most Common):** **Bash** `sudo resize2fs /dev/sda3 # Replace with your actual partition name` The filesystem will immediately expand to fill the available space in the partition.