ruflo

🌐 Browser Automation

/docs/architecture--modules/browser-automation

npm version

AI-optimized browser automation integrating agent-browser with ruflo for intelligent web automation, trajectory learning, and multi-agent browser coordination.

Installation

bash
npm install @claude-flow/browser

# agent-browser CLI (auto-suggested on install, or install manually)
npm install -g agent-browser@latest

Quick Start

typescript
import { 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

FeatureDescription
59 MCP ToolsComplete browser automation via MCP protocol
Element RefsCompact @e1, @e2 refs instead of verbose CSS selectors
Trajectory LearningRecords actions for ReasoningBank/SONA
Security ScanningURL validation, PII detection, XSS/SQL injection prevention
9 Workflow TemplatesLogin, OAuth, scraping, testing, monitoring
Swarm CoordinationMulti-session parallel browser automation

Security Integration

typescript
import { 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

typescript
import { 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