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- 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)
How to use gemini-computer-use
- 1.Copy env.example to env.sh and add your Google API key
- 2.Create a Python virtual environment and activate it
- 3.Install dependencies: pip install google-genai playwright
- 4.Run playwright install chromium to download the browser
- 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.Monitor the agent loop output and approve safety confirmations when prompted
Use cases
- 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
- Web automation engineers
- QA and testing professionals
- Data extraction specialists
- Web scraping developers
- AI agent builders
gemini-computer-use FAQ
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.
Use the --exclude flag to block specific actions, run in a sandboxed browser profile, and enable safety_decision confirmation prompts for sensitive operations.
The agent stops executing and returns the final state. Adjust --turn-limit to allow more iterations if needed.
Yes, Playwright supports headless mode. Configure it in the script or environment variables as needed.
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
-
Source the env file and set your API key:
cp env.example env.sh $EDITOR env.sh source env.sh -
Create a virtual environment and install dependencies:
python -m venv .venv source .venv/bin/activate pip install google-genai playwright playwright install chromium -
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)
- Capture a screenshot and send the user goal + screenshot to the model.
- Parse
function_callactions in the response. - Execute each action in Playwright.
- If a
safety_decisionisrequire_confirmation, prompt the user before executing. - Send
function_responseobjects containing the latest URL + screenshot. - 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
--excludeto 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
Related skills
More from am-will/codex-skills and the wider catalog.

llm-council
Orchestrate multi-agent planning councils to produce bias-resistant implementation plans with structured JSON outputs and failure handling.

markdown-url
Route websites through markdown.new to extract clean, copy-friendly Markdown content from docs and articles.

openai-docs-skill
Query OpenAI's official developer docs via MCP server for API, SDK, and platform guidance.

parallel-task
Orchestrate parallel task execution with dependency management and test-driven validation.

parallel-task-spark
Orchestrate parallel task execution across subagents using dependency-aware task waves.

plan-harder
Create detailed, phased implementation plans with sprints and atomic tasks.