This guide covers development workflows for MobileWorld, including debugging and testing within Docker containers.
Dev mode allows you to develop and debug code within a container environment while using your local source files.
Use the --dev flag when launching containers to mount your local src directory:
mobile-world env run --devThis will:
- Mount your local
src/directory to/app/service/srcin the container (Otherwise you can use--mount-srcwithoutdevmode) - Allow you to edit code locally and have changes reflected immediately in the container
- Enable live development without rebuilding the Docker image
- Automatically enable VNC for visual debugging (accessible via VNC port)
Note: Dev mode only supports launching a single container. If you need multiple containers, launch them separately without dev mode.
When you make code changes in dev mode, you need to restart the server for changes to take effect:
mobile-world env restart <container_name>Example:
mobile-world env restart knowu_bench_env_0This command:
- Finds the server process (launched via
uv run mobile-world server) - Kills the existing server process
- Restarts the server with the updated code
To open a bash shell inside a running container:
mobile-world env exec <container_name>Example:
mobile-world env exec knowu_bench_env_0You can also run custom commands:
mobile-world env exec <container_name> --command "ls -la /app/service"-
Launch container in dev mode:
_dev_env
-
Edit code locally in your IDE/editor
-
Restart the server to apply changes:
mobile-world env restart my_dev_env_0
-
Test your changes by making API calls or running tasks
-
Attach to container for debugging if needed:
mobile-world env exec my_dev_env_0 -
Inside the container, you can:
- Check logs:
tail -f /app/service/logs/server.log,tail -f /app/service/logs/server.log,tail -f /app/service/logs/server.log - Inspect processes:
ps aux | grep mobile-world - Debug with Python REPL:
uv run python - Run tests:
cd /app/service && uv run pytest
- Check logs:
# List running containers
mobile-world env list
# List all containers (including stopped)
mobile-world env list --all
# Get JSON output
mobile-world env list --jsonGet detailed information about a specific container:
mobile-world env info <container_name>Remove containers when done:
# Remove specific containers
mobile-world env rm my_dev_env_0 my_dev_env_1
# Remove all knowu_bench containers
mobile-world env rm --allThe MobileWorld server is launched in the container via the entrypoint script:
uv run mobile-world server --port 6800 &Key endpoints:
- Backend API:
http://localhost:6800 - Device Viewer:
http://localhost:7860 - VNC:
http://localhost:5800(whenENABLE_VNC=true)
The server provides:
- FastAPI backend for device control
- Health check endpoint at
/health - WebSocket support for real-time updates
Containers use three ports per instance:
- Backend port: Base port (e.g., 6800)
- Viewer port: Base + 1060 (e.g., 7860)
- VNC port: Base - 1000 (e.g., 5800)
When launching multiple containers, they are spaced 100 ports apart:
- Container 0: 6800, 7860, 5800
- Container 1: 6900, 7960, 5900
- Container 2: 7000, 8060, 6000
If code changes aren't appearing:
- Verify dev mode is enabled:
mobile-world env info <container_name> - Check volume mounts are correct
- Restart the server:
mobile-world env restart <container_name> - Check for Python module caching issues
- Check if ports are available
- Verify Docker daemon is running:
docker ps - Check logs:
docker logs <container_name> - Ensure Docker image exists:
docker images | grep knowu-bench
If you get Docker permission errors:
# Add your user to docker group
sudo usermod -aG docker $USER
newgrp docker- Check if server is running:
mobile-world env exec <container_name> --command "ps aux | grep mobile-world" - Check health endpoint:
curl http://localhost:6800/health - Restart the server:
mobile-world env restart <container_name> - Check container logs:
docker logs <container_name>
You can enable VNC support on regular (non-dev) containers:
mobile-world env run --vnc --count 2Note: VNC is automatically enabled when using --dev mode.
Use a different Docker image:
mobile-world env run --dev --image my_custom_image:latestSpecify a different starting port:
mobile-world env run --dev --start-port 8000Use a custom prefix for container names:
mobile-world env run --dev --name-prefix experiment_This creates containers named: experiment_0, experiment_1, etc.
Start and attach the containers in dev mode and execute the below command:
uv run python src/knowu_bench/tasks/test_task.py --task xxx --question "xxxx"
The --task flag specifies the task name, while --question is an optional argument that provides a clarification question for agent-user interaction tasks.
This command initializes the task environment, after which you can interact with the GUI via VNC to complete the task manually.