{"id":32369576,"url":"https://github.com/google-gemini/computer-use-preview","last_synced_at":"2026-01-20T21:38:34.322Z","repository":{"id":318524443,"uuid":"978411532","full_name":"google-gemini/computer-use-preview","owner":"google-gemini","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-14T06:27:25.000Z","size":271,"stargazers_count":2679,"open_issues_count":31,"forks_count":343,"subscribers_count":30,"default_branch":"main","last_synced_at":"2026-01-14T10:14:33.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google-gemini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-06T00:20:31.000Z","updated_at":"2026-01-14T09:39:24.000Z","dependencies_parsed_at":"2025-10-29T08:35:25.212Z","dependency_job_id":null,"html_url":"https://github.com/google-gemini/computer-use-preview","commit_stats":null,"previous_names":["google/computer-use-preview","google-gemini/computer-use-preview"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/google-gemini/computer-use-preview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fcomputer-use-preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fcomputer-use-preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fcomputer-use-preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fcomputer-use-preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-gemini","download_url":"https://codeload.github.com/google-gemini/computer-use-preview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fcomputer-use-preview/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28614773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T18:56:40.769Z","status":"ssl_error","status_checked_at":"2026-01-20T18:54:26.653Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-24T20:01:05.355Z","updated_at":"2026-01-20T21:38:34.313Z","avatar_url":"https://github.com/google-gemini.png","language":"Python","funding_links":[],"categories":["Repos","Python"],"sub_categories":[],"readme":"# 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://github.com/google/computer-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/bin/activate\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\"' \u003e\u003e .venv/bin/activate\n# After editing, you'll need to deactivate and reactivate your virtual\n# environment if it's already active:\ndeactivate\nsource .venv/bin/activate\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' \u003e\u003e .venv/bin/activate\necho 'export VERTEXAI_PROJECT=\"your-project-id\"' \u003e\u003e .venv/bin/activate\necho 'export VERTEXAI_LOCATION=\"your-location\"' \u003e\u003e .venv/bin/activate\n# After editing, you'll need to deactivate and reactivate your virtual\n# environment if it's already active:\ndeactivate\nsource .venv/bin/activate\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\u003e``` 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://www.google.com/search?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## 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/A | All |\n| `--env` | The computer use environment to use. Must be one of the following: `playwright`, or `browserbase` | No | N/A | All |\n| `--initial_url` | The initial URL to load when the browser starts. | No | https://www.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\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\u003e` 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://github.com/amitamb/proxy-select) to render a custom `\u003cselect\u003e` element. You must inject `proxy-select.css` and `proxy-select.js` into each page that has a non-custom `\u003cselect\u003e` element. You can do this in the [`Playwright.__enter__`](https://github.com/google-gemini/computer-use-preview/blob/main/computers/playwright/playwright.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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-gemini%2Fcomputer-use-preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-gemini%2Fcomputer-use-preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-gemini%2Fcomputer-use-preview/lists"}