Skip to content

Self-improving AI Employees for everyone

feat: add Browser automation node via agent-browser CLI

trohitg5827e254e920
diff --git a/client/src/Dashboard.tsx b/client/src/Dashboard.tsx
index ea30c924..6164f713 100644
--- a/client/src/Dashboard.tsx
+++ b/client/src/Dashboard.tsx
@@ -37,6 +37,7 @@ import { APIFY_NODE_TYPES } from './nodeDefinitions/apifyNodes';
import { GOOGLE_WORKSPACE_NODE_TYPES } from './nodeDefinitions/googleWorkspaceNodes';
import { PROXY_NODE_TYPES } from './nodeDefinitions/proxyNodes';
import { CRAWLEE_NODE_TYPES } from './nodeDefinitions/crawleeNodes';
+import { BROWSER_NODE_TYPES } from './nodeDefinitions/browserNodes';
import { FILESYSTEM_NODE_TYPES } from './nodeDefinitions/filesystemNodes';
import { AI_CHAT_MODEL_TYPES } from './nodeDefinitions/aiModelNodes';
import ParameterPanel from './ParameterPanel';
@@ -150,6 +151,9 @@ const createNodeTypes = (): Record<string, React.ComponentType<any>> => {
} else if (CRAWLEE_NODE_TYPES.includes(type)) {
// Crawlee web scraping nodes use SquareNode component
types[type] = SquareNode;
+ } else if (BROWSER_NODE_TYPES.includes(type)) {
+ // Browser automation nodes use SquareNode component
+ types[type] = SquareNode;
} else if (FILESYSTEM_NODE_TYPES.includes(type)) {
// Filesystem & shell nodes use SquareNode component
types[type] = SquareNode;
diff --git a/client/src/components/parameterPanel/InputSection.tsx b/client/src/components/parameterPanel/InputSection.tsx
index 8fae439b..5985e34c 100644
--- a/client/src/components/parameterPanel/InputSection.tsx
+++ b/client/src/components/parameterPanel/InputSection.tsx
@@ -709,6 +709,12 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
success: 'boolean',
data: 'any'
},
+ // Browser automation schema
+ browser: {
+ operation: 'string',
+ data: 'any',
+ session: 'string'
+ },
// Crawlee web scraping schema
crawlee: {
pages: [{
@@ -801,6 +807,9 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
const proxyNodeTypes = ['proxyRequest', 'proxyStatus', 'proxyConfig'];
const isProxyNode = proxyNodeTypes.includes(nodeType);
+ // Browser automation node detection
+ const isBrowser = nodeType === 'browser';
+
// Crawlee web scraping node detection
const isCrawlee = nodeType === 'crawleeScraper';
@@ -836,6 +845,7 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
isSocialSend ? sampleSchemas.socialSend :
isApify ? sampleSchemas.apify :
isSearchNode ? sampleSchemas.search :
+ isBrowser ? sampleSchemas.browser :
isCrawlee ? sampleSchemas.crawlee :
isFilesystemNode ? (sampleSchemas[nodeType as keyof typeof sampleSchemas] || { data: 'any' }) :
{ data: 'any' };
diff --git a/client/src/nodeDefinitions.ts b/client/src/nodeDefinitions.ts
index 83aed314..553f6a0d 100644
--- a/client/src/nodeDefinitions.ts
+++ b/client/src/nodeDefinitions.ts
@@ -25,6 +25,7 @@ import { searchNodes, SEARCH_NODE_TYPES } from './nodeDefinitions/searchNodes';
import { googleWorkspaceNodes, GOOGLE_WORKSPACE_NODE_TYPES } from './nodeDefinitions/googleWorkspaceNodes';
import { proxyNodes, PROXY_NODE_TYPES } from './nodeDefinitions/proxyNodes';
import { crawleeNodes, CRAWLEE_NODE_TYPES } from './nodeDefinitions/crawleeNodes';
+import { browserNodes, BROWSER_NODE_TYPES } from './nodeDefinitions/browserNodes';
import { filesystemNodes, FILESYSTEM_NODE_TYPES } from './nodeDefinitions/filesystemNodes';
// ============================================================================
@@ -55,6 +56,7 @@ export const nodeDefinitions: Record<string, INodeTypeDescription> = {
...googleWorkspaceNodes,
...proxyNodes,
...crawleeNodes,
+ ...browserNodes,
...filesystemNodes
};
diff --git a/client/src/nodeDefinitions/browserNodes.ts b/client/src/nodeDefinitions/browserNodes.ts
new file mode 100644
index 00000000..8fb8a9dc
--- /dev/null
+++ b/client/src/nodeDefinitions/browserNodes.ts
@@ -0,0 +1,197 @@
+// Browser Automation Node - Interactive browser control via agent-browser CLI
+// Dual-purpose node: works as standalone workflow node AND AI Agent tool
+
+import {
+ INodeTypeDescription,
+ NodeConnectionType,
+} from '../types/INodeProperties';
+import { dracula } from '../styles/theme';
+
+export const browserNodes: Record<string, INodeTypeDescription> = {
+ browser: {
+ displayName: 'Browser',
+ name: 'browser',
+ icon: '🌐',
+ group: ['browser', 'tool'],
+ version: 1,
+ subtitle: 'Agent Browser',
+ description: 'Interactive browser automation via agent-browser. Navigate, click, type, fill forms, take screenshots, get accessibility snapshots, and execute JavaScript.',
+ defaults: { name: 'Browser', color: dracula.cyan },
+ inputs: [
+ {
+ name: 'main',
+ displayName: 'Input',
+ type: 'main' as NodeConnectionType,
+ description: 'Input data',
+ },
+ ],
+ outputs: [
+ {
+ name: 'main',
+ displayName: 'Output',
+ type: 'main' as NodeConnectionType,
+ description: 'Browser operation result',
+ },
+ {
+ name: 'tool',
+ displayName: 'Tool',
+ type: 'main' as NodeConnectionType,
+ description: 'Connect to AI Agent tool handle',
+ },
+ ],
+ properties: [
+ // ===== TOOL CONFIG =====
+ {
+ displayName: 'Tool Name',
+ name: 'toolName',
+ type: 'string',
+ default: 'browser',
+ description: 'Name of this tool when used by AI Agent',
+ },
+ {
+ displayName: 'Tool Description',
+ name: 'toolDescription',
+ type: 'string',
+ default: 'Control a web browser. Use snapshot to see the page (returns accessibility tree with @eN refs). Then click/type/fill with those refs. Workflow: navigate -> snapshot -> click/fill -> snapshot.',
+ typeOptions: { rows: 3 },
+ description: 'Description shown to AI Agent for tool usage',
+ },
+
+ // ===== OPERATION =====
+ {
+ displayName: 'Operation',
+ name: 'operation',
+ type: 'options',
+ default: 'navigate',
+ options: [
+ { name: 'Navigate', value: 'navigate', description: 'Open a URL' },
+ { name: 'Click', value: 'click', description: 'Click an element' },
+ { name: 'Type', value: 'type', description: 'Type text keystroke by keystroke' },
+ { name: 'Fill', value: 'fill', description: 'Clear and fill an input field' },
+ { name: 'Screenshot', value: 'screenshot', description: 'Take a screenshot' },
+ { name: 'Snapshot', value: 'snapshot', description: 'Get accessibility tree with @eN refs (AI-optimized)' },
+ { name: 'Get Text', value: 'get_text', description: 'Extract text from an element' },
+ { name: 'Get HTML', value: 'get_html', description: 'Extract innerHTML from an element' },
+ { name: 'Evaluate JS', value: 'eval', description: 'Execute JavaScript in page context' },
+ { name: 'Wait', value: 'wait', description: 'Wait for an element to appear' },
+ { name: 'Scroll', value: 'scroll', description: 'Scroll the page' },
+ { name: 'Select', value: 'select', description: 'Select a dropdown option' },
+ { name: 'Batch', value: 'batch', description: 'Execute multiple commands' },
+ ],
+ description: 'Browser operation to perform',
+ },
+
+ // ===== CONDITIONAL PARAMETERS =====
+ {
+ displayName: 'URL',
+ name: 'url',
+ type: 'string',
+ default: '',
+ required: true,
+ placeholder: 'https://example.com',
+ description: 'URL to navigate to',
+ displayOptions: { show: { operation: ['navigate'] } },
+ },
+ {
+ displayName: 'Selector',
+ name: 'selector',
+ type: 'string',
+ default: '',
+ required: true,
+ placeholder: '@e1 or #login-button or .submit-btn',
+ description: 'CSS selector or @eN ref from snapshot',
+ displayOptions: { show: { operation: ['click', 'type', 'fill', 'get_text', 'get_html', 'wait', 'select'] } },
+ },
+ {
+ displayName: 'Text',
+ name: 'text',
+ type: 'string',
+ default: '',
+ placeholder: 'Text to type',
+ description: 'Text to type into the element',
+ displayOptions: { show: { operation: ['type'] } },
+ },
+ {
+ displayName: 'Value',
+ name: 'value',
+ type: 'string',
+ default: '',
+ placeholder: 'Value to fill or option to select',
+ description: 'Value for fill or select operation',
+ displayOptions: { show: { operation: ['fill', 'select'] } },
+ },
+ {
+ displayName: 'Full Page',
+ name: 'fullPage',
+ type: 'boolean',
+ default: false,
+ description: 'Capture the full scrollable page',
+ displayOptions: { show: { operation: ['screenshot'] } },
+ },
+ {
+ displayName: 'JavaScript Expression',
+ name: 'expression',
+ type: 'string',
+ default: '',
+ required: true,
+ placeholder: 'document.title',
+ typeOptions: { rows: 3 },
+ description: 'JavaScript to execute in page context',
+ displayOptions: { show: { operation: ['eval'] } },
+ },
+ {
+ displayName: 'Direction',
+ name: 'direction',
+ type: 'options',
+ default: 'down',
+ options: [
+ { name: 'Down', value: 'down' },
+ { name: 'Up', value: 'up' },
+ { name: 'Left', value: 'left' },
+ { name: 'Right', value: 'right' },
+ ],
+ description: 'Scroll direction',
+ displayOptions: { show: { operation: ['scroll'] } },
+ },
+ {
+ displayName: 'Amount (px)',
+ name: 'amount',
+ type: 'number',
+ default: 500,
+ typeOptions: { minValue: 100, maxValue: 5000 },
+ description: 'Pixels to scroll',
+ displayOptions: { show: { operation: ['scroll'] } },
+ },
+ {
+ displayName: 'Commands (JSON)',
+ name: 'commands',
+ type: 'string',
+ default: '[]',
+ typeOptions: { rows: 5 },
+ placeholder: '[["open", "https://example.com"], ["snapshot", "-i"]]',
+ description: 'JSON array of commands: [["command", "arg1", "arg2"], ...]',
+ displayOptions: { show: { operation: ['batch'] } },
+ },
+
+ // ===== ADVANCED =====
+ {
+ displayName: 'Session',
+ name: 'session',
+ type: 'string',
+ default: '',
+ placeholder: 'Auto-derived from execution ID',
+ description: 'Browser session name. Leave empty for auto-derived session (shares browser state across chained nodes)',
+ },
+ {
+ displayName: 'Timeout',
+ name: 'timeout',
+ type: 'number',
+ default: 30,
+ typeOptions: { minValue: 5, maxValue: 300 },
+ description: 'Command timeout in seconds',
+ },
+ ],
+ },
+};
+
+export const BROWSER_NODE_TYPES = ['browser'];
diff --git a/client/src/services/executionService.ts b/client/src/services/executionService.ts
index 528a52ef..367fa973 100644
--- a/client/src/services/executionService.ts
+++ b/client/src/services/executionService.ts
@@ -11,6 +11,7 @@ import { APIFY_NODE_TYPES } from '../nodeDefinitions/apifyNodes';
import { SEARCH_NODE_TYPES } from '../nodeDefinitions/searchNodes';
import { TELEGRAM_NODE_TYPES } from '../nodeDefinitions/telegramNodes';
import { CRAWLEE_NODE_TYPES } from '../nodeDefinitions/crawleeNodes';
+import { BROWSER_NODE_TYPES } from '../nodeDefinitions/browserNodes';
import { AI_CHAT_MODEL_TYPES } from '../nodeDefinitions/aiModelNodes';
import { Node, Edge } from 'reactflow';
import { INodeExecutionData } from '../types/INodeProperties';
@@ -230,6 +231,8 @@ export class ExecutionService {
...APIFY_NODE_TYPES,
// Crawlee web scraping
...CRAWLEE_NODE_TYPES,
+ // Browser automation
+ ...BROWSER_NODE_TYPES,
// Search API nodes
...SEARCH_NODE_TYPES,
// Telegram Nodes
diff --git a/package.json b/package.json
index 1849fd53..52d773d5 100644
--- a/package.json
+++ b/package.json
@@ -97,6 +97,7 @@
"cross-env": "^7.0.3",
"rimraf": "^6.0.1",
"temporal-server": "^0.0.9",
+ "agent-browser": "latest",
"edgymeow": "^0.0.18"
},
"pnpm": {
diff --git a/scripts/install.js b/scripts/install.js
index 9d13d322..2e01abb7 100755
--- a/scripts/install.js
+++ b/scripts/install.js
@@ -133,6 +133,22 @@ if (temporalVersion) {
}
}
+// Check/Install agent-browser (global CLI for browser automation)
+let agentBrowserVersion = getVersion('agent-browser --version');
+if (agentBrowserVersion) {
+ console.log(` agent-browser: ${agentBrowserVersion}`);
+} else {
+ console.log(' agent-browser: not found, installing...');
+ run('npm install -g agent-browser');
+ agentBrowserVersion = getVersion('agent-browser --version');
+ if (agentBrowserVersion) {
+ console.log(` agent-browser: ${agentBrowserVersion}`);
+ run('agent-browser install');
+ } else {
+ console.log(' Warning: agent-browser install failed. Browser automation unavailable.');
+ }
+}
+
console.log('');
console.log('Installing...');
console.log('');
diff --git a/server/constants.py b/server/constants.py
index 0071539a..df2c8184 100644
--- a/server/constants.py
+++ b/server/constants.py
@@ -103,6 +103,18 @@ PROXY_TOOL_TYPES: FrozenSet[str] = frozenset([
'proxyStatus',
])
+# =============================================================================
+# BROWSER NODE TYPES
+# =============================================================================
+
+BROWSER_NODE_TYPES: FrozenSet[str] = frozenset([
+ 'browser',
+])
+
+BROWSER_TOOL_TYPES: FrozenSet[str] = frozenset([
+ 'browser',
+])
+
# =============================================================================
# SEARCH NODE TYPES
# =============================================================================
diff --git a/server/services/ai.py b/server/services/ai.py
index a7003ecf..a33631eb 100644
--- a/server/services/ai.py
+++ b/server/services/ai.py
@@ -2495,6 +2495,8 @@ class AIService:
'proxyStatus': 'proxy_status',
# Crawlee web scraping (dual-purpose tool)
'crawleeScraper': 'web_reader',
+ # Browser automation (dual-purpose tool)
+ 'browser': 'browser',
}
DEFAULT_TOOL_DESCRIPTIONS = {
'calculatorTool': 'Perform mathematical calculations. Operations: add, subtract, multiply, divide, power, sqrt, mod, abs',
@@ -2568,6 +2570,8 @@ class AIService:
'proxyStatus': 'Get proxy provider health stats, scores, and usage statistics. Returns enabled status, provider list with health scores, and aggregated stats.',
# Crawlee web scraping (dual-purpose tool)
'crawleeScraper': 'Read and extract content from web pages. Fetches page text, links, and data. Use beautifulsoup for static pages or playwright for JS-rendered pages. You MUST use this tool when the user asks to read, fetch, or get content from any URL.',
+ # Browser automation (dual-purpose tool)
+ 'browser': 'Control a web browser interactively. Use snapshot to see the page (returns accessibility tree with @eN refs). Then click/type/fill with those refs. Workflow: navigate -> snapshot -> interact -> snapshot. Operations: navigate, click, type, fill, screenshot, snapshot, get_text, get_html, eval, wait, scroll, select, batch.',
}
try:
@@ -3539,6 +3543,25 @@ class AIService:
return ApifyActorSchema
# Crawlee web reader tool schema (dual-purpose: workflow node + AI tool)
+ # Browser automation (dual-purpose: workflow node + AI tool)
+ if node_type == 'browser':
+ class BrowserSchema(BaseModel):
+ """Control a web browser. Use snapshot to see the page (returns @eN refs).
+ Then click/type/fill using those refs. Workflow: navigate -> snapshot -> interact."""
+ operation: str = Field(
+ description="Operation: navigate, click, type, fill, screenshot, snapshot, get_text, get_html, eval, wait, scroll, select"
+ )
+ url: Optional[str] = Field(default=None, description="[navigate] URL to open")
+ selector: Optional[str] = Field(default=None, description="[click/type/fill/get_text/get_html/wait/select] CSS selector or @eN ref from snapshot")
+ text: Optional[str] = Field(default=None, description="[type] Text to type")
+ value: Optional[str] = Field(default=None, description="[fill/select] Value to fill or option to select")
+ expression: Optional[str] = Field(default=None, description="[eval] JavaScript to execute")
+ direction: Optional[str] = Field(default="down", description="[scroll] up, down, left, right")
+ amount: Optional[int] = Field(default=500, description="[scroll] Pixels to scroll")
+ fullPage: Optional[bool] = Field(default=False, description="[screenshot] Capture full scrollable page")
+
+ return BrowserSchema
+
if node_type == 'crawleeScraper':
class CrawleeScraperSchema(BaseModel):
"""Read content from any web page URL. Call this tool immediately when the user provides a URL.
diff --git a/server/services/browser_service.py b/server/services/browser_service.py
new file mode 100644
index 00000000..47188db6
--- /dev/null
+++ b/server/services/browser_service.py
@@ -0,0 +1,77 @@
+"""Thin wrapper around agent-browser CLI.
+
+Stateless client β€” finds the binary, runs commands via subprocess, parses JSON output.
+The agent-browser daemon manages its own lifecycle (auto-starts, persists between commands).
+"""
+
+import asyncio
+import json
+import shutil
+from typing import Any, Dict, List, Optional
+
+from core.logging import get_logger
+
+logger = get_logger(__name__)
+
+_MAX_OUTPUT = 100_000
+
+
+class BrowserService:
+ """Subprocess wrapper for the agent-browser CLI."""
+
+ def __init__(self, binary: str) -> None:
+ self._bin = binary
+
+ async def run(
+ self,
+ args: List[str],
+ session: str,
+ timeout: int = 30,
+ stdin: Optional[bytes] = None,
+ ) -> Dict[str, Any]:
+ """Execute an agent-browser command and return parsed JSON output."""
+ cmd = [self._bin, "--session", session, "--json", *args]
+ logger.debug("agent-browser exec", cmd=" ".join(cmd))
+
+ proc = await asyncio.create_subprocess_exec(
+ *cmd,
+ stdin=asyncio.subprocess.PIPE if stdin else None,
+ stdout=asyncio.subprocess.PIPE,
+ stderr=asyncio.subprocess.PIPE,
+ )
+ try:
+ stdout, stderr = await asyncio.wait_for(
+ proc.communicate(input=stdin), timeout=timeout
+ )
+ except asyncio.TimeoutError:
+ proc.kill()
+ await proc.communicate()
+ raise TimeoutError(f"Timed out after {timeout}s")
+
+ if proc.returncode != 0:
+ err = stderr.decode(errors="replace").strip()
+ raise RuntimeError(err or f"Exit code {proc.returncode}")
+
+ raw = stdout.decode(errors="replace").strip()
+ if len(raw) > _MAX_OUTPUT:
+ raw = raw[:_MAX_OUTPUT] + "\n...(truncated)"
+
+ try:
+ return json.loads(raw)
+ except json.JSONDecodeError:
+ return {"output": raw}
+
+
+# -- Module-level lazy singleton (NodeJSClient pattern) --
+
+_instance: Optional[BrowserService] = None
+
+
+def get_browser_service() -> Optional[BrowserService]:
+ """Get the BrowserService singleton, or None if agent-browser is not installed."""
+ global _instance
+ if _instance is None:
+ path = shutil.which("agent-browser")
+ if path:
+ _instance = BrowserService(path)
+ return _instance
diff --git a/server/services/handlers/__init__.py b/server/services/handlers/__init__.py
index 05fff972..e7a98bd7 100644
--- a/server/services/handlers/__init__.py
+++ b/server/services/handlers/__init__.py
@@ -114,6 +114,9 @@ from .search import (
# Crawlee web scraping handler
from .crawlee import handle_crawlee_scraper
+# Browser automation handler (agent-browser CLI)
+from .browser import handle_browser
+
# RLM agent handler
from .rlm import handle_rlm_agent
diff --git a/server/services/handlers/browser.py b/server/services/handlers/browser.py
new file mode 100644
index 00000000..c784de9b
--- /dev/null
+++ b/server/services/handlers/browser.py
@@ -0,0 +1,98 @@
+"""Browser automation handler β€” thin dispatcher to BrowserService.
+
+Maps operation + parameters to CLI arguments, calls service, wraps response.
+"""
+
+import json
+import time
+from typing import Any, Dict
+
+from services.browser_service import get_browser_service
+
+
+async def handle_browser(
+ node_id: str,
+ node_type: str,
+ parameters: Dict[str, Any],
+ context: Dict[str, Any],
+) -> Dict[str, Any]:
+ """Execute a browser automation operation."""
+ t0 = time.time()
+ svc = get_browser_service()
+ if not svc:
+ return _fail("agent-browser not installed. Run: npm install -g agent-browser && agent-browser install", t0)
+
+ op = parameters.get("operation", "navigate")
+ session = (
+ parameters.get("session", "").strip()
+ or f"machina_{context.get('execution_id', 'default')}"
+ )
+ timeout = int(parameters.get("timeout", 30))
+
+ try:
+ if op == "batch":
+ cmds = json.loads(parameters.get("commands", "[]"))
+ data = await svc.run(
+ ["batch", "--json"], session, timeout,
+ stdin=json.dumps(cmds).encode(),
+ )
+ else:
+ args = _build_args(op, parameters)
+ data = await svc.run(args, session, timeout)
+
+ return {
+ "success": True,
+ "result": {"operation": op, "data": data, "session": session},
+ "execution_time": time.time() - t0,
+ }
+ except (ValueError, TimeoutError, RuntimeError) as e:
+ return _fail(str(e), t0)
+
+
+def _build_args(op: str, p: Dict[str, Any]) -> list:
+ """Map an operation name + parameters to agent-browser CLI arguments."""
+ s = p.get("selector", "").strip()
+ match op:
+ case "navigate":
+ return ["open", _req(p, "url")]
+ case "click":
+ return ["click", _req_sel(s)]
+ case "type":
+ return ["type", _req_sel(s), p.get("text", "")]
+ case "fill":
+ return ["fill", _req_sel(s), p.get("value", "")]
+ case "screenshot":
+ return ["screenshot"] + (["--full"] if p.get("fullPage") else [])
+ case "snapshot":
+ return ["snapshot", "-i"]
+ case "get_text":
+ return ["get", "text", _req_sel(s)]
+ case "get_html":
+ return ["get", "html", _req_sel(s)]
+ case "eval":
+ return ["eval", _req(p, "expression")]
+ case "wait":
+ return ["wait", _req_sel(s)]
+ case "scroll":
+ return ["scroll", p.get("direction", "down"), str(p.get("amount", 500))]
+ case "select":
+ return ["select", _req_sel(s), p.get("value", "")]
+ case _:
+ raise ValueError(f"Unknown operation: {op}")
+
+
+def _req(p: Dict[str, Any], key: str) -> str:
+ v = p.get(key, "").strip()
+ if not v:
+ raise ValueError(f"{key} is required")
+ return v
+
+
+def _req_sel(s: str) -> str:
+ if not s:
+ raise ValueError("selector is required")
+ return s
+
+
+def _fail(error: str, t0: float) -> Dict[str, Any]:
+ return {"success": False, "error": error, "execution_time": time.time() - t0}
diff --git a/server/services/handlers/tools.py b/server/services/handlers/tools.py
index 70b20458..abf49371 100644
--- a/server/services/handlers/tools.py
+++ b/server/services/handlers/tools.py
@@ -192,6 +192,10 @@ async def execute_tool(tool_name: str, tool_args: Dict[str, Any],
if node_type == 'apifyActor':
return await _execute_apify_actor(tool_args, config.get('parameters', {}))
+ # Browser automation (dual-purpose: workflow node + AI tool)
+ if node_type == 'browser':
+ return await _execute_browser(tool_args, config.get('parameters', {}), config)
+
# Crawlee web scraper (dual-purpose: workflow node + AI tool)
if node_type == 'crawleeScraper':
return await _execute_crawlee_scraper(tool_args, config.get('parameters', {}))
@@ -1542,6 +1546,33 @@ async def _execute_apify_actor(args: Dict[str, Any],
)
+async def _execute_browser(args: Dict[str, Any],
+ node_params: Dict[str, Any],
+ config: Dict[str, Any]) -> Dict[str, Any]:
+ """Execute browser automation as an AI tool."""
+ from services.handlers.browser import handle_browser
+
+ parameters = {
+ **node_params,
+ 'operation': args.get('operation', node_params.get('operation', 'navigate')),
+ 'url': args.get('url', node_params.get('url', '')),
+ 'selector': args.get('selector', node_params.get('selector', '')),
+ 'text': args.get('text', node_params.get('text', '')),
+ 'value': args.get('value', node_params.get('value', '')),
+ 'expression': args.get('expression', node_params.get('expression', '')),
+ 'direction': args.get('direction', node_params.get('direction', 'down')),
+ 'amount': args.get('amount', node_params.get('amount', 500)),
+ 'fullPage': args.get('fullPage', node_params.get('fullPage', False)),
+ }
+
+ return await handle_browser(
+ node_id=config.get('node_id', 'tool_browser'),
+ node_type='browser',
+ parameters=parameters,
+ context={'execution_id': config.get('execution_id', 'default')},
+ )
+
+
async def _execute_crawlee_scraper(args: Dict[str, Any],
node_params: Dict[str, Any]) -> Dict[str, Any]:
"""Execute Crawlee web scraper as an AI tool.
diff --git a/server/services/node_executor.py b/server/services/node_executor.py
index f6993b40..524af87f 100644
--- a/server/services/node_executor.py
+++ b/server/services/node_executor.py
@@ -45,6 +45,7 @@ from services.handlers.deep_agent import handle_deep_agent
from services.handlers.telegram import handle_telegram_send
from services.handlers.apify import handle_apify_actor
from services.handlers.crawlee import handle_crawlee_scraper
+from services.handlers.browser import handle_browser
from services.handlers.proxy import handle_proxy_request, handle_proxy_status, handle_proxy_config
from services.handlers.filesystem import handle_file_read, handle_file_modify, handle_shell, handle_fs_search
# Consolidated Google Workspace handlers (6 services with operation dispatchers)
@@ -195,6 +196,8 @@ class NodeExecutor:
'apifyActor': handle_apify_actor,
# Crawlee web scraping
'crawleeScraper': handle_crawlee_scraper,
+ # Browser automation (agent-browser CLI)
+ 'browser': handle_browser,
# Proxy nodes
'proxyRequest': handle_proxy_request,
'proxyStatus': handle_proxy_status,