[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72375":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":18,"compositeScore":19,"rankGlobal":8,"rankLanguage":8,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":8,"pushedAt":8,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":14,"starSnapshotCount":14,"syncStatus":15,"lastSyncTime":27,"discoverSource":28},72375,"computer-use-preview","google-gemini\u002Fcomputer-use-preview","google-gemini",null,"Python",2956,375,29,21,0,2,9,30,6,29.73,"Apache License 2.0",false,"main",[],"2026-06-12 02:03:02","# Computer Use Preview\n\n## Quick Start\n\nThis section will guide you through setting up and running the Computer Use Preview model, either the Gemini Developer API or Vertex AI. Follow these steps to get started.\n\n### 1. Installation\n\n**Clone the Repository**\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcomputer-use-preview.git\ncd computer-use-preview\n```\n\n**Set up Python Virtual Environment and Install Dependencies**\n\n```bash\npython3 -m venv .venv\nsource .venv\u002Fbin\u002Factivate\npip install -r requirements.txt\n```\n\n**Install Playwright and Browser Dependencies**\n\n```bash\n# Install system dependencies required by Playwright for Chrome\nplaywright install-deps chrome\n\n# Install the Chrome browser for Playwright\nplaywright install chrome\n```\n\n### 2. Configuration\nYou can get started using either the Gemini Developer API or Vertex AI.\n\n#### A. If using the Gemini Developer API:\n\nYou need a Gemini API key to use the agent:\n\n```bash\nexport GEMINI_API_KEY=\"YOUR_GEMINI_API_KEY\"\n```\n\nOr to add this to your virtual environment:\n\n```bash\necho 'export GEMINI_API_KEY=\"YOUR_GEMINI_API_KEY\"' >> .venv\u002Fbin\u002Factivate\n# After editing, you'll need to deactivate and reactivate your virtual\n# environment if it's already active:\ndeactivate\nsource .venv\u002Fbin\u002Factivate\n```\n\nReplace `YOUR_GEMINI_API_KEY` with your actual key.\n\n#### B. If using the Vertex AI Client:\n\nYou need to explicitly use Vertex AI, then provide project and location to use the agent:\n\n```bash\nexport USE_VERTEXAI=true\nexport VERTEXAI_PROJECT=\"YOUR_PROJECT_ID\"\nexport VERTEXAI_LOCATION=\"YOUR_LOCATION\"\n```\n\nOr to add this to your virtual environment:\n\n```bash\necho 'export USE_VERTEXAI=true' >> .venv\u002Fbin\u002Factivate\necho 'export VERTEXAI_PROJECT=\"your-project-id\"' >> .venv\u002Fbin\u002Factivate\necho 'export VERTEXAI_LOCATION=\"your-location\"' >> .venv\u002Fbin\u002Factivate\n# After editing, you'll need to deactivate and reactivate your virtual\n# environment if it's already active:\ndeactivate\nsource .venv\u002Fbin\u002Factivate\n```\n\nReplace `YOUR_PROJECT_ID` and `YOUR_LOCATION` with your actual project and location.\n\n### 3. Running the Tool\n\nThe primary way to use the tool is via the `main.py` script.\n\n**General Command Structure:**\n\n```bash\npython main.py --query \"Go to Google and type 'Hello World' into the search bar\"\n```\n\n**Available Environments:**\n\nYou can specify a particular environment with the ```--env \u003Cenvironment>``` flag.  Available options:\n\n- `playwright`: Runs the browser locally using Playwright.\n- `browserbase`: Connects to a Browserbase instance.\n\n**Local Playwright**\n\nRuns the agent using a Chrome browser instance controlled locally by Playwright.\n\n```bash\npython main.py --query=\"Go to Google and type 'Hello World' into the search bar\" --env=\"playwright\"\n```\n\nYou can also specify an initial URL for the Playwright environment:\n\n```bash\npython main.py --query=\"Go to Google and type 'Hello World' into the search bar\" --env=\"playwright\" --initial_url=\"https:\u002F\u002Fwww.google.com\u002Fsearch?q=latest+AI+news\"\n```\n\n**Browserbase**\n\nRuns the agent using Browserbase as the browser backend. Ensure the proper Browserbase environment variables are set:`BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`.\n\n```bash\npython main.py --query=\"Go to Google and type 'Hello World' into the search bar\" --env=\"browserbase\"\n```\n\n**Available Models:**\n\nYou can choose the model to use by specifying the ```--model \u003Cmodel name>``` flag. Available options on Gemini Developer API and Vertex AI Client:\n\n- `gemini-2.5-computer-use-preview-10-2025`: This is the default model.\n- `gemini-3-flash-preview`: The preview version of Gemini 3 Flash.\n\n## Agent CLI\n\nThe `main.py` script is the command-line interface (CLI) for running the browser agent.\n\n### Command-Line Arguments\n\n| Argument | Description | Required | Default | Supported Environment(s) |\n|-|-|-|-|-|\n| `--query` | The natural language query for the browser agent to execute. | Yes | N\u002FA | All |\n| `--env` | The computer use environment to use. Must be one of the following: `playwright`, or `browserbase` | No | N\u002FA | All |\n| `--initial_url` | The initial URL to load when the browser starts. | No | https:\u002F\u002Fwww.google.com | All |\n| `--highlight_mouse` | If specified, the agent will attempt to highlight the mouse cursor's position in the screenshots. This is useful for visual debugging. | No | False (not highlighted) | `playwright` |\n| `--model` | The model to use. See the \"Available Models\" section for more information. | No | `gemini-2.5-computer-use-preview-10-2025` | All |\n\n### Environment Variables\n\n| Variable | Description | Required |\n|-|-|-|\n| GEMINI_API_KEY | Your API key for the Gemini model. | Yes |\n| BROWSERBASE_API_KEY | Your API key for Browserbase. | Yes (when using the browserbase environment) |\n| BROWSERBASE_PROJECT_ID | Your Project ID for Browserbase. | Yes (when using the browserbase environment) |\n\n## Known Issues\n\n### Playwright Dropdown Menu\n\nOn certain operating systems, the Playwright browser is unable to capture `\u003Cselect>` elements because they are rendered by the operating system. As a result, the agent is unable to send the correct screenshot to the model.\n\nThere are several ways to mitigate this.\n\n1. Use the Browserbase option instead of Playwright.\n2. Inject a script like [proxy-select](https:\u002F\u002Fgithub.com\u002Famitamb\u002Fproxy-select) to render a custom `\u003Cselect>` element. You must inject `proxy-select.css` and `proxy-select.js` into each page that has a non-custom `\u003Cselect>` element. You can do this in the [`Playwright.__enter__`](https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fcomputer-use-preview\u002Fblob\u002Fmain\u002Fcomputers\u002Fplaywright\u002Fplaywright.py#L100) method by adding a few lines of code, like the following (replacing `PROXY_SELECT_JS` and `PROXY_SELECT_CSS` with the appropriate variables):\n\n```python\nself._page.add_init_script(PROXY_SELECT_JS)\ndef inject_style(page):\n    try:\n        page.add_style_tag(content=PROXY_SELECT_CSS)\n    except Exception as e:\n        print(f\"Error injecting style: {e}\")\n\nself._page.on('domcontentloaded', inject_style)\n```\n\nNote, option 2 does not work 100% of the time, but is a temporary workaround for certain websites. The better option is to use Browserbase.\n","Computer Use Preview 是一个基于 Python 的项目，旨在通过 Gemini Developer API 或 Vertex AI 来实现自动化浏览器操作。其核心功能包括利用 Playwright 控制 Chrome 浏览器执行指定任务，如网页导航、表单填写等，并支持在本地或远程环境中运行。技术特点上，该项目提供了灵活的配置选项，允许用户根据需求选择不同的后端服务（Gemini API 或 Vertex AI），并通过简单的命令行参数来定制行为。适用于需要自动完成网页交互任务的各种场景，比如自动化测试、数据抓取或是演示目的。","2026-06-11 03:41:35","high_star"]