š Browser Automation
/docs/architecture--modules/browser-automation
AI-optimized browser automation integrating agent-browser with ruflo for intelligent web automation, trajectory learning, and multi-agent browser coordination.
Installation
bashnpm install @claude-flow/browser # agent-browser CLI (auto-suggested on install, or install manually) npm install -g agent-browser@latest
Quick Start
typescriptimport { createBrowserService } from '@claude-flow/browser'; const browser = createBrowserService({ sessionId: 'my-session', enableSecurity: true, // URL/PII scanning enableMemory: true, // Trajectory learning }); // Track actions for ReasoningBank/SONA learning browser.startTrajectory('Login to dashboard'); await browser.open('https://example.com/login'); // Use element refs (shorter tokens vs full CSS selectors) const snapshot = await browser.snapshot({ interactive: true }); await browser.fill('@e1', 'user@example.com'); await browser.fill('@e2', 'password'); await browser.click('@e3'); await browser.endTrajectory(true, 'Login successful'); await browser.close();
Key Features
| Feature | Description |
|---|---|
| 59 MCP Tools | Complete browser automation via MCP protocol |
| Element Refs | Compact @e1, @e2 refs instead of verbose CSS selectors |
| Trajectory Learning | Records actions for ReasoningBank/SONA |
| Security Scanning | URL validation, PII detection, XSS/SQL injection prevention |
| 9 Workflow Templates | Login, OAuth, scraping, testing, monitoring |
| Swarm Coordination | Multi-session parallel browser automation |
Security Integration
typescriptimport { getSecurityScanner, isUrlSafe, containsPII } from '@claude-flow/browser'; // URL threat detection const scanner = getSecurityScanner({ requireHttps: true }); const result = await scanner.scanUrl('https://example.com'); // { safe: true, threats: [], score: 1.0 } // PII detection containsPII('SSN: 123-45-6789'); // true // Input validation (XSS, SQL injection) scanner.validateInput('<script>alert(1)</script>', 'comment'); // { safe: false, threats: [{type: 'xss', ...}] }
Workflow Templates
typescriptimport { listWorkflows, getWorkflow } from '@claude-flow/browser'; listWorkflows(); // ['login-basic', 'login-oauth', 'scrape-table', ...] const template = getWorkflow('login-basic'); // { steps: [{action: 'open'}, {action: 'fill'}, ...], variables: [...] }
š Full Documentation