Browser Extension Architecture
The PraisonAI browser automation uses a 3-layer architecture for AI-powered browser control.Communication Flow
- CLI sends
start_sessionwith goal - Bridge Server routes to Extension
- Extension captures page state (screenshot, elements)
- Extension sends
observationto Bridge - Bridge processes with BrowserAgent (LLM decision)
- Bridge returns
actionto Extension - Extension executes action via CDP
- Loop continues until goal complete
Architecture Diagram
Running the Browser Agent
Message Types
| Type | Direction | Description |
|---|---|---|
start_session | CLI → Server | Start new automation |
observation | Ext → Server | Page state snapshot |
action | Server → Ext | Next action to execute |
status | Server → Both | Session status updates |
stop_session | Any → Server | End session |
Troubleshooting
Extension Not Connecting
If you see “Extension did not connect after 15s”:-
Check extension console:
- Go to
chrome://extensions/ - Find “PraisonAI Browser Agent”
- Click “service worker” link
- Look for errors
- Go to
-
Kill stale Chrome processes:
-
Rebuild extension:
-
Check bridge server:
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
~/.praisonai/browser_screenshots/.
Performance Profiling
Track timing breakdown for each automation step:Sample Output
Timing Breakdown
| Metric | Description |
|---|---|
| LLM | Time spent waiting for LLM decision |
| Screen | Screenshot capture time |
| Action | CDP action execution time |
| Verify | Action verification time |
| Stable | Page stability wait time |

