When to use this skill
Use this skill whenever the user wants to:
- Automate browser interactions (click, fill, navigate, screenshot) via CLI
- Scrape web content or extract data from pages
- Build AI agent workflows that interact with websites
- Use refs-based element selection for deterministic automation
- Run browser automation in agent mode with JSON output
- Manage authenticated sessions with custom headers or CDP
How to use this skill
This skill is organized to match the agent-browser official documentation structure (https://github.com/vercel-labs/agent-browser/blob/main/README.md). When working with agent-browser:
Quick-Start Example: Snapshot → Identify → Interact
# 1. Install
npm install -g @anthropic-ai/agent-browser
# 2. Open a page and take a snapshot to get element refs
agent-browser open "https://example.com"
agent-browser snapshot
# Output includes refs like @e1, @e2, @e3 for each element
# 3. Click an element by ref
agent-browser click @e3
# 4. Fill a form field
agent-browser fill @e5 "hello@example.com"
# 5. Agent mode (JSON output for programmatic use)
agent-browser snapshot --json
Detailed Documentation
Install agent-browser:
- Load
examples/getting-started/installation.md for installation instructions
Quick Start:
- Load
examples/quick-start/quick-start.md for basic workflow examples
Learn core commands:
- Load
examples/commands/basic-commands.md for basic commands (open, click, fill, etc.)
- Load
examples/commands/advanced-commands.md for advanced commands (snapshot, eval, etc.)
- Load
examples/commands/get-info/ for information retrieval commands
- Load
examples/commands/check-state/ for state checking commands
- Load
examples/commands/find-elements/ for semantic locator commands
- Load
examples/commands/wait/ for wait commands
- Load
examples/commands/mouse-control/ for mouse control commands
- Load
examples/commands/browser-settings/ for browser configuration
- Load
examples/commands/cookies-storage/ for cookies and storage management
- Load
examples/commands/network/ for network interception
- Load
examples/commands/tabs-windows/ for tab and window management
- Load
examples/commands/frames/ for iframe handling
- Load
examples/commands/dialogs/ for dialog handling
- Load
examples/commands/debug/ for debugging commands
- Load
examples/commands/navigation/ for navigation commands
- Load
examples/commands/setup/ for setup commands
Understand selectors:
- Load
examples/selectors/refs.md for refs-based selection (@e1, @e2, etc.)
- Load
examples/selectors/traditional-selectors.md for CSS, XPath, and semantic locators
Use agent mode:
- Load
examples/agent-mode/introduction.md for agent mode overview
- Load
examples/agent-mode/optimal-workflow.md for optimal AI workflow
- Load
examples/agent-mode/integration.md for integrating with AI agents
Advanced features:
- Load
examples/advanced/sessions.md for session management
- Load
examples/advanced/headed-mode.md for debugging with visible browser
- Load
examples/advanced/authenticated-sessions.md for authentication via headers
- Load
examples/advanced/custom-executable.md for custom browser executable
- Load
examples/advanced/cdp-mode.md for Chrome DevTools Protocol integration
- Load
examples/advanced/streaming.md for browser viewport streaming
- Load
examples/advanced/architecture.md for architecture overview
- Load
examples/advanced/platforms.md for platform support
- Load
examples/advanced/usage-with-agents.md for AI agent integration patterns
Configure options:
- Load
examples/options/global-options.md for global CLI options
- Load
examples/options/snapshot-options.md for snapshot-specific options
- Load
examples/options/session-options.md for session management options
Reference API documentation when needed:
api/commands.md - Complete command reference
api/selectors.md - Selector reference
api/options.md - Options reference
Use templates for quick start:
templates/basic-automation.md - Basic automation workflow
templates/ai-agent-workflow.md - AI agent workflow template
Doc mapping (one-to-one with official documentation)
Examples and Templates
This skill includes detailed examples organized to match the official documentation structure. All examples are in the examples/ directory (see mapping above).
To use examples:
- Identify the topic from the user's request
- Load the appropriate example file from the mapping above
- Follow the instructions, syntax, and best practices in that file
- Adapt the code examples to your specific use case
To use templates:
- Reference templates in
templates/ directory for common scaffolding
- Adapt templates to your specific needs and coding style
API Reference
- Commands API:
api/commands.md - Complete command reference with syntax and examples
- Selectors API:
api/selectors.md - Selector types and usage reference
- Options API:
api/options.md - All options reference
Best Practices
- Use Refs: Prefer refs (@e1, @e2) over traditional selectors for deterministic automation
- Snapshot First: Always snapshot before interacting with elements to get refs
- Agent Mode: Use
--json flag for machine-readable output in agent mode
- Session Management: Use
--session to maintain state across commands
- Interactive Snapshot: Use
-i flag for interactive snapshot selection
- Semantic Locators: Use semantic locators (role/name) when refs are not available
- Error Handling: Check command exit codes and error messages
- Wait for Navigation: Commands automatically wait for navigation to complete
- Headed Mode: Use
--headed for debugging, headless for production
- CDP Integration: Use
--cdp for Chrome DevTools Protocol integration
- Streaming: Use
AGENT_BROWSER_STREAM_PORT for live browser preview
- Authenticated Sessions: Use
--headers for authentication without login flows
- Custom Executable: Use
--executable-path for serverless deployments or custom browsers
- Snapshot Options: Combine
-i, -c, -d, -s options to optimize snapshot output
Resources
Keywords
agent-browser, CLI browser automation, AI agents, browser automation CLI, refs, snapshot, agent mode, semantic locators, browser automation tool, command-line browser, AI agent browser, deterministic selectors, accessibility tree, browser commands, web automation CLI, sessions, headed mode, authenticated sessions, CDP mode, streaming, Chrome DevTools Protocol, Playwright, browser automation for AI
1---2name: agent-browser3description: Automates browser interactions via CLI using agent-browser by Vercel Labs. Covers navigation, clicking, form filling, snapshots, refs-based selectors, agent mode with JSON output, session management, and CDP integration. Use when the user needs to automate web browsing, scrape pages, fill forms, or integrate browser automation into AI agent workflows.4license: Complete terms in LICENSE.txt5---67## When to use this skill89Use this skill whenever the user wants to:10- Automate browser interactions (click, fill, navigate, screenshot) via CLI11- Scrape web content or extract data from pages12- Build AI agent workflows that interact with websites13- Use refs-based element selection for deterministic automation14- Run browser automation in agent mode with JSON output15- Manage authenticated sessions with custom headers or CDP1617## How to use this skill1819This skill is organized to match the agent-browser official documentation structure (https://github.com/vercel-labs/agent-browser/blob/main/README.md). When working with agent-browser:2021### Quick-Start Example: Snapshot → Identify → Interact2223```bash24# 1. Install25npm install -g @anthropic-ai/agent-browser2627# 2. Open a page and take a snapshot to get element refs28agent-browser open "https://example.com"29agent-browser snapshot30# Output includes refs like @e1, @e2, @e3 for each element3132# 3. Click an element by ref33agent-browser click @e33435# 4. Fill a form field36agent-browser fill @e5 "hello@example.com"3738# 5. Agent mode (JSON output for programmatic use)39agent-browser snapshot --json40```4142### Detailed Documentation43441. **Install agent-browser**:45 - Load `examples/getting-started/installation.md` for installation instructions46472. **Quick Start**:48 - Load `examples/quick-start/quick-start.md` for basic workflow examples49503. **Learn core commands**:51 - Load `examples/commands/basic-commands.md` for basic commands (open, click, fill, etc.)52 - Load `examples/commands/advanced-commands.md` for advanced commands (snapshot, eval, etc.)53 - Load `examples/commands/get-info/` for information retrieval commands54 - Load `examples/commands/check-state/` for state checking commands55 - Load `examples/commands/find-elements/` for semantic locator commands56 - Load `examples/commands/wait/` for wait commands57 - Load `examples/commands/mouse-control/` for mouse control commands58 - Load `examples/commands/browser-settings/` for browser configuration59 - Load `examples/commands/cookies-storage/` for cookies and storage management60 - Load `examples/commands/network/` for network interception61 - Load `examples/commands/tabs-windows/` for tab and window management62 - Load `examples/commands/frames/` for iframe handling63 - Load `examples/commands/dialogs/` for dialog handling64 - Load `examples/commands/debug/` for debugging commands65 - Load `examples/commands/navigation/` for navigation commands66 - Load `examples/commands/setup/` for setup commands67684. **Understand selectors**:69 - Load `examples/selectors/refs.md` for refs-based selection (@e1, @e2, etc.)70 - Load `examples/selectors/traditional-selectors.md` for CSS, XPath, and semantic locators71725. **Use agent mode**:73 - Load `examples/agent-mode/introduction.md` for agent mode overview74 - Load `examples/agent-mode/optimal-workflow.md` for optimal AI workflow75 - Load `examples/agent-mode/integration.md` for integrating with AI agents76776. **Advanced features**:78 - Load `examples/advanced/sessions.md` for session management79 - Load `examples/advanced/headed-mode.md` for debugging with visible browser80 - Load `examples/advanced/authenticated-sessions.md` for authentication via headers81 - Load `examples/advanced/custom-executable.md` for custom browser executable82 - Load `examples/advanced/cdp-mode.md` for Chrome DevTools Protocol integration83 - Load `examples/advanced/streaming.md` for browser viewport streaming84 - Load `examples/advanced/architecture.md` for architecture overview85 - Load `examples/advanced/platforms.md` for platform support86 - Load `examples/advanced/usage-with-agents.md` for AI agent integration patterns87887. **Configure options**:89 - Load `examples/options/global-options.md` for global CLI options90 - Load `examples/options/snapshot-options.md` for snapshot-specific options91 - Load `examples/options/session-options.md` for session management options92938. **Reference API documentation** when needed:94 - `api/commands.md` - Complete command reference95 - `api/selectors.md` - Selector reference96 - `api/options.md` - Options reference97989. **Use templates** for quick start:99 - `templates/basic-automation.md` - Basic automation workflow100 - `templates/ai-agent-workflow.md` - AI agent workflow template101102103### Doc mapping (one-to-one with official documentation)104105- See examples and API files → https://github.com/vercel-labs/agent-browser106107## Examples and Templates108109This skill includes detailed examples organized to match the official documentation structure. All examples are in the `examples/` directory (see mapping above).110111**To use examples:**112- Identify the topic from the user's request113- Load the appropriate example file from the mapping above114- Follow the instructions, syntax, and best practices in that file115- Adapt the code examples to your specific use case116117**To use templates:**118- Reference templates in `templates/` directory for common scaffolding119- Adapt templates to your specific needs and coding style120121## API Reference122123- **Commands API**: `api/commands.md` - Complete command reference with syntax and examples124- **Selectors API**: `api/selectors.md` - Selector types and usage reference125- **Options API**: `api/options.md` - All options reference126127## Best Practices1281291. **Use Refs**: Prefer refs (@e1, @e2) over traditional selectors for deterministic automation1302. **Snapshot First**: Always snapshot before interacting with elements to get refs1313. **Agent Mode**: Use `--json` flag for machine-readable output in agent mode1324. **Session Management**: Use `--session` to maintain state across commands1335. **Interactive Snapshot**: Use `-i` flag for interactive snapshot selection1346. **Semantic Locators**: Use semantic locators (role/name) when refs are not available1357. **Error Handling**: Check command exit codes and error messages1368. **Wait for Navigation**: Commands automatically wait for navigation to complete1379. **Headed Mode**: Use `--headed` for debugging, headless for production13810. **CDP Integration**: Use `--cdp` for Chrome DevTools Protocol integration13911. **Streaming**: Use `AGENT_BROWSER_STREAM_PORT` for live browser preview14012. **Authenticated Sessions**: Use `--headers` for authentication without login flows14113. **Custom Executable**: Use `--executable-path` for serverless deployments or custom browsers14214. **Snapshot Options**: Combine `-i`, `-c`, `-d`, `-s` options to optimize snapshot output143144## Resources145146- **GitHub Repository**: https://github.com/vercel-labs/agent-browser147- **Official README**: https://github.com/vercel-labs/agent-browser/blob/main/README.md148- **Agent Mode Documentation**: https://agent-browser.dev/agent-mode149- **Issues**: https://github.com/vercel-labs/agent-browser/issues150151## Keywords152153agent-browser, CLI browser automation, AI agents, browser automation CLI, refs, snapshot, agent mode, semantic locators, browser automation tool, command-line browser, AI agent browser, deterministic selectors, accessibility tree, browser commands, web automation CLI, sessions, headed mode, authenticated sessions, CDP mode, streaming, Chrome DevTools Protocol, Playwright, browser automation for AI