A0 Playwright CLI
Microsoft Playwright CLI browser automation plugin for Agent Zero. Gives every agent a browser_agent tool to navigate, interact with, and extract data from any website using structured DOM snapshots with stable element references. Auto-installs playwright-cli and Chromium. 30 browser actions including scroll, eval, drag, dialogs, tabs, and viewport resize. Security-validated URL allowlist and element ref pattern. Live progress log and screenshot capture in the UI.
README
A0 Playwright CLI
Microsoft Playwright CLI browser automation plugin for Agent Zero. Gives every agent a browser_agent tool to navigate, interact with, and extract data from any website using structured DOM snapshots with stable element references.
Features
- π Playwright CLI backend β structured YAML DOM snapshots with stable element refs (
e1,e2, ...) - π€ Uses Agent Zero Browser Model β no separate LLM config needed, inherits your Settings β Agent β Browser Model
- π§ Auto-skill injection β the full Playwright CLI skill is injected into the agent system prompt automatically
- π 30 browser actions β navigation, interaction, keyboard & mouse, scroll, eval/JS, drag, dialogs, tabs, viewport, and more
- π Security validated β URL allowlist (http/https only), element ref pattern validation
- π± Mobile/device emulation β emulate any device viewport
- πΈοΈ Network mocking β intercept and mock HTTP requests
- π¬ DevTools tracing & video β record sessions for debugging
- π One-click initialization β installs playwright-cli and Chromium automatically
Installation
1. Copy the plugin
cp -r playwright_cli /path/to/agent-zero/usr/plugins/
2. Enable in Agent Zero
Go to Settings β Plugins β Playwright CLI and toggle it on.
3. Initialize (automatic)
Click the Initialize button on the plugin page. This will:
- Install
playwright-clivia npm (npm install -g @playwright/cli@latest) - Install Chromium binaries (
playwright-cli install) - Write
~/.playwright/cli.config.jsonpointing to the discovered Chromium binary
Manual install (fallback)
If initialization fails:
npm install -g @playwright/cli@latest
playwright-cli install
Configuration
This plugin inherits the Browser Model from Agent Zero's built-in settings.
Go to Settings β Agent β Browser Model to configure:
| Setting | Description |
|---|---|
| Provider | LLM provider for browser decisions (e.g. openrouter, openai) |
| Model | Model name (e.g. anthropic/claude-sonnet-4-5) |
| Vision | Enable vision for screenshot-based decisions |
| Rate limits | Optional request/token rate limiting |
No plugin-specific config page needed β all browser model settings live in the standard Agent Zero settings.
How It Works
Parent Agent
β
β browser_agent tool call
βΌ
BrowserAgent (tools/browser_agent.py)
β
β start_task(message)
βΌ
PlaywrightCliBackend (helpers/playwright_cli_backend.py)
β
ββ open browser session via playwright-cli
β
ββ LOOP (up to 50 steps):
β
ββ snapshot β YAML DOM with element refs (e1, e2, ...)
β
ββ LLM decision (Browser Model)
β SystemMessage: browser_agent.system.md (action protocol)
β HumanMessage: task + snapshot + action history
β
ββ execute action (goto/click/fill/press/...)
β
ββ done? β return result to parent agent
Available Actions
Navigation
| Action | Description |
|---|---|
goto |
Navigate to URL (http/https only) |
go-back |
Navigate back |
go-forward |
Navigate forward |
reload |
Reload page |
wait |
Wait N seconds for dynamic content (max 30) |
Interaction
| Action | Description |
|---|---|
click |
Click element by ref |
dblclick |
Double-click element |
fill |
Clear and fill input field |
type |
Type text at cursor |
press |
Press keyboard key (Enter, Tab, ArrowDown...) |
select |
Select dropdown option |
check |
Check checkbox |
uncheck |
Uncheck checkbox |
hover |
Hover over element |
drag |
Drag element (ref) onto target element (target) |
upload |
Upload file to input element |
Keyboard & Mouse
| Action | Description |
|---|---|
keydown |
Hold modifier key (Shift, Control, Alt, Meta) |
keyup |
Release held modifier key |
mousemove |
Move mouse to absolute x/y coordinates |
mousedown |
Press mouse button (default: left) |
mouseup |
Release mouse button (default: left) |
scroll |
Scroll page by dy pixels (positive = down) |
Page State
| Action | Description |
|---|---|
snapshot |
Force fresh DOM snapshot |
screenshot |
Take screenshot |
eval |
Evaluate JavaScript expression (optionally on element ref) |
run-code |
Run inline JS async page => { ... } |
resize |
Resize viewport (value: "width height") |
Dialogs
| Action | Description |
|---|---|
dialog-accept |
Accept browser dialog (optional confirmation text) |
dialog-dismiss |
Dismiss browser dialog |
Tabs
| Action | Description |
|---|---|
tab-new |
Open new tab (optional URL) |
tab-close |
Close current tab |
tab-select |
Switch to tab by index (0-based) |
tab-list |
List all open tabs |
Completion
| Action | Description |
|---|---|
done |
Task complete β return full result |
Usage
The browser_agent tool is available to all agents when the plugin is enabled:
{
"tool_name": "browser_agent",
"tool_args": {
"message": "Go to https://example.com and return the page title",
"reset": "true"
}
}
{
"tool_name": "browser_agent",
"tool_args": {
"message": "Considering open pages, click the Submit button and confirm the result. End task.",
"reset": "false"
}
}
reset: trueβ spawn a fresh browser sessionreset: falseβ continue the existing session (start message with "Considering open pages...")
Plugin Structure
playwright_cli/
βββ plugin.yaml # Plugin manifest (v1.2.0)
βββ initialize.py # Auto-installer for playwright-cli + Chromium
βββ default_config.yaml # Minimal config (inherits A0 browser model)
βββ tools/
β βββ browser_agent.py # browser_agent tool
βββ helpers/
β βββ playwright_cli_backend.py # Core agentic browser loop
β βββ playwright.py # Chromium binary discovery
βββ extensions/
β βββ python/
β βββ agent_init/
β β βββ _20_browser_plugin_config.py # Plugin init hook
β βββ system_prompt/
β βββ _16_playwright_cli_skill_prompt.py # Skill auto-injection
βββ prompts/
β βββ browser_agent.system.md # Internal browser LLM instructions
β βββ agent.system.tool.browser.md # Parent agent tool description
βββ webui/
β βββ config.html # Settings info card
βββ skills/
βββ playwright-cli/ # Bundled Playwright CLI skill
βββ SKILL.md
βββ references/
Requirements
- Node.js (for
npm install -g @playwright/cli) - Agent Zero with plugin support
- Browser model configured in Agent Zero Settings (any LLM provider)
License
MIT β Copyright (c) 2026 Emichi d.o.o. See LICENSE for details.
Changelog
v1.2.0 β 2026-03-25
New Actions (+16)
Expanded PlaywrightCliBackend._execute_action() from 16 to 32 action branches:
| New Action | Description |
|---|---|
scroll / mousewheel |
Scroll page by dx/dy pixels |
eval |
Evaluate JavaScript expression, optionally against an element ref |
drag |
Drag source element (ref) to target element (target) |
tab-select |
Switch to tab by 0-based index |
tab-list |
List all open tabs |
keydown |
Hold modifier key (Shift, Control, Alt, Meta) |
keyup |
Release held modifier key |
dialog-accept |
Accept browser alert/confirm/prompt |
dialog-dismiss |
Dismiss browser dialog |
resize |
Resize viewport to given width Γ height |
wait |
Sleep N seconds for dynamic content (max 30s cap) |
mousemove |
Move mouse to absolute x/y page coordinates |
mousedown |
Press mouse button |
mouseup |
Release mouse button |
upload |
Upload file to a file input element |
run-code |
Execute inline JS string async page => { ... } |
Updated
browser_agent.system.mdβ full action reference table with all 30 actions, grouped by category, with usage rules for scroll, drag, eval, resize, wait
v1.1.0 β 2026-03-25
Bug Fixes
get_log()implemented βPlaywrightCliBackendnow exposes aget_log()method populated throughout task execution. Previously, thehasattrguard inBrowserAgentalways returnedFalse, leaving the Agent Zero progress log empty for every browser task.get_screenshot()implemented βPlaywrightCliBackendnow exposes an asyncget_screenshot(path)method. Previously, screenshots were never captured or surfaced in the tool log despite the infrastructure being wired up._truncate_snapshot()crash fix β The playwright-cli YAML snapshot format is a top-level list, not a dict. The previous implementation calleddict(snapshot)on this list, raisingValueErrorand silently crashing every browser task after the first snapshot. Now handles both list (actual format) and dict (fallback) correctly.
New
hooks.pyβ Plugin now auto-installs playwright-cli and Chromium when enabled or updated via Agent Zero's plugin lifecycle hook. No need to manually click Initialize.LICENSEβ MIT license added with Apache 2.0 attribution for upstream playwright-cli (Microsoft Corporation).
Improvements
plugin.yamlβ removed non-standardnotefield; content merged intodescription.webui/config.htmlβ removed redundant<template x-if="true">wrapper; now clean static HTML.
v1.0.0 β 2026-03-19
- Initial release.