mirror of
https://github.com/trycua/computer.git
synced 2026-01-03 20:10:04 -06:00
1077 lines
50 KiB
Plaintext
1077 lines
50 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": "## Computer\n\nThis notebook demonstrates how to use Computer to operate sandbox VMs programmatically, either using Cua Cloud Sandbox or local Lume VMs on Apple Silicon macOS systems."
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Installation"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"WARNING: Skipping cua-computer as it is not installed.\n"
|
|
]
|
|
},
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Collecting cua-computer[all]\n",
|
|
" Downloading cua_computer-0.4.4-py3-none-any.whl.metadata (5.8 kB)\n",
|
|
"Collecting pillow>=10.0.0 (from cua-computer[all])\n",
|
|
" Downloading pillow-11.3.0-cp313-cp313-win_amd64.whl.metadata (9.2 kB)\n",
|
|
"Collecting websocket-client>=1.8.0 (from cua-computer[all])\n",
|
|
" Downloading websocket_client-1.8.0-py3-none-any.whl.metadata (8.0 kB)\n",
|
|
"Collecting websockets>=12.0 (from cua-computer[all])\n",
|
|
" Downloading websockets-15.0.1-cp313-cp313-win_amd64.whl.metadata (7.0 kB)\n",
|
|
"Collecting aiohttp>=3.9.0 (from cua-computer[all])\n",
|
|
" Downloading aiohttp-3.12.15-cp313-cp313-win_amd64.whl.metadata (7.9 kB)\n",
|
|
"Collecting cua-core<0.2.0,>=0.1.0 (from cua-computer[all])\n",
|
|
" Downloading cua_core-0.1.9-py3-none-any.whl.metadata (1.6 kB)\n",
|
|
"Collecting pydantic>=2.11.1 (from cua-computer[all])\n",
|
|
" Downloading pydantic-2.11.7-py3-none-any.whl.metadata (67 kB)\n",
|
|
"Collecting gradio>=5.23.3 (from cua-computer[all])\n",
|
|
" Downloading gradio-5.43.1-py3-none-any.whl.metadata (16 kB)\n",
|
|
"Collecting python-dotenv>=1.0.1 (from cua-computer[all])\n",
|
|
" Downloading python_dotenv-1.1.1-py3-none-any.whl.metadata (24 kB)\n",
|
|
"Collecting datasets>=3.6.0 (from cua-computer[all])\n",
|
|
" Downloading datasets-4.0.0-py3-none-any.whl.metadata (19 kB)\n",
|
|
"Collecting httpx>=0.24.0 (from cua-core<0.2.0,>=0.1.0->cua-computer[all])\n",
|
|
" Downloading httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB)\n",
|
|
"Collecting posthog>=3.20.0 (from cua-core<0.2.0,>=0.1.0->cua-computer[all])\n",
|
|
" Downloading posthog-6.6.1-py3-none-any.whl.metadata (6.0 kB)\n",
|
|
"Collecting aiohappyeyeballs>=2.5.0 (from aiohttp>=3.9.0->cua-computer[all])\n",
|
|
" Downloading aiohappyeyeballs-2.6.1-py3-none-any.whl.metadata (5.9 kB)\n",
|
|
"Collecting aiosignal>=1.4.0 (from aiohttp>=3.9.0->cua-computer[all])\n",
|
|
" Downloading aiosignal-1.4.0-py3-none-any.whl.metadata (3.7 kB)\n",
|
|
"Collecting attrs>=17.3.0 (from aiohttp>=3.9.0->cua-computer[all])\n",
|
|
" Downloading attrs-25.3.0-py3-none-any.whl.metadata (10 kB)\n",
|
|
"Collecting frozenlist>=1.1.1 (from aiohttp>=3.9.0->cua-computer[all])\n",
|
|
" Downloading frozenlist-1.7.0-cp313-cp313-win_amd64.whl.metadata (19 kB)\n",
|
|
"Collecting multidict<7.0,>=4.5 (from aiohttp>=3.9.0->cua-computer[all])\n",
|
|
" Downloading multidict-6.6.4-cp313-cp313-win_amd64.whl.metadata (5.4 kB)\n",
|
|
"Collecting propcache>=0.2.0 (from aiohttp>=3.9.0->cua-computer[all])\n",
|
|
" Downloading propcache-0.3.2-cp313-cp313-win_amd64.whl.metadata (12 kB)\n",
|
|
"Collecting yarl<2.0,>=1.17.0 (from aiohttp>=3.9.0->cua-computer[all])\n",
|
|
" Downloading yarl-1.20.1-cp313-cp313-win_amd64.whl.metadata (76 kB)\n",
|
|
"Collecting idna>=2.0 (from yarl<2.0,>=1.17.0->aiohttp>=3.9.0->cua-computer[all])\n",
|
|
" Downloading idna-3.10-py3-none-any.whl.metadata (10 kB)\n",
|
|
"Collecting filelock (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading filelock-3.19.1-py3-none-any.whl.metadata (2.1 kB)\n",
|
|
"Collecting numpy>=1.17 (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading numpy-2.3.2-cp313-cp313-win_amd64.whl.metadata (60 kB)\n",
|
|
"Collecting pyarrow>=15.0.0 (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading pyarrow-21.0.0-cp313-cp313-win_amd64.whl.metadata (3.4 kB)\n",
|
|
"Collecting dill<0.3.9,>=0.3.0 (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading dill-0.3.8-py3-none-any.whl.metadata (10 kB)\n",
|
|
"Collecting pandas (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading pandas-2.3.2-cp313-cp313-win_amd64.whl.metadata (19 kB)\n",
|
|
"Collecting requests>=2.32.2 (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading requests-2.32.5-py3-none-any.whl.metadata (4.9 kB)\n",
|
|
"Collecting tqdm>=4.66.3 (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading tqdm-4.67.1-py3-none-any.whl.metadata (57 kB)\n",
|
|
"Collecting xxhash (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading xxhash-3.5.0-cp313-cp313-win_amd64.whl.metadata (13 kB)\n",
|
|
"Collecting multiprocess<0.70.17 (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading multiprocess-0.70.16-py312-none-any.whl.metadata (7.2 kB)\n",
|
|
"Collecting fsspec<=2025.3.0,>=2023.1.0 (from fsspec[http]<=2025.3.0,>=2023.1.0->datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading fsspec-2025.3.0-py3-none-any.whl.metadata (11 kB)\n",
|
|
"Collecting huggingface-hub>=0.24.0 (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading huggingface_hub-0.34.4-py3-none-any.whl.metadata (14 kB)\n",
|
|
"Requirement already satisfied: packaging in c:\\programdata\\anaconda3\\envs\\cua\\lib\\site-packages (from datasets>=3.6.0->cua-computer[all]) (25.0)\n",
|
|
"Collecting pyyaml>=5.1 (from datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading PyYAML-6.0.2-cp313-cp313-win_amd64.whl.metadata (2.1 kB)\n",
|
|
"Collecting aiofiles<25.0,>=22.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading aiofiles-24.1.0-py3-none-any.whl.metadata (10 kB)\n",
|
|
"Collecting anyio<5.0,>=3.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading anyio-4.10.0-py3-none-any.whl.metadata (4.0 kB)\n",
|
|
"Collecting audioop-lts<1.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading audioop_lts-0.2.2-cp313-abi3-win_amd64.whl.metadata (2.0 kB)\n",
|
|
"Collecting brotli>=1.1.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading Brotli-1.1.0-cp313-cp313-win_amd64.whl.metadata (5.6 kB)\n",
|
|
"Collecting fastapi<1.0,>=0.115.2 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading fastapi-0.116.1-py3-none-any.whl.metadata (28 kB)\n",
|
|
"Collecting ffmpy (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading ffmpy-0.6.1-py3-none-any.whl.metadata (2.9 kB)\n",
|
|
"Collecting gradio-client==1.12.1 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading gradio_client-1.12.1-py3-none-any.whl.metadata (7.1 kB)\n",
|
|
"Collecting groovy~=0.1 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading groovy-0.1.2-py3-none-any.whl.metadata (6.1 kB)\n",
|
|
"Collecting jinja2<4.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading jinja2-3.1.6-py3-none-any.whl.metadata (2.9 kB)\n",
|
|
"Collecting markupsafe<4.0,>=2.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl.metadata (4.1 kB)\n",
|
|
"Collecting orjson~=3.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading orjson-3.11.2-cp313-cp313-win_amd64.whl.metadata (1.2 kB)\n",
|
|
"Collecting pydub (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading pydub-0.25.1-py2.py3-none-any.whl.metadata (1.4 kB)\n",
|
|
"Collecting python-multipart>=0.0.18 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading python_multipart-0.0.20-py3-none-any.whl.metadata (1.8 kB)\n",
|
|
"Collecting ruff>=0.9.3 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading ruff-0.12.10-py3-none-win_amd64.whl.metadata (26 kB)\n",
|
|
"Collecting safehttpx<0.2.0,>=0.1.6 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading safehttpx-0.1.6-py3-none-any.whl.metadata (4.2 kB)\n",
|
|
"Collecting semantic-version~=2.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading semantic_version-2.10.0-py2.py3-none-any.whl.metadata (9.7 kB)\n",
|
|
"Collecting starlette<1.0,>=0.40.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading starlette-0.47.3-py3-none-any.whl.metadata (6.2 kB)\n",
|
|
"Collecting tomlkit<0.14.0,>=0.12.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading tomlkit-0.13.3-py3-none-any.whl.metadata (2.8 kB)\n",
|
|
"Collecting typer<1.0,>=0.12 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading typer-0.16.1-py3-none-any.whl.metadata (15 kB)\n",
|
|
"Requirement already satisfied: typing-extensions~=4.0 in c:\\programdata\\anaconda3\\envs\\cua\\lib\\site-packages (from gradio>=5.23.3->cua-computer[all]) (4.14.1)\n",
|
|
"Collecting uvicorn>=0.14.0 (from gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading uvicorn-0.35.0-py3-none-any.whl.metadata (6.5 kB)\n",
|
|
"Collecting sniffio>=1.1 (from anyio<5.0,>=3.0->gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)\n",
|
|
"Collecting certifi (from httpx>=0.24.0->cua-core<0.2.0,>=0.1.0->cua-computer[all])\n",
|
|
" Downloading certifi-2025.8.3-py3-none-any.whl.metadata (2.4 kB)\n",
|
|
"Collecting httpcore==1.* (from httpx>=0.24.0->cua-core<0.2.0,>=0.1.0->cua-computer[all])\n",
|
|
" Downloading httpcore-1.0.9-py3-none-any.whl.metadata (21 kB)\n",
|
|
"Collecting h11>=0.16 (from httpcore==1.*->httpx>=0.24.0->cua-core<0.2.0,>=0.1.0->cua-computer[all])\n",
|
|
" Downloading h11-0.16.0-py3-none-any.whl.metadata (8.3 kB)\n",
|
|
"Requirement already satisfied: python-dateutil>=2.8.2 in c:\\programdata\\anaconda3\\envs\\cua\\lib\\site-packages (from pandas->datasets>=3.6.0->cua-computer[all]) (2.9.0.post0)\n",
|
|
"Collecting pytz>=2020.1 (from pandas->datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading pytz-2025.2-py2.py3-none-any.whl.metadata (22 kB)\n",
|
|
"Collecting tzdata>=2022.7 (from pandas->datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading tzdata-2025.2-py2.py3-none-any.whl.metadata (1.4 kB)\n",
|
|
"Collecting annotated-types>=0.6.0 (from pydantic>=2.11.1->cua-computer[all])\n",
|
|
" Downloading annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB)\n",
|
|
"Collecting pydantic-core==2.33.2 (from pydantic>=2.11.1->cua-computer[all])\n",
|
|
" Downloading pydantic_core-2.33.2-cp313-cp313-win_amd64.whl.metadata (6.9 kB)\n",
|
|
"Collecting typing-inspection>=0.4.0 (from pydantic>=2.11.1->cua-computer[all])\n",
|
|
" Downloading typing_inspection-0.4.1-py3-none-any.whl.metadata (2.6 kB)\n",
|
|
"Collecting click>=8.0.0 (from typer<1.0,>=0.12->gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading click-8.2.1-py3-none-any.whl.metadata (2.5 kB)\n",
|
|
"Collecting shellingham>=1.3.0 (from typer<1.0,>=0.12->gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading shellingham-1.5.4-py2.py3-none-any.whl.metadata (3.5 kB)\n",
|
|
"Collecting rich>=10.11.0 (from typer<1.0,>=0.12->gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading rich-14.1.0-py3-none-any.whl.metadata (18 kB)\n",
|
|
"Requirement already satisfied: colorama in c:\\programdata\\anaconda3\\envs\\cua\\lib\\site-packages (from click>=8.0.0->typer<1.0,>=0.12->gradio>=5.23.3->cua-computer[all]) (0.4.6)\n",
|
|
"Requirement already satisfied: six>=1.5 in c:\\programdata\\anaconda3\\envs\\cua\\lib\\site-packages (from posthog>=3.20.0->cua-core<0.2.0,>=0.1.0->cua-computer[all]) (1.17.0)\n",
|
|
"Collecting backoff>=1.10.0 (from posthog>=3.20.0->cua-core<0.2.0,>=0.1.0->cua-computer[all])\n",
|
|
" Downloading backoff-2.2.1-py3-none-any.whl.metadata (14 kB)\n",
|
|
"Collecting distro>=1.5.0 (from posthog>=3.20.0->cua-core<0.2.0,>=0.1.0->cua-computer[all])\n",
|
|
" Downloading distro-1.9.0-py3-none-any.whl.metadata (6.8 kB)\n",
|
|
"Collecting charset_normalizer<4,>=2 (from requests>=2.32.2->datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading charset_normalizer-3.4.3-cp313-cp313-win_amd64.whl.metadata (37 kB)\n",
|
|
"Collecting urllib3<3,>=1.21.1 (from requests>=2.32.2->datasets>=3.6.0->cua-computer[all])\n",
|
|
" Downloading urllib3-2.5.0-py3-none-any.whl.metadata (6.5 kB)\n",
|
|
"Collecting markdown-it-py>=2.2.0 (from rich>=10.11.0->typer<1.0,>=0.12->gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading markdown_it_py-4.0.0-py3-none-any.whl.metadata (7.3 kB)\n",
|
|
"Requirement already satisfied: pygments<3.0.0,>=2.13.0 in c:\\programdata\\anaconda3\\envs\\cua\\lib\\site-packages (from rich>=10.11.0->typer<1.0,>=0.12->gradio>=5.23.3->cua-computer[all]) (2.19.2)\n",
|
|
"Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=10.11.0->typer<1.0,>=0.12->gradio>=5.23.3->cua-computer[all])\n",
|
|
" Downloading mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)\n",
|
|
"Downloading cua_computer-0.4.4-py3-none-any.whl (87 kB)\n",
|
|
"Downloading cua_core-0.1.9-py3-none-any.whl (5.2 kB)\n",
|
|
"Downloading aiohttp-3.12.15-cp313-cp313-win_amd64.whl (449 kB)\n",
|
|
"Downloading multidict-6.6.4-cp313-cp313-win_amd64.whl (45 kB)\n",
|
|
"Downloading yarl-1.20.1-cp313-cp313-win_amd64.whl (86 kB)\n",
|
|
"Downloading aiohappyeyeballs-2.6.1-py3-none-any.whl (15 kB)\n",
|
|
"Downloading aiosignal-1.4.0-py3-none-any.whl (7.5 kB)\n",
|
|
"Downloading attrs-25.3.0-py3-none-any.whl (63 kB)\n",
|
|
"Downloading datasets-4.0.0-py3-none-any.whl (494 kB)\n",
|
|
"Downloading dill-0.3.8-py3-none-any.whl (116 kB)\n",
|
|
"Downloading fsspec-2025.3.0-py3-none-any.whl (193 kB)\n",
|
|
"Downloading multiprocess-0.70.16-py312-none-any.whl (146 kB)\n",
|
|
"Downloading frozenlist-1.7.0-cp313-cp313-win_amd64.whl (43 kB)\n",
|
|
"Downloading gradio-5.43.1-py3-none-any.whl (59.6 MB)\n",
|
|
" ---------------------------------------- 0.0/59.6 MB ? eta -:--:--\n",
|
|
" -------------------------------------- - 57.4/59.6 MB 278.0 MB/s eta 0:00:01\n",
|
|
" --------------------------------------- 59.5/59.6 MB 277.3 MB/s eta 0:00:01\n",
|
|
" ---------------------------------------- 59.6/59.6 MB 138.5 MB/s eta 0:00:00\n",
|
|
"Downloading gradio_client-1.12.1-py3-none-any.whl (324 kB)\n",
|
|
"Downloading aiofiles-24.1.0-py3-none-any.whl (15 kB)\n",
|
|
"Downloading anyio-4.10.0-py3-none-any.whl (107 kB)\n",
|
|
"Downloading audioop_lts-0.2.2-cp313-abi3-win_amd64.whl (30 kB)\n",
|
|
"Downloading fastapi-0.116.1-py3-none-any.whl (95 kB)\n",
|
|
"Downloading groovy-0.1.2-py3-none-any.whl (14 kB)\n",
|
|
"Downloading httpx-0.28.1-py3-none-any.whl (73 kB)\n",
|
|
"Downloading httpcore-1.0.9-py3-none-any.whl (78 kB)\n",
|
|
"Downloading huggingface_hub-0.34.4-py3-none-any.whl (561 kB)\n",
|
|
" ---------------------------------------- 0.0/561.5 kB ? eta -:--:--\n",
|
|
" --------------------------------------- 561.5/561.5 kB 18.0 MB/s eta 0:00:00\n",
|
|
"Downloading jinja2-3.1.6-py3-none-any.whl (134 kB)\n",
|
|
"Downloading MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl (15 kB)\n",
|
|
"Downloading numpy-2.3.2-cp313-cp313-win_amd64.whl (12.8 MB)\n",
|
|
" ---------------------------------------- 0.0/12.8 MB ? eta -:--:--\n",
|
|
" ---------------------------------------- 12.8/12.8 MB 129.9 MB/s eta 0:00:00\n",
|
|
"Downloading orjson-3.11.2-cp313-cp313-win_amd64.whl (119 kB)\n",
|
|
"Downloading pandas-2.3.2-cp313-cp313-win_amd64.whl (11.0 MB)\n",
|
|
" ---------------------------------------- 0.0/11.0 MB ? eta -:--:--\n",
|
|
" ---------------------------------------- 11.0/11.0 MB 84.1 MB/s eta 0:00:00\n",
|
|
"Downloading pillow-11.3.0-cp313-cp313-win_amd64.whl (7.0 MB)\n",
|
|
" ---------------------------------------- 0.0/7.0 MB ? eta -:--:--\n",
|
|
" ---------------------------------------- 7.0/7.0 MB 107.0 MB/s eta 0:00:00\n",
|
|
"Downloading pydantic-2.11.7-py3-none-any.whl (444 kB)\n",
|
|
"Downloading pydantic_core-2.33.2-cp313-cp313-win_amd64.whl (2.0 MB)\n",
|
|
" ---------------------------------------- 0.0/2.0 MB ? eta -:--:--\n",
|
|
" ---------------- ----------------------- 0.8/2.0 MB 6.0 MB/s eta 0:00:01\n",
|
|
" ---------------------------------------- 2.0/2.0 MB 13.6 MB/s eta 0:00:00\n",
|
|
"Downloading PyYAML-6.0.2-cp313-cp313-win_amd64.whl (156 kB)\n",
|
|
"Downloading safehttpx-0.1.6-py3-none-any.whl (8.7 kB)\n",
|
|
"Downloading semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)\n",
|
|
"Downloading starlette-0.47.3-py3-none-any.whl (72 kB)\n",
|
|
"Downloading tomlkit-0.13.3-py3-none-any.whl (38 kB)\n",
|
|
"Downloading typer-0.16.1-py3-none-any.whl (46 kB)\n",
|
|
"Downloading websockets-15.0.1-cp313-cp313-win_amd64.whl (176 kB)\n",
|
|
"Downloading annotated_types-0.7.0-py3-none-any.whl (13 kB)\n",
|
|
"Downloading Brotli-1.1.0-cp313-cp313-win_amd64.whl (358 kB)\n",
|
|
"Downloading click-8.2.1-py3-none-any.whl (102 kB)\n",
|
|
"Downloading h11-0.16.0-py3-none-any.whl (37 kB)\n",
|
|
"Downloading idna-3.10-py3-none-any.whl (70 kB)\n",
|
|
"Downloading posthog-6.6.1-py3-none-any.whl (119 kB)\n",
|
|
"Downloading requests-2.32.5-py3-none-any.whl (64 kB)\n",
|
|
"Downloading charset_normalizer-3.4.3-cp313-cp313-win_amd64.whl (107 kB)\n",
|
|
"Downloading urllib3-2.5.0-py3-none-any.whl (129 kB)\n",
|
|
"Downloading backoff-2.2.1-py3-none-any.whl (15 kB)\n",
|
|
"Downloading certifi-2025.8.3-py3-none-any.whl (161 kB)\n",
|
|
"Downloading distro-1.9.0-py3-none-any.whl (20 kB)\n",
|
|
"Downloading propcache-0.3.2-cp313-cp313-win_amd64.whl (40 kB)\n",
|
|
"Downloading pyarrow-21.0.0-cp313-cp313-win_amd64.whl (26.1 MB)\n",
|
|
" ---------------------------------------- 0.0/26.1 MB ? eta -:--:--\n",
|
|
" -------------------------------- ------- 21.0/26.1 MB 151.4 MB/s eta 0:00:01\n",
|
|
" --------------------------------------- 26.0/26.1 MB 63.3 MB/s eta 0:00:01\n",
|
|
" ---------------------------------------- 26.1/26.1 MB 50.1 MB/s eta 0:00:00\n",
|
|
"Downloading python_dotenv-1.1.1-py3-none-any.whl (20 kB)\n",
|
|
"Downloading python_multipart-0.0.20-py3-none-any.whl (24 kB)\n",
|
|
"Downloading pytz-2025.2-py2.py3-none-any.whl (509 kB)\n",
|
|
"Downloading rich-14.1.0-py3-none-any.whl (243 kB)\n",
|
|
"Downloading markdown_it_py-4.0.0-py3-none-any.whl (87 kB)\n",
|
|
"Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n",
|
|
"Downloading ruff-0.12.10-py3-none-win_amd64.whl (13.0 MB)\n",
|
|
" ---------------------------------------- 0.0/13.0 MB ? eta -:--:--\n",
|
|
" ---------------------------------------- 13.0/13.0 MB 143.1 MB/s eta 0:00:00\n",
|
|
"Downloading shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)\n",
|
|
"Downloading sniffio-1.3.1-py3-none-any.whl (10 kB)\n",
|
|
"Downloading tqdm-4.67.1-py3-none-any.whl (78 kB)\n",
|
|
"Downloading typing_inspection-0.4.1-py3-none-any.whl (14 kB)\n",
|
|
"Downloading tzdata-2025.2-py2.py3-none-any.whl (347 kB)\n",
|
|
"Downloading uvicorn-0.35.0-py3-none-any.whl (66 kB)\n",
|
|
"Downloading websocket_client-1.8.0-py3-none-any.whl (58 kB)\n",
|
|
"Downloading ffmpy-0.6.1-py3-none-any.whl (5.5 kB)\n",
|
|
"Downloading filelock-3.19.1-py3-none-any.whl (15 kB)\n",
|
|
"Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n",
|
|
"Downloading xxhash-3.5.0-cp313-cp313-win_amd64.whl (30 kB)\n",
|
|
"Installing collected packages: pytz, pydub, brotli, xxhash, websockets, websocket-client, urllib3, tzdata, typing-inspection, tqdm, tomlkit, sniffio, shellingham, semantic-version, ruff, pyyaml, python-multipart, python-dotenv, pydantic-core, pyarrow, propcache, pillow, orjson, numpy, multidict, mdurl, markupsafe, idna, h11, groovy, fsspec, frozenlist, filelock, ffmpy, distro, dill, click, charset_normalizer, certifi, backoff, audioop-lts, attrs, annotated-types, aiohappyeyeballs, aiofiles, yarl, uvicorn, requests, pydantic, pandas, multiprocess, markdown-it-py, jinja2, httpcore, anyio, aiosignal, starlette, rich, posthog, huggingface-hub, httpx, aiohttp, typer, safehttpx, gradio-client, fastapi, cua-core, gradio, datasets, cua-computer\n",
|
|
"\n",
|
|
" ---------------------------------------- 0/70 [pytz]\n",
|
|
" ---------------------------------------- 0/70 [pytz]\n",
|
|
" ---------------------------------------- 0/70 [pytz]\n",
|
|
" --------------------------------------- 1/70 [pydub]\n",
|
|
" -- ------------------------------------- 4/70 [websockets]\n",
|
|
" -- ------------------------------------- 4/70 [websockets]\n",
|
|
" --- ------------------------------------ 6/70 [urllib3]\n",
|
|
" --- ------------------------------------ 6/70 [urllib3]\n",
|
|
" ---- ----------------------------------- 7/70 [tzdata]\n",
|
|
" ---- ----------------------------------- 7/70 [tzdata]\n",
|
|
" ---- ----------------------------------- 7/70 [tzdata]\n",
|
|
" ----- ---------------------------------- 9/70 [tqdm]\n",
|
|
" ----- ---------------------------------- 10/70 [tomlkit]\n",
|
|
" ------- -------------------------------- 13/70 [semantic-version]\n",
|
|
" -------- ------------------------------- 14/70 [ruff]\n",
|
|
" -------- ------------------------------- 14/70 [ruff]\n",
|
|
" --------- ------------------------------ 16/70 [python-multipart]\n",
|
|
" ---------- ----------------------------- 18/70 [pydantic-core]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ---------- ----------------------------- 19/70 [pyarrow]\n",
|
|
" ------------ --------------------------- 21/70 [pillow]\n",
|
|
" ------------ --------------------------- 21/70 [pillow]\n",
|
|
" ------------ --------------------------- 21/70 [pillow]\n",
|
|
" ------------ --------------------------- 21/70 [pillow]\n",
|
|
" ------------ --------------------------- 21/70 [pillow]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" ------------- -------------------------- 23/70 [numpy]\n",
|
|
" -------------- ------------------------- 26/70 [markupsafe]\n",
|
|
" --------------- ------------------------ 27/70 [idna]\n",
|
|
" ----------------- ---------------------- 30/70 [fsspec]\n",
|
|
" ----------------- ---------------------- 30/70 [fsspec]\n",
|
|
" ----------------- ---------------------- 30/70 [fsspec]\n",
|
|
" ------------------- -------------------- 34/70 [distro]\n",
|
|
" -------------------- ------------------- 35/70 [dill]\n",
|
|
" -------------------- ------------------- 36/70 [click]\n",
|
|
" --------------------- ------------------ 37/70 [charset_normalizer]\n",
|
|
" ---------------------- ----------------- 40/70 [audioop-lts]\n",
|
|
" ------------------------ --------------- 43/70 [aiohappyeyeballs]\n",
|
|
" -------------------------- ------------- 46/70 [uvicorn]\n",
|
|
" -------------------------- ------------- 46/70 [uvicorn]\n",
|
|
" --------------------------- ------------ 48/70 [pydantic]\n",
|
|
" --------------------------- ------------ 48/70 [pydantic]\n",
|
|
" --------------------------- ------------ 48/70 [pydantic]\n",
|
|
" --------------------------- ------------ 48/70 [pydantic]\n",
|
|
" --------------------------- ------------ 48/70 [pydantic]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 49/70 [pandas]\n",
|
|
" ---------------------------- ----------- 50/70 [multiprocess]\n",
|
|
" ---------------------------- ----------- 50/70 [multiprocess]\n",
|
|
" ----------------------------- ---------- 51/70 [markdown-it-py]\n",
|
|
" ----------------------------- ---------- 52/70 [jinja2]\n",
|
|
" ----------------------------- ---------- 52/70 [jinja2]\n",
|
|
" ------------------------------ --------- 53/70 [httpcore]\n",
|
|
" ------------------------------ --------- 54/70 [anyio]\n",
|
|
" -------------------------------- ------- 56/70 [starlette]\n",
|
|
" -------------------------------- ------- 56/70 [starlette]\n",
|
|
" -------------------------------- ------- 57/70 [rich]\n",
|
|
" -------------------------------- ------- 57/70 [rich]\n",
|
|
" -------------------------------- ------- 57/70 [rich]\n",
|
|
" --------------------------------- ------ 58/70 [posthog]\n",
|
|
" --------------------------------- ------ 59/70 [huggingface-hub]\n",
|
|
" --------------------------------- ------ 59/70 [huggingface-hub]\n",
|
|
" --------------------------------- ------ 59/70 [huggingface-hub]\n",
|
|
" --------------------------------- ------ 59/70 [huggingface-hub]\n",
|
|
" --------------------------------- ------ 59/70 [huggingface-hub]\n",
|
|
" ---------------------------------- ----- 60/70 [httpx]\n",
|
|
" ---------------------------------- ----- 61/70 [aiohttp]\n",
|
|
" ---------------------------------- ----- 61/70 [aiohttp]\n",
|
|
" ---------------------------------- ----- 61/70 [aiohttp]\n",
|
|
" ----------------------------------- ---- 62/70 [typer]\n",
|
|
" ------------------------------------ --- 64/70 [gradio-client]\n",
|
|
" ------------------------------------- -- 65/70 [fastapi]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 67/70 [gradio]\n",
|
|
" -------------------------------------- - 68/70 [datasets]\n",
|
|
" -------------------------------------- - 68/70 [datasets]\n",
|
|
" -------------------------------------- - 68/70 [datasets]\n",
|
|
" -------------------------------------- - 68/70 [datasets]\n",
|
|
" -------------------------------------- - 68/70 [datasets]\n",
|
|
" --------------------------------------- 69/70 [cua-computer]\n",
|
|
" --------------------------------------- 69/70 [cua-computer]\n",
|
|
" ---------------------------------------- 70/70 [cua-computer]\n",
|
|
"\n",
|
|
"Successfully installed aiofiles-24.1.0 aiohappyeyeballs-2.6.1 aiohttp-3.12.15 aiosignal-1.4.0 annotated-types-0.7.0 anyio-4.10.0 attrs-25.3.0 audioop-lts-0.2.2 backoff-2.2.1 brotli-1.1.0 certifi-2025.8.3 charset_normalizer-3.4.3 click-8.2.1 cua-computer-0.4.4 cua-core-0.1.9 datasets-4.0.0 dill-0.3.8 distro-1.9.0 fastapi-0.116.1 ffmpy-0.6.1 filelock-3.19.1 frozenlist-1.7.0 fsspec-2025.3.0 gradio-5.43.1 gradio-client-1.12.1 groovy-0.1.2 h11-0.16.0 httpcore-1.0.9 httpx-0.28.1 huggingface-hub-0.34.4 idna-3.10 jinja2-3.1.6 markdown-it-py-4.0.0 markupsafe-3.0.2 mdurl-0.1.2 multidict-6.6.4 multiprocess-0.70.16 numpy-2.3.2 orjson-3.11.2 pandas-2.3.2 pillow-11.3.0 posthog-6.6.1 propcache-0.3.2 pyarrow-21.0.0 pydantic-2.11.7 pydantic-core-2.33.2 pydub-0.25.1 python-dotenv-1.1.1 python-multipart-0.0.20 pytz-2025.2 pyyaml-6.0.2 requests-2.32.5 rich-14.1.0 ruff-0.12.10 safehttpx-0.1.6 semantic-version-2.10.0 shellingham-1.5.4 sniffio-1.3.1 starlette-0.47.3 tomlkit-0.13.3 tqdm-4.67.1 typer-0.16.1 typing-inspection-0.4.1 tzdata-2025.2 urllib3-2.5.0 uvicorn-0.35.0 websocket-client-1.8.0 websockets-15.0.1 xxhash-3.5.0 yarl-1.20.1\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"!pip uninstall -y cua-computer\n",
|
|
"!pip install \"cua-computer[all]\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"If locally installed, use this instead:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import os\n",
|
|
"\n",
|
|
"os.chdir('../libs/python/computer')\n",
|
|
"!poetry install\n",
|
|
"!poetry build\n",
|
|
"\n",
|
|
"!pip uninstall cua-computer -y\n",
|
|
"!pip install ./dist/cua_computer-0.1.0-py3-none-any.whl --force-reinstall"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": "## Option 1: Cua Cloud Sandbox\n\nCua Cloud Sandbox provides remote VMs that can be accessed from any system without local setup."
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": "### Prerequisites for Cloud Sandbox\n\nTo use Cua Cloud Sandbox, you need to:\n1. Sign up at https://trycua.com\n2. Create a Cloud Sandbox\n3. Generate an API Key\n\nOnce you have these, you can connect to your Cloud Sandbox using its name."
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Get API key and container name from environment or prompt user\n",
|
|
"import os\n",
|
|
"\n",
|
|
"cua_api_key = os.getenv(\"CUA_API_KEY\") or \\\n",
|
|
" input(\"Enter your Cua API Key: \")\n",
|
|
"container_name = os.getenv(\"CONTAINER_NAME\") or \\\n",
|
|
" input(\"Enter your Cloud Container name: \")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": "Choose the OS type for your sandbox (linux or macos)"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": "os_type = input(\"Enter the OS type of your sandbox (linux/macos) [default: linux]: \").lower() or \"linux\""
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": "### Connect to your Cloud Sandbox"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from computer import Computer, VMProviderType"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": "Connect to your existing Cua Cloud Sandbox"
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": "computer = Computer(\n os_type=os_type, # Must match the OS type of your Cloud Sandbox\n api_key=cua_api_key,\n name=container_name,\n provider_type=VMProviderType.CLOUD,\n)"
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Take a screenshot"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"await computer.run() # Initialize the computer first\n",
|
|
"\n",
|
|
"screenshot = await computer.interface.screenshot()\n",
|
|
"\n",
|
|
"with open(\"screenshot.png\", \"wb\") as f:\n",
|
|
" f.write(screenshot)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Option 2: KASM Local Docker Containers (cross-platform)\n",
|
|
"\n",
|
|
"### Pull from Docker Hub\n",
|
|
"```bash\n",
|
|
"docker pull --platform=linux/amd64 trycua/cua-ubuntu:latest\n",
|
|
"```\n",
|
|
"\n",
|
|
"### Or build locally\n",
|
|
"```bash\n",
|
|
"cd libs/kasm\n",
|
|
"docker build -t cua-ubuntu:latest .\n",
|
|
"```"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from computer import Computer\n",
|
|
"\n",
|
|
"computer = Computer(\n",
|
|
" os_type=\"linux\",\n",
|
|
" provider_type=\"docker\",\n",
|
|
" image=\"trycua/cua-ubuntu:latest\",\n",
|
|
" name=\"my-cua-container\"\n",
|
|
")\n",
|
|
"\n",
|
|
"await computer.run() # Launch & connect to Docker container"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Option 3: Local VMs (Lume daemon)\n",
|
|
"\n",
|
|
"For Apple Silicon Macs, you can run VMs locally using the Lume daemon."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Lume daemon setup\n",
|
|
"\n",
|
|
"Refer to [../libs/lume/README.md](../libs/lume/README.md) for more details on the lume cli."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"For installing the standalone lume binary, run the following command from a terminal:\n",
|
|
"\n",
|
|
"```bash\n",
|
|
"/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)\"\n",
|
|
"```"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Pull the latest pre-built macos-sequoia-cua image. This image, based on macOS Sequoia, contains all dependencies needed to be controlled from the cua-computer interface."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"!lume pull macos-sequoia-cua:latest"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"VMs are stored in `~/.lume`, and locally cached images are stored in `~/.lume/cache`."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"You can always see the list of downloaded VM images with:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"name os cpu memory disk display status storage shared_dirs ip vnc \n",
|
|
"macos-sequoia-cua_latest macOS 4 8.00G 25.9GB/80.0GB 1024x768 stopped default - - - \n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"!lume ls"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Testing the sandbox\n",
|
|
"\n",
|
|
"Once downloaded, you can run the sandbox to test everything is working:\n",
|
|
"\n",
|
|
"```bash\n",
|
|
"lume run macos-sequoia-cua:latest\n",
|
|
"```"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"You can add additional software and tools to the sandbox - these changes will be saved in the VM disk."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Initialize a Local Computer instance"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Computer allows you to create and control a virtual sandbox instances from your host on Apple Silicon. Here's a basic example:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 23,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from computer import Computer, VMProviderType"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"You can either use the async context manager or initialize the Computer instance directly."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With the async context manager:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"async with Computer(\n",
|
|
" # name=\"my_vm\", # optional, in case you want to use any other VM created using lume\n",
|
|
" display=\"1024x768\",\n",
|
|
" memory=\"8GB\",\n",
|
|
" cpu=\"4\",\n",
|
|
" os_type=\"macos\",\n",
|
|
" provider_type=VMProviderType.LUME,\n",
|
|
") as computer:\n",
|
|
" pass\n",
|
|
" # ... do something with the computer interface"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Direct initialization:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"computer = Computer(\n",
|
|
" display=\"1024x768\",\n",
|
|
" memory=\"8GB\",\n",
|
|
" cpu=\"4\",\n",
|
|
" os_type=\"macos\"\n",
|
|
")\n",
|
|
"\n",
|
|
"await computer.run()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Computer Interface\n",
|
|
"\n",
|
|
"Both cloud and local computers provide the same interface for interaction."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"In order to execute commands targeting the sandbox, the Computer interface communicates through websockets to a Fast API server running on the sandbox."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Cursor"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Move and click\n",
|
|
"await computer.interface.move_cursor(100, 100)\n",
|
|
"await computer.interface.left_click()\n",
|
|
"await computer.interface.right_click(300, 300)\n",
|
|
"await computer.interface.double_click(400, 400)\n",
|
|
"\n",
|
|
"# Drag operations\n",
|
|
"await computer.interface.drag_to(500, 500, duration=1.0)\n",
|
|
"\n",
|
|
"# Get cursor position\n",
|
|
"cursor_pos = await computer.interface.get_cursor_position()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Keyboard"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Type text\n",
|
|
"await computer.interface.type_text(\"Hello, World!\")\n",
|
|
"\n",
|
|
"# Press individual keys\n",
|
|
"await computer.interface.press_key(\"enter\")\n",
|
|
"await computer.interface.press_key(\"escape\")\n",
|
|
"\n",
|
|
"# Use hotkeys\n",
|
|
"await computer.interface.hotkey(\"command\", \"c\") # Command+C on macOS"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Screen"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Get screen dimensions\n",
|
|
"screen_size = await computer.interface.get_screen_size()\n",
|
|
"\n",
|
|
"# Take basic screenshot\n",
|
|
"screenshot = await computer.interface.screenshot()\n",
|
|
"with open(\"screenshot.png\", \"wb\") as f:\n",
|
|
" f.write(screenshot)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Clipboard"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Set clipboard content\n",
|
|
"await computer.interface.set_clipboard(\"Text to copy\")\n",
|
|
"\n",
|
|
"# Get clipboard content\n",
|
|
"clipboard_content = await computer.interface.copy_to_clipboard()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### File System Operations"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Check file/directory existence\n",
|
|
"file_exists = await computer.interface.file_exists(\"/path/to/file.txt\")\n",
|
|
"dir_exists = await computer.interface.directory_exists(\"/path/to/directory\")\n",
|
|
"\n",
|
|
"# Run shell commands\n",
|
|
"result = await computer.interface.run_command(\"ls -la\")\n",
|
|
"stdout, stderr, returncode = result.stdout, result.stderr, result.returncode"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Accessibility"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Get accessibility tree\n",
|
|
"accessibility_tree = await computer.interface.get_accessibility_tree()\n",
|
|
"print(accessibility_tree)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Sharing a directory with the sandbox"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"You can share a directory with the sandbox by passing a list of absolute paths to the `shared_directories` argument when initializing the Computer instance."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"computer = Computer(\n",
|
|
" display=\"1024x768\",\n",
|
|
" memory=\"4GB\",\n",
|
|
" cpu=\"2\",\n",
|
|
" os_type=\"macos\",\n",
|
|
" shared_directories=[\"/absolute/path/to/directory\"]\n",
|
|
")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Using Host Computer\n",
|
|
"\n",
|
|
"For local development and testing purposes, you can run the Computer API server on the same host machine and target it instead:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"computer = Computer(\n",
|
|
" display=\"1024x768\",\n",
|
|
" memory=\"4GB\",\n",
|
|
" cpu=\"2\",\n",
|
|
" os_type=\"macos\",\n",
|
|
" use_host_computer_server=True\n",
|
|
")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### Examples"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from computer.computer import Computer"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"async with Computer(\n",
|
|
" display=\"1024x768\",\n",
|
|
" memory=\"4GB\",\n",
|
|
" cpu=\"2\",\n",
|
|
" os_type=\"macos\"\n",
|
|
") as computer:\n",
|
|
" await computer.run()\n",
|
|
" res = await computer.interface.run_command(\"ls -a\")\n",
|
|
"\n",
|
|
" # Get screen dimensions\n",
|
|
" screen_size = await computer.interface.get_screen_size()\n",
|
|
"\n",
|
|
" # Move and click\n",
|
|
" await computer.interface.move_cursor(100, 100)\n",
|
|
" await computer.interface.left_click()\n",
|
|
" await computer.interface.right_click(300, 300)\n",
|
|
" await computer.interface.double_click(400, 400)\n",
|
|
"\n",
|
|
" # Drag operations\n",
|
|
" await computer.interface.drag_to(500, 500, duration=1.0)\n",
|
|
"\n",
|
|
" # Get cursor position\n",
|
|
" cursor_pos = await computer.interface.get_cursor_position()\n",
|
|
"\n",
|
|
" # Your automation code here\n",
|
|
" await computer.stop()"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "cua",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.13.5"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
} |