Skip to main content
Back

Alibaba's page-agent Puts AI Copilots Inside Web Pages With 18K Stars

Alibaba's page-agent embeds a natural-language GUI agent directly into any webpage as plain JavaScript, no headless browser or backend required.

Repo, Full Access
  • Inside-out architecture: page-agent lives inside the webpage as plain JavaScript, reading the DOM as text and dispatching native browser events -- no headless browser or screenshots needed.
  • Any LLM, including local: supports OpenAI, Claude, Qwen, Gemini, DeepSeek, and fully offline models via Ollama or vLLM, using text-only inference (no vision model required).
  • One-line integration: drop in a CDN script tag for evaluation, or npm install page-agent for production; MIT licensed and free.
  • MCP server (beta): external orchestrators like Claude Desktop or LangChain agents can control the browser via the Model Context Protocol, bridging server-side and client-side automation.
  • Human-in-the-loop by default: built-in UI panel shows planned actions and asks for confirmation before executing, with developer-defined action allowlists for safety.
  • Key limitation: runs only while a user is present in the browser; background/scheduled automation and multi-tab workflows require the optional Chrome extension.

page-agent is Alibaba's open-source answer to a question the browser automation world has been dancing around for years: what if the AI agent lived inside the page, not outside it? The library, written in TypeScript, has crossed 18,700 GitHub stars and is quietly changing how people think about shipping AI copilots in web products.

Outside-in vs. inside-out

Every major browser automation tool works the same way: run something outside the browser that controls the browser. Playwright, Puppeteer, Selenium, browser-use all sit on the outside looking in, taking screenshots or parsing accessibility trees through Chrome DevTools Protocol. page-agent flips that model. The agent lives inside the webpage as plain JavaScript, reads the DOM directly as text, understands natural language commands, and manipulates the page from within.

The outside-in approach has a fatal flaw when the goal is to augment a human user inside a real application they're actively using. You can't ship a Python Playwright agent to a business user navigating your SaaS product. You can't ask them to install a Chrome extension just to get AI help filling a form. And you certainly can't afford the latency of a server-side round-trip for every interaction in a live UI.

How it actually works

The library follows an "inside-out" paradigm where the agent resides within the webpage itself. It works by parsing and "dehydrating" the live HTML into semantic text, which it feeds to a large language model. The LLM reasons about the necessary actions, and the agent dispatches native browser events like clicks and typing to execute them.

The LLM performs step-by-step reasoning: it identifies the most relevant CSS selectors, determines the required interaction type (click, input, scroll, or navigation), and outputs a structured plan. page-agent then executes these actions natively in the browser using standard DOM APIs and event dispatching. Because everything runs client-side, no server round-trips occur beyond the initial LLM inference call.