Install
Browser automation lives in the standalone Tier-2 packagepraisonai-browser.
pip install "praisonai[all]" (or praisonai[browser]) installs praisonai-browser for you, and every praisonai browser … command keeps working unchanged.Quick Start
1
Start the bridge server
2
Load the Chrome extension
Open
chrome://extensions, enable Developer mode, and load unpacked from praisonai-chrome-extension/dist.3
Run a goal
Press
Ctrl+Shift+P in the side panel, or run from CLI:Architecture
Flow: Chrome Extension ↔ WebSocket ↔ Bridge Server ↔ PraisonAI Agent The system consists of:- Chrome Extension: Captures page state and executes actions via CDP
- Bridge Server: FastAPI WebSocket server that routes messages to agents
- BrowserAgent: PraisonAI agent that decides actions based on observations
- SessionManager: SQLite-based persistence for session history
- Hybrid Mode: Falls back to on-device Gemini Nano if server unavailable
Session Flow
Session States
Smart Features
Click Fallbacks
When clicks fail, the agent automatically tries:- Viewport click using
getBoundingClientRect()+scrollIntoView() - JavaScript click via
element.click() - Focus + Enter for buttons
Goal Context & Self-Correction
Every observation sent to the LLM includes:- Original goal: Always visible to prevent drift
- Action history: Last 5 actions with success/failure status
- Progress notes: Summary of steps completed
Failure Communication
When actions fail, the LLM receives explicit feedback:CLI Commands
Run Browser Agent
Execute a goal directly from CLI with live progress display:--url, -u: Start URL (default: https://www.google.com)--model, -m: LLM model (default: gpt-4o-mini)--timeout, -t: Timeout in seconds (default: 120)--debug, -d: Debug mode - show all events
Scripting run
run returns a stable exit code, so CI and cron jobs can branch on the failure type:
If the bridge server is not running
Your browser agent won’t start and you see a friendly bridge-unreachable message. The fix is one command in a second terminal, not a code change.run connects to the local bridge server, not the site in --url. When that server is down it prints:
This message replaces the raw
WinError 1225 (Windows), errno 111 (Linux), and errno 61 (macOS) connection-refused errors. The failing layer is the local bridge on port 8765, not the target --url.1
Terminal A — start the bridge
2
Terminal B — run the agent again
Launch Browser with Goal
Launch Chrome with the extension and optionally run a goal:--url, -u: Start URL (default: https://www.google.com)--model, -m: LLM model (default: gpt-4o-mini)--max-steps: Maximum steps (default: 20)--engine: Automation engine: extension, cdp, auto (default: auto)--debug, -d: Debug mode with detailed logging--record-video: Record video of browser session--profile: Enable performance profiling--deep-profile: Enable deep profiling with cProfile
Performance Profiling
Track execution time per step to identify bottlenecks:Tab Management
Navigate
Execute JavaScript
Page Inspection (New)
Inspect browser pages without the extension:These commands work via CDP (Chrome DevTools Protocol) and require Chrome
running with
--remote-debugging-port=9222.Automation Engines
Choose different execution engines with--engine:
Screenshot
Start Server
--port, -p: Port to listen on (default: 8765)--host, -H: Host to bind to (default: 0.0.0.0)--model, -m: LLM model (default: gpt-4o-mini)--max-steps: Maximum steps per session (default: 20)--verbose, -v: Enable verbose logging
”Already running” behaviour
Starting the server on a port that is already in use exits cleanly instead of failing. Before binding, the CLI probes the port with_port_in_use(host, port). If a server is already there, it prints a friendly message and exits with code 0:
OSError — WinError 10048 on Windows or errno.EADDRINUSE on Linux/macOS — prints the same message, and still exits 0. Any other OSError prints Error: <message> and exits 1.
Because a duplicate start is exit code 0, you can add
praisonai browser start to a script or Makefile without guarding against a second launch — the first server keeps running and the second call is a clean no-op.Windows notes
Startup banners are ASCII (no emoji) and the console script forces stdout/stderr to UTF-8, so cp1252 Windows consoles runpraisonai browser start without a UnicodeEncodeError. This works out of the box — no code page changes required. See PraisonAI issue #3094 for background.
Binding to IPv6
Pass an IPv6 literal to--host and it works:
getaddrinfo, so IPv6 hosts like ::1 are probed on the correct family instead of being silently missed.
List Sessions
--status, -s: Filter by status (running, completed, failed)--limit, -l: Maximum sessions to show
View History
Clear Sessions
Reload Extension
Reload the Chrome extension after making changes:Health Diagnostics
Your agent is trying to drive the browser, but nothing happens. One command tells you which layer broke:doctor extension reads the bridge /health extension_connections count — a success there means the extension is loaded and reachable, even when running in your daily Chrome instead of the automated debug profile. See Manual extension load for the recovery recipe when it fails.The bridge check is ground truth:
extension_connections >= 1 means the extension is working. The CDP line is optional — it’s empty when you use your daily Chrome (no --remote-debugging-port), which is expected, not a failure.Python API
Import the public classes frompraisonai_browser.
The old path still works:
from praisonai.browser import BrowserServer, BrowserAgent maps to praisonai_browser through a compatibility shim.Run Return Shape
Whenrun cannot reach the bridge, it returns a structured result so scripts can detect the failure without parsing text:
Session Management
Hybrid Mode (Extension)
The Chrome Extension supports hybrid mode:- Bridge Mode: Connect to PraisonAI server for cloud LLMs
- Built-in Mode: Use Chrome’s Gemini Nano on-device
Keyboard Shortcuts
Supported Actions
Error Detection & Recovery (v1.3+)
The agent automatically detects and recovers from errors:Detected Errors
- Garbled/duplicated text in input fields
- Wrong page navigation (user or browser interference)
- Failed actions (click not working, submit didn’t fire)
- Blocking elements (popups, consent dialogs, login walls)
Recovery Actions
When errors are detected, the agent will:- Set
error_detected: truewith description - Report
input_field_valueshowing actual text visible - Use
clear_inputto fix garbled input - Use
navigateto return to correct URL if off-track
Step Timestamps
Debug mode now shows elapsed time for each step:Performance Optimized
Action delays have been optimized for faster execution:- Click: 200ms (was 500ms)
- Submit: 300ms (was 500ms)
- Search: 400ms (was 1000ms)
WebSocket Protocol
Connect tows://localhost:8765/ws and send/receive JSON messages:
Environment Variables
Best Practices
Run doctor before first session
Run doctor before first session
praisonai browser doctor checks server, Chrome debugging, extension, and session DB in one pass.Prefer CDP for headless CI
Prefer CDP for headless CI
Use
--engine cdp or playwright when the Chrome extension is not available in your pipeline.Set step limits for open-ended goals
Set step limits for open-ended goals
Pass
--max-steps so runaway loops stop instead of burning tokens.Enable hybrid fallback in the extension
Enable hybrid fallback in the extension
Built-in Gemini Nano keeps the side panel working when the bridge server is offline.
Related
praisonai-browser Package
The standalone Tier-2 package: install, CLI, imports, and backward compatibility.
Web Tools
Built-in web search and fetch tools for agents without browser control.
CLI
Full
praisonai browser command reference and flags.Code Execution
Run scripts alongside browser automation in agent workflows.
Observability Hooks
Trace browser agent steps and LLM calls in production.

