PluginBench
Skill
Fail
Audit score 45

gemini-computer-use

am-will/codex-skills

Automate web browser tasks with Gemini 2.5 Computer Use and Playwright.

What is gemini-computer-use?

Build and run agents that control browsers via the Gemini 2.5 Computer Use model. The agent captures screenshots, sends them to Gemini, executes returned actions in Playwright, and loops until the task completes or a turn limit is reached. Use this when you need to automate web interactions, scrape dynamic content, or test UI workflows.

  • Captures screenshots and sends them to Gemini 2.5 with user goals
  • Parses and executes browser actions (click, type, scroll) via Playwright
  • Implements agent loop: screenshot → function_call → action → function_response
  • Supports safety confirmation prompts for risky UI actions before execution
  • Allows browser selection via environment variables (Chromium, Chrome, Edge, custom executables)
  • Respects turn limits and exclusion rules to prevent unwanted actions

How to install gemini-computer-use

npx skills add https://github.com/am-will/codex-skills --skill gemini-computer-use
Prerequisites
  • Python 3.7+
  • Google Generative AI API key (set in env.sh)
  • Playwright and google-genai Python packages
  • Chromium or compatible browser (installed via playwright install)
Claude Code
Cursor
Windsurf
Cline

How to use gemini-computer-use

  1. 1.Copy env.example to env.sh and add your Google API key
  2. 2.Create a Python virtual environment and activate it
  3. 3.Install dependencies: pip install google-genai playwright
  4. 4.Run playwright install chromium to download the browser
  5. 5.Execute the agent with a prompt and start URL: python scripts/computer_use_agent.py --prompt "your goal" --start-url "https://example.com" --turn-limit 6
  6. 6.Monitor the agent loop output and approve safety confirmations when prompted

Use cases

Good for
  • Automate repetitive web tasks like form filling or data extraction
  • Test dynamic web applications by simulating user interactions
  • Scrape content from JavaScript-heavy websites that require browser automation
  • Monitor websites for changes by taking screenshots and analyzing them
  • Validate UI workflows across different browsers and viewport sizes
Who it's for
  • Web automation engineers
  • QA and testing professionals
  • Data extraction specialists
  • Web scraping developers
  • AI agent builders

gemini-computer-use FAQ

What browsers are supported?

Playwright's bundled Chromium by default. You can also use Chrome, Edge, or custom Chromium-based executables (e.g., Brave) via COMPUTER_USE_BROWSER_CHANNEL or COMPUTER_USE_BROWSER_EXECUTABLE environment variables.

How do I prevent the agent from taking risky actions?

Use the --exclude flag to block specific actions, run in a sandboxed browser profile, and enable safety_decision confirmation prompts for sensitive operations.

What happens when the agent reaches the turn limit?

The agent stops executing and returns the final state. Adjust --turn-limit to allow more iterations if needed.

Can I use this with headless browsers?

Yes, Playwright supports headless mode. Configure it in the script or environment variables as needed.

What should the viewport size be?

The default 1440x900 is recommended unless you have a specific reason to change it for testing different screen sizes.

Full instructions (SKILL.md)

Source of truth, from am-will/codex-skills.


name: gemini-computer-use description: Build and run Gemini 2.5 Computer Use browser-control agents with Playwright. Use when a user wants to automate web browser tasks via the Gemini Computer Use model, needs an agent loop (screenshot → function_call → action → function_response), or asks to integrate safety confirmation for risky UI actions.

Gemini Computer Use

Quick start

  1. Source the env file and set your API key:

    cp env.example env.sh
    $EDITOR env.sh
    source env.sh
    
  2. Create a virtual environment and install dependencies:

    python -m venv .venv
    source .venv/bin/activate
    pip install google-genai playwright
    playwright install chromium
    
  3. Run the agent script with a prompt:

    python scripts/computer_use_agent.py \
      --prompt "Find the latest blog post title on example.com" \
      --start-url "https://example.com" \
      --turn-limit 6
    

Browser selection

  • Default: Playwright's bundled Chromium (no env vars required).
  • Choose a channel (Chrome/Edge) with COMPUTER_USE_BROWSER_CHANNEL.
  • Use a custom Chromium-based executable (e.g., Brave) with COMPUTER_USE_BROWSER_EXECUTABLE.

If both are set, COMPUTER_USE_BROWSER_EXECUTABLE takes precedence.

Core workflow (agent loop)

  1. Capture a screenshot and send the user goal + screenshot to the model.
  2. Parse function_call actions in the response.
  3. Execute each action in Playwright.
  4. If a safety_decision is require_confirmation, prompt the user before executing.
  5. Send function_response objects containing the latest URL + screenshot.
  6. Repeat until the model returns only text (no actions) or you hit the turn limit.

Operational guidance

  • Run in a sandboxed browser profile or container.
  • Use --exclude to block risky actions you do not want the model to take.
  • Keep the viewport at 1440x900 unless you have a reason to change it.

Resources

  • Script: scripts/computer_use_agent.py
  • Reference notes: references/google-computer-use.md
  • Env template: env.example