On-device AI agent Chrome extension powered by Transformers.js and Gemma 4
TypeScript
1,164
34 commits
updated Aug 13, 2026
An on-device AI assistant that runs entirely in your browser using WebGPU and Transformers.js. This Chrome extension provides an intelligent agent that can understand natural language commands and interact with your browser through a set of specialized tools.
All processing happens locally on your device. No data is sent to external servers, ensuring complete privacy.
The AI agent has access to several tools that enable it to help you control and navigate your browser:
The agent can manage your browser tabs through natural language:
The extension uses Retrieval-Augmented Generation to understand and interact with webpage content:
The extension maintains a semantic search-enabled history database:
git clone <repository-url>
cd tfjs-agentgemma-extension
pnpm install
pnpm run build
chrome://extensions/dist folderFor active development with automatic rebuilding:
pnpm run dev
The extension requires these permissions:
sidePanel: Display chat interfaceactiveTab: Access current tab contentstorage: Save settings and model cachescripting: Inject content scriptstabs: Needed to read the tab URLhost_permissions: Access webpage content on all URLsThis extension uses the onnx-community/gemma-4-E2B-it-ONNX instruction-tuned model from Hugging Face:
This extension demonstrates an effective architecture for integrating Transformers.js into browser extensions. The design separates concerns across three key components, each optimized for specific tasks.
The background service worker hosts Transformers.js models as the centralized AI engine.
Why this works:
What it does: Loads models, processes inference, executes tools, handles feature extraction.
The side panel provides a persistent chat interface for interacting with the agent.
Why this works:
chrome.runtime.sendMessage and chrome.runtime.onMessage.addListener, allowing non-blocking interaction with the AI engine.What it does:
Content scripts run in the context of web pages, enabling direct DOM access.
Why this works:
What it does:
User Input (Side Panel)
↓
chrome.runtime.sendMessage
↓
Background Script (AI Agent)
↓
Processes with Transformers.js
↓
Executes tools (e.g., ask_website)
↓
chrome.tabs.sendMessage
↓
Content Script (if needed)
↓
Extracts/highlights page content
↓
Returns to Background
↓
chrome.runtime.sendMessage
↓
Side Panel (displays response)
This architecture is particularly well-suited for browser-based ML:
456 followers · starred Apr 2026
97 followers · starred Jul 2026
14,792 followers · starred Apr 2026
162 followers · starred Apr 2026
On-device AI agent Chrome extension powered by Transformers.js and Gemma 4
TypeScript
1,164
34 commits
updated Aug 13, 2026
An on-device AI assistant that runs entirely in your browser using WebGPU and Transformers.js. This Chrome extension provides an intelligent agent that can understand natural language commands and interact with your browser through a set of specialized tools.
All processing happens locally on your device. No data is sent to external servers, ensuring complete privacy.
The AI agent has access to several tools that enable it to help you control and navigate your browser:
The agent can manage your browser tabs through natural language:
The extension uses Retrieval-Augmented Generation to understand and interact with webpage content:
The extension maintains a semantic search-enabled history database:
git clone <repository-url>
cd tfjs-agentgemma-extension
pnpm install
pnpm run build
chrome://extensions/dist folderFor active development with automatic rebuilding:
pnpm run dev
The extension requires these permissions:
sidePanel: Display chat interfaceactiveTab: Access current tab contentstorage: Save settings and model cachescripting: Inject content scriptstabs: Needed to read the tab URLhost_permissions: Access webpage content on all URLsThis extension uses the onnx-community/gemma-4-E2B-it-ONNX instruction-tuned model from Hugging Face:
This extension demonstrates an effective architecture for integrating Transformers.js into browser extensions. The design separates concerns across three key components, each optimized for specific tasks.
The background service worker hosts Transformers.js models as the centralized AI engine.
Why this works:
What it does: Loads models, processes inference, executes tools, handles feature extraction.
The side panel provides a persistent chat interface for interacting with the agent.
Why this works:
chrome.runtime.sendMessage and chrome.runtime.onMessage.addListener, allowing non-blocking interaction with the AI engine.What it does:
Content scripts run in the context of web pages, enabling direct DOM access.
Why this works:
What it does:
User Input (Side Panel)
↓
chrome.runtime.sendMessage
↓
Background Script (AI Agent)
↓
Processes with Transformers.js
↓
Executes tools (e.g., ask_website)
↓
chrome.tabs.sendMessage
↓
Content Script (if needed)
↓
Extracts/highlights page content
↓
Returns to Background
↓
chrome.runtime.sendMessage
↓
Side Panel (displays response)
This architecture is particularly well-suited for browser-based ML:
456 followers · starred Apr 2026
97 followers · starred Jul 2026
14,792 followers · starred Apr 2026
162 followers · starred Apr 2026