AI Browser 24-Hour Stable Operation Guide

3/11/2026
2 min read

AI Browser 24-Hour Stable Operation Guide

This tutorial introduces how to set up a stable, long-term running AI browser environment.

Applicable to

  • AI Agent
  • Automated browsing
  • Web automation
  • AI assistant
  • Automated testing system

Goals

  • Browser running 24 hours
  • Automatic reconnect

1. Start Chrome in Debugging Mode

Mac / Linux

google-chrome \ --remote-debugging-port=9222 \ --user-data-dir=/tmp/ai-browser \ --disable-infobars \ --disable-background-timer-throttling \ --disable-renderer-backgrounding \ --disable-backgrounding-occluded-windows \ --no-first-run \ --no-default-browser-check

Windows

chrome.exe ^ --remote-debugging-port=9222 ^ --user-data-dir=C:\ai-browser ^ --disable-infobars ^ --disable-background-timer-throttling ^ --disable-renderer-backgrounding ^ --disable-backgrounding-occluded-windows ^ --no-first-run ^ --no-default-browser-check

2. Why These Parameters Are Important

These parameters can prevent:

  • tab sleep
  • JS timer stop
  • automation disconnection

3. Test Browser Debugging Interface

Open:

http://localhost:9222 If you see:

DevTools listening on ws://... it means the browser is functioning normally.

4. Configure agent-browser for Automatic Connection

Create configuration file:

Linux / Mac

~/.agent-browser/config.json

Windows

%USERPROFILE%\.agent-browser\config.json Content:

{ "autoConnect": true, "host": "127.0.0.1", "port": 9222 }

5. Test AI Control

Run:

agent-browser snapshot If it returns the DOM tree: it means the connection is successful.

6. Stable Navigation Method

Recommended:

agent-browser eval "window.location.href=https://example.com" Not recommended:

agent-browser open Reason:

  • open may create a new tab
  • eval is more stable

7. Prevent Browser Disconnection

Chrome may disconnect for the following reasons:

  • Chrome crash
  • DevTools session being reclaimed
  • System resource limitations
Solution: Create a Watchdog automatic restart script.

8. Watchdog Script

Create file: watch-browser.sh

#!/bin/bash

while true do if ! curl -s http://localhost:9222 > /dev/null then echo "Chrome not running, restarting..." pkill chrome google-chrome \ --remote-debugging-port=9222 \ --user-data-dir=/tmp/ai-browser \ --disable-infobars \ --no-first-run \ --no-default-browser-check & fi sleep 10 done Run:

bash watch-browser.sh Effect:

  • Chrome crash automatically restarts
  • Debugging port automatically recovers

9. Save Login Status

Because of using: --user-data-dir

The browser will save:

  • cookies
  • login status
  • local storage
  • session
So AI does not need to log in every time.

10. AI Multi-Tab Control

Get current tabs:

agent-browser list

Published in Technology

You Might Also Like