Page Agent
A GUI agent that lives in your webpage — one script gives any web page its own AI agent for DOM manipulation via natural language.
Introduction
Page Agent is a GUI agent developed by Alibaba that lives directly in your web page. By adding a single script tag, any web page gains its own AI agent capable of understanding and manipulating the DOM through natural language commands. No browser extensions, no Python backends, no headless browsers — everything happens in-page via JavaScript.
Page Agent uses text-based DOM manipulation rather than screenshots or multi-modal LLMs, making it lightweight and compatible with any modern browser. It works with most mainstream LLMs including locally deployed ones. The project is MIT-licensed and hosted at alibaba.github.io/page-agent with source on GitHub.
Installation
Page Agent can be installed via NPM or used directly from CDN with a script tag.
NPM Installation
npm install page-agent
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')
CDN (One-line Integration)
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/iife/page-agent.demo.js" crossorigin="anonymous"></script>
The CDN version includes a free testing LLM API for evaluation purposes.
Features & Use Cases
| Feature | Description |
|---|---|
| Easy Integration | No browser extension, Python, or headless browser required. Just one script tag. |
| Text-based DOM | No screenshots, no multi-modal LLMs, no special permissions needed. |
| Bring Your Own LLM | Works with most mainstream models including locally deployed ones. |
| SaaS AI Copilot | Ship an AI copilot in your product in lines of code. No backend rewrite. |
| Smart Form Filling | Turn 20-click workflows into one sentence for ERP, CRM, and admin systems. |
Use Cases
- AI Copilot for SaaS — Add an AI assistant to any web application without backend changes
- Workflow Automation — Automate complex multi-step form filling and data entry
- Accessibility — Make any web app accessible through natural language voice commands
- Multi-page Agent — Extend across browser tabs via the Chrome extension
- MCP Control — Allow MCP client applications to control your browser
Quick Start Integration
The fastest way to try Page Agent is with the one-line CDN integration. The demo script includes a free testing LLM API and creates a demo agent automatically. You can disable auto-init with ?autoInit=false and instantiate manually with new window.PageAgent(...).
For production use, install via NPM and configure your own LLM provider. Page Agent supports OpenAI-compatible APIs, making it compatible with virtually any LLM service including local models via Ollama, vLLM, or llama.cpp.
Chrome Extension & MCP
Page Agent offers an optional Chrome extension that extends its capabilities across multiple browser tabs, enabling multi-page agent tasks. The extension works alongside the in-page script to coordinate actions across tabs.
Page Agent also provides an MCP Server (Beta) that allows external MCP client applications to control the browser. This enables integration with AI coding agents and other MCP-compatible tools, giving them the ability to browse the web, fill forms, and interact with web pages through Page Agent's DOM manipulation engine.
Configuration
Page Agent is configured when creating a new agent instance. The configuration object accepts model selection, API endpoint, authentication, language preference, and behavior settings.
| Option | Description |
|---|---|
model | LLM model identifier (e.g., qwen3.5-plus, gpt-4o) |
baseURL | OpenAI-compatible API endpoint URL |
apiKey | API key for the LLM provider |
language | Agent language (e.g., en-US, zh-CN) |