The `cua-computer-server` is the server component for the Computer-Use Interface (CUI) framework, enabling AI agents to programmatically control a host desktop. It runs as a local HTTP service, exposing endpoints for screenshots, mouse/keyboard input, and other computer operations across macOS, Linux, and Windows. As of version 0.3.32, it forms a core part of the Cua ecosystem, facilitating direct machine interaction for agent development and testing.
pip install cua-computer-serverVerified import paths — ran on the pinned version, not inferred.
To use `cua-computer-server`, first run the server as a Python module in a terminal. Then, connect to it from a Python script using the `cua` library's `Sandbox.create()` method with `use_host_computer_server=True`. The example demonstrates connecting and taking a screenshot.
Only run the server on localhost or trusted, private networks. Do not expose to the public internet. Stop the server when not actively in use. Consider using sandboxes for untrusted workloads.
Start the server with `--width` and `--height` flags to specify the target resolution (e.g., `python -m computer_server --width 1512 --height 982`). This ensures consistent coordinate scaling between screenshots and input actions.
Ensure the `cua` library is installed alongside `cua-computer-server` if you plan to control the server programmatically (e.g., `pip install cua cua-computer-server`).
Verify the server is running (`python -m computer_server`). Check if the default port (8000) is in use and either free it or start the server on a custom port (`--port <number>`). Ensure firewall rules allow the connection.
Ensure your Python environment is running Python >=3.12 and <3.14. [PyPI metadata]