Playground/on-device-browser-agent/README.md
A Chrome extension that uses WebLLM to run AI-powered web automation entirely on-device. No cloud APIs, no API keys, fully private.
https://github.com/user-attachments/assets/898cc5c2-db77-4067-96e6-233c5da2bae5
Clone and install dependencies:
cd local-browser
npm install
Build the extension:
npm run build
Load in Chrome:
chrome://extensionsdist folder from this projectFirst run:
npm run dev
This watches for changes and rebuilds automatically.
local-browser/
├── manifest.json # Chrome extension manifest (MV3)
├── src/
│ ├── background/ # Service worker
│ │ ├── index.ts # Entry point & message handling
│ │ ├── llm-engine.ts # WebLLM wrapper
│ │ └── agents/ # AI agent system
│ │ ├── base-agent.ts
│ │ ├── planner-agent.ts
│ │ ├── navigator-agent.ts
│ │ └── executor.ts
│ ├── content/ # Content scripts
│ │ ├── dom-observer.ts # Page state extraction
│ │ └── action-executor.ts
│ ├── popup/ # React popup UI
│ │ ├── App.tsx
│ │ └── components/
│ └── shared/ # Shared types & constants
└── dist/ # Build output
The extension uses a two-agent architecture inspired by Nanobrowser:
Both agents output structured JSON that is parsed and executed.
Default model: Qwen2.5-1.5B-Instruct-q4f16_1-MLC (~1GB)
Alternative models (configured in src/shared/constants.ts):
Phi-3.5-mini-instruct-q4f16_1-MLC (~2GB, better reasoning)Llama-3.2-1B-Instruct-q4f16_1-MLC (~0.7GB, smaller)chrome://gpu to verify WebGPU statuschrome://extensionsThis project is inspired by:
| Package | License |
|---|---|
| @mlc-ai/web-llm | Apache-2.0 |
| React | MIT |
| Vite | MIT |
| @crxjs/vite-plugin | MIT |
| TypeScript | Apache-2.0 |
MIT License - See LICENSE file for details.