A bookmarklet that summarizes any webpage using the Web Agent API
Drag this button to your bookmarks bar
Drag the "Summarize Page" button above to your browser's bookmarks toolbar
Navigate to an article, documentation, or any page you want summarized
Click "Summarize Page" in your bookmarks — a summary overlay will appear
The Web Agent API supports two coding styles. The Chrome-compatible way auto-handles permissions:
// Chrome-compatible style (auto-permissions) const session = await window.ai.createTextSession(); const summary = await session.prompt(document.body.innerText); // Or using the Chrome Prompt API style: const session = await window.ai.languageModel.create({ systemPrompt: 'Summarize clearly and concisely.' }); const summary = await session.prompt(text);
Or the explicit Web Agent API style with fine-grained control:
// Explicit Web Agent API style (full control) await window.agent.requestPermissions({ scopes: ['model:prompt', 'browser:activeTab.read'], reason: 'Summarize the current page' }); // Read page content via extension API const tab = await window.agent.browser.activeTab.readability(); // Create AI session with custom options const session = await window.ai.createTextSession({ systemPrompt: 'Summarize clearly and concisely.', temperature: 0.7 }); const summary = await session.prompt(tab.text);
Tip: The Chrome-compatible style is simpler — permissions are auto-requested when needed. Use the explicit style when you need more control over permissions, want to specify a custom reason, or need access to browser APIs like activeTab.read.
This pattern works for any AI-powered browser tool. Fork this example to build: