Skip to main content

Overview

The CLI daemon provides a persistent browser session over a Unix socket. Use the -c flag to execute Python code directly from Bash — no MCP server, no LLM, just code and a browser. The daemon starts automatically on first use, persists variables across calls, and shuts down after 10 minutes of inactivity.

Quick Start

Variable Persistence

Variables set in one -c call are available in the next, as long as the daemon is running:
This enables incremental exploration — navigate in one call, extract in the next, process in the third.

Daemon Management

The daemon runs in the background and communicates via a Unix socket at ~/.openbrowser/daemon.sock. Logs are written to ~/.openbrowser/daemon.log.
Windows: On Windows, the daemon uses a localhost TCP connection on port 19222 instead of a Unix socket. This means any process on the same machine can connect. The Unix socket on macOS/Linux is restricted to the file owner (mode 0600).

Available Functions

All functions from the MCP execute_code tool are available in -c mode: Pre-imported libraries: json, csv, re, datetime, asyncio, Path, requests Optional (imported on first use): numpy/np, pandas/pd, matplotlib/plt, BeautifulSoup, PdfReader, tabulate

Multi-Action Batching

Batch multiple actions in a single call for efficiency:

Architecture

  • The CLI is a thin client (~30ms startup) that sends code over the Unix socket
  • The daemon holds the browser session, CodeExecutor, and persistent namespace in memory
  • The browser connects via Chrome DevTools Protocol (CDP)

Configuration

Comparison with MCP Server

Both use the same CodeExecutor engine and browser automation functions.

Troubleshooting

Daemon won’t start
  • Check ~/.openbrowser/daemon.log for errors
  • Verify Chrome/Chromium is installed
  • Remove stale files: rm ~/.openbrowser/daemon.sock ~/.openbrowser/daemon.pid
“Daemon not running” on status
  • The daemon shuts down after 10 minutes of inactivity
  • Run any -c command to auto-start it
Socket permission errors
  • The socket is created with 0600 permissions (owner-only)
  • Check that ~/.openbrowser/ is owned by your user
Variables lost between calls
  • The daemon may have restarted (idle timeout or crash)
  • Use openbrowser-ai daemon status to check if the daemon is running