Skip to main content

Architecture

Karate Agent uses a dashboard + worker architecture: a lightweight dashboard server manages browser sessions running in Docker containers.

Components

Karate Agent Architecture

Dashboard Server

The dashboard server is a single Java process (java -jar karate-agent.jar dashboard). It provides:

  • REST API — Session management, job submission, file operations
  • Dashboard — Web UI for managing sessions, viewing live browsers, reviewing reports
  • Reverse Proxy — Routes HTTP and WebSocket traffic to the correct worker container
  • Docker Management — Creates, monitors, and destroys worker containers via Docker socket

Workers (karate-agent)

Each worker is a self-contained Docker container running:

  • JVM with the Karate Agent server (port 5757)
  • Chrome browser
  • Xvfb display server
  • noVNC for live browser viewing (port 6080)

Workers are "fat" — each contains everything needed to run browser automation independently.

Session Lifecycle

  1. Create — Dashboard starts a new Docker container with a fresh Chrome instance
  2. Connect — Client connects via REST API or MCP. In Live mode, the client sends JS. In autonomous mode, the worker drives the LLM loop.
  3. Execute — JS commands run inside the worker. Results return as structured JSON.
  4. Complete — Session ends. Container produces: transcript, report, screenshots, optional video recording.
  5. Cleanup — Container auto-destroys after idle timeout. Session data persists in karate-agent/.

Design Decisions

DecisionChoiceRationale
Dashboard as separate processNot embedded in karate-agentKeeps workers unchanged. ~200MB vs ~1.2GB.
Docker socket mount/var/run/docker.sockBattle-tested pattern. Workers are sibling containers.
Dynamic port mappingdocker -P + inspectWorks on macOS (Docker Desktop) and Linux.
Fat workersJVM + Chrome per containerEach worker is self-contained. Dashboard stays simple.
File-backed persistenceSession data in karate-agent/Survives restarts. No database dependency.
VNC proxied through dashboardnoVNC via /sessions/{id}/vncUsers need only one port open (:4444).

Deployment Topologies

TopologySetupFor
Solo developerDashboard on your laptopTesting against localhost apps
Team serverDashboard on Mac Mini / EC2Shared testing with team dashboard
CI-integratedDashboard on dedicated infrastructurePipeline-submitted jobs

The same flows, dashboard, and API work at every scale.