Skip to main content

Browser Extension Architecture

The PraisonAI browser automation uses a 3-layer architecture for AI-powered browser control.
The bridge server and extension support ship in the standalone praisonai-browser package. Install them with pip install "praisonai-browser[server]" (or pip install "praisonai[all]"). The praisonai browser … commands keep working unchanged.

Communication Flow

  1. CLI sends start_session with goal
  2. Bridge Server routes to Extension
  3. Extension captures page state (screenshot, elements)
  4. Extension sends observation to Bridge
  5. Bridge processes with BrowserAgent (LLM decision)
  6. Bridge returns action to Extension
  7. Extension executes action via CDP
  8. Loop continues until goal complete

Architecture Diagram

Running the Browser Agent

Message Types

Troubleshooting

Extension Not Connecting

If you see “Extension did not connect after 15s”:
  1. Check extension console:
    • Go to chrome://extensions/
    • Find “PraisonAI Browser Agent”
    • Click “service worker” link
    • Look for errors
  2. Kill stale Chrome processes:
  3. Rebuild extension:
  4. Check bridge server:
    Expected output:
    connections counts all WebSocket clients (extension, CLI, curl’d probes). Check extension_connections >= 1 instead — it counts only clients whose Origin starts with chrome-extension://, so a stray CLI probe won’t make it look connected. connections >= 1 alone is no longer sufficient.
    Servers older than PraisonAI #3115 don’t return extension_connections. The CLI helpers (doctor extension, the launch poller) fall back to connections in that case.

No Observations Sent

If session starts but times out:
  • Check extension console for [PraisonAI] onStartAutomation FATAL ERROR
  • CDP debugger may fail to attach
  • Page may be a chrome:// URL (unsupported)

Debug Mode

This enables verbose logging and saves screenshots to ~/.praisonai/browser_screenshots/.

Performance Profiling

Track timing breakdown for each automation step:

Sample Output

Timing Breakdown