Currently, every agent node in the Cortex Mesh can optionally support a "browser skill" via Playwright. While flexible, this introduces several issues:
By moving browser automation to a dedicated service located alongside the AI Hub, we achieve near-zero latency for DOM extraction and more robust state management.
The new architecture introduces a standalone Browser Service container.
graph TD
User["USER / UI"] <--> Hub["AI Hub (ai-hub)"]
subgraph "Internal Processing"
Hub --> SA["Sub-Agent (Browser Expert)"]
SA -- "gRPC / REST" --> BSC["Browser Service Client"]
end
BSC <--> BS["Dedicated Browser Service (Container)"]
subgraph "Browser Service"
BS <--> PW["Playwright / Chromium"]
end
Hub <--> Mesh["Agent Mesh (Edge Nodes)"]
Mesh -- "Local Tasks" --> Shell["Shell / File System"]
ToolService in the Hub will no longer dispatch browser tasks to the TaskAssistant (which routes to random nodes). Instead, it will talk directly to the BrowserService client.BrowserService will manage browser contexts, allowing the Hub to reference a session_id to continue navigation on the same page.agent-node code related to the browser (bridges, dependencies, and proto fields) will be removed.agent.proto:
BrowserAction, BrowserResponse, and BrowserEvent messages.browser_action from TaskRequest.browser_result and browser_event from ServerTaskMessage.browser_service.proto) defining actions like Navigate, Click, Extract, EvaluateJS.agent-node/src/agent_node/skills/browser_bridge.py.browser registration in agent-node/src/agent_node/skills/manager.py.agent-node/src/agent_node/node.py.browser_action routing in _process_server_message.ai-hub/app/core/services/tool.py, update browser_automation_agent to use a BrowserServiceClient instead of assistant.dispatch_browser.dispatch_browser and all browser-related result handling from ai-hub/app/core/grpc/services/assistant.py.browser_event and result correlation logic from ai-hub/app/core/grpc/services/grpc_server.py.docker-compose.To achieve "performance first" and "0 latency," we must choose the communication stack carefully.
| Feature | gRPC (HTTP/2) | REST (HTTP/1.1) | gRPC + Unix Sockets | Shared Memory (/dev/shm) |
|---|---|---|---|---|
| Serialization | Protobuf (Binary) | JSON (Text) | Protobuf (Binary) | Zero-copy / Reference |
| Network Overhead | Low (TCP) | High (TCP) | Near Zero (IPC) | Zero |
| Speed (Small Result) | High | Medium | Ultra High | N/A |
| Speed (Large DOM/A11Y) | Medium | Low | High | Instant |
For a local container-to-container deployment, gRPC over Unix Domain Sockets (UDS) is the optimal choice for command/control. However, for large data (DOM snapshots, Screenshots), we will implement a Sidecar Handoff via Shared Memory.
tmpfs (e.g., /dev/shm/cortex_browser/).docker-compose.production.yml to shared a high-speed RAM volume (/dev/shm) between the ai-hub and the new browser-service./tmp/browser.sock).(Same as previously defined - removing all browser skill code from nodes to lighten their footprint).
BrowserServiceClient to handle the UDS connection and the RAM-disk data retrieval for large snapshots.Status: DRAFT
Author: Cortex Architect
Ref: Session Refactor Request (Turn 818)