A practical guide to integrating Transformers.js into a Chrome extension under Manifest V3 constraints. Covers the three-runtime architecture (background service worker, side panel, content script), how to host AI models (Gemma 4 E2B for text generation, MiniLM for embeddings) in the background worker to avoid duplicate loads, the typed messaging contract between runtimes, an agentic tool-calling loop with tool normalization and output parsing, state persistence strategies (memory, chrome.storage, IndexedDB), and Vite build configuration for multi-entry MV3 outputs.
Table of contents
Who this is forWhat we will build1) Chrome extension architecture (MV3)2) Transformers.js integration details3) Agent and tool execution loop4) Data boundaries and persistence5) Build and packaging notesFinal takeawaySort: