Alibaba's page-agent Brings Browser AI Agents Into the Page Itself
Alibaba open-sourced page-agent, a TypeScript library that drops an LLM-driven agent directly into your webpage without extensions, Python, or headless browsers.
ProTakeaways
- Alibaba open-sourced page-agent, a JavaScript in-page GUI agent controlled via natural language.
- No browser extension, Python, or headless browser required. It runs entirely in your webpage.
- Uses text-based DOM manipulation instead of screenshots, so any text-only LLM works.
- Ships as an npm package or one-line CDN script with an OpenAI-compatible config.
- Optional Chrome extension enables multi-page tasks, plus a beta MCP server for external control.
- MIT licensed, built on top of browser-use, scoped to client-side enhancement rather than scraping.
Alibaba just dropped an interesting take on browser agents. Instead of spinning up a headless Chrome instance or shipping a browser extension, page-agent is a plain JavaScript library that lives inside the webpage itself and drives the UI with natural language. The repo is MIT licensed, written in TypeScript, and has already crossed 9k stars since going public.
The pitch is simple: you add a script tag or npm install, hand it an LLM endpoint, and call agent.execute('Click the login button'). No Puppeteer, no Playwright, no CDP session. Just JS running in the same page as your app.
How it actually works
Most GUI agents today take a screenshot, feed it into a multi-modal model, and get back click coordinates. Page-agent skips that entirely. It performs text-based DOM manipulation with no screenshots and no multi-modal LLMs or special permissions needed. That means it works with any text-only chat model you already have an API key for, and it dodges the pixel-accuracy problems that plague vision-based agents on dense UIs.
The DOM extraction and prompting patterns are not entirely novel. The project builds on browser-use, with DOM processing components and prompts derived from that library. The twist is repackaging those ideas as a client-side JS bundle rather than a Python server driving a remote browser.
Getting it running
There are two integration paths. The one-liner uses a CDN with a free demo LLM Alibaba is hosting for evaluation:
<script src="https://cdn.jsdelivr.net/npm/page-agent@1.10.0/dist/iife/page-agent.demo.js" crossorigin="true"></script>For production, you install the npm package and wire in your own model. The config is OpenAI-compatible, so anything that speaks that API works:
import { PageAgent } from 'page-agent'
const agent = new PageAgent({
model: 'qwen3.5-plus',
baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
apiKey: 'YOUR_API_KEY',
language: 'en-US',
})
await agent.execute('Click the login button')It supports bringing your own LLM, so you are not locked into Qwen. Any OpenAI-compatible endpoint should slot in.
Where it fits
The library is explicitly scoped to a specific problem. PageAgent is designed for client-side web enhancement, not server-side automation. That framing matters. If you want to scrape sites you do not own, or run scheduled workflows on someone else's SaaS, this is the wrong tool. Use browser-use or Playwright instead.
Where it does fit, based on the use cases the team calls out:
- Embedded copilots in your own SaaS, without a backend rewrite. The agent lives in your bundle and touches the same DOM your users do.
- Form-heavy internal tools like ERP, CRM, and admin panels, where turning a 20-click workflow into one sentence has obvious ROI.
- Accessibility layers that let users drive an app with voice or plain text, without waiting for the vendor to add ARIA everywhere.
- Multi-page workflows via an optional Chrome extension that extends reach across tabs.
- External agent control through a beta MCP server, letting Claude, Cursor, or other MCP clients drive the browser session.
The trade-offs worth knowing
The text-only DOM approach is fast and cheap, but it inherits browser-use's weak spots. Canvas-based UIs, custom WebGL widgets, and heavily obfuscated component libraries do not expose useful text nodes, so the agent has nothing to grip. Sites with iframes from different origins are also a known headache for any in-page approach.
The demo LLM is gated to evaluation only, and the team is clear about that: it is for technical evaluation only, using their free testing LLM API. Production traffic needs your own model provider, which means you own the token bill and the latency.
One quality signal worth flagging: contributions generated entirely by bots or AI without substantial human involvement will not be accepted. That is a refreshingly explicit stance for a repo of this size, and suggests the maintainers are trying to keep issue and PR quality high rather than farming star counts.
Why this matters
Browser agents have mostly been framed as a server-side automation problem. Page-agent flips that. If the agent lives in the page, you get the user's auth cookies for free, you respect the same-origin policy by default, and you can ship an AI copilot as a frontend feature rather than a separate service. For teams sitting on a legacy web app that would take quarters to redesign, dropping in a script tag is a very different conversation than standing up a Puppeteer cluster.