How Browserstation's Sidecar Architecture works
mainBrowserstation uses a Sidecar Pattern managed by RayKube on a Kubernetes cluster. This architecture ensures isolation and efficient resource management for browser agents.
The Sidecar Pattern
Each worker pod contains two distinct containers:
- Ray Worker (Main Container): Hosts the
BrowserActor. It manages the browser lifecycle, handles API requests, allocates resources, and communicates with Chrome vialocalhost:9222. - Chrome (Sidecar Container): Runs a headless Chrome instance with remote debugging enabled. It exposes the Chrome DevTools Protocol (CDP) on port 9222.
Each pod provides a single, isolated browser instance.
Unified CDP WebSocket Proxy
To allow clients to control browsers across the cluster, Browserstation uses a proxy on the head node.
- Clients connect to
/ws/browsers/{id}/devtools/browseron the head node. - The FastAPI-based proxy validates the browser ID.
- The proxy then establishes a bidirectional WebSocket stream to the specific Chrome container in the corresponding worker pod.
This allows automation tools to interact with the browser via CDP as if they were connected directly to the instance.