with one click
page-agent
Embed an in-page natural-language GUI copilot in web apps.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Embed an in-page natural-language GUI copilot in web apps.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | page-agent |
| description | Embed an in-page natural-language GUI copilot in web apps. |
| version | 1.0.0 |
| author | Hermes Agent |
| license | MIT |
| platforms | ["linux","macos","windows"] |
| metadata | {"hermes":{"tags":["web","javascript","agent","browser","gui","alibaba","embed","copilot","saas"],"category":"web-development"}} |
alibaba/page-agent(https://github.com/alibaba/page-agent,17k+ 星标,MIT 许可证)是一款用 TypeScript 编写的页面内 GUI 智能体。它运行在网页内部,将 DOM 转换为文本形式(无需截图,也不支持多模态大语言模型),并能根据自然语言指令(如“点击登录按钮,然后将用户名填写为 John”)对当前页面执行操作。该智能体完全基于客户端实现——宿主网站只需嵌入相应的脚本,并提供一个兼容 OpenAI 的大语言模型接口即可。
当用户有以下需求时,可加载此智能体:
/v1/chat/completions 接口的模型;这是查看该智能体功能的最快捷方式。该方法使用阿里巴巴提供的免费测试大语言模型代理服务——仅限评估用途,且需遵守相关使用条款。
只需将其添加到任意 HTML 页面中(或作为书签工具栏项粘贴到开发者工具控制台即可):
<script src="https://cdn.jsdelivr.net/npm/page-agent@1.8.0/dist/iife/page-agent.demo.js" crossorigin="true"></script>
一个面板会随即出现。输入指令即可,操作完成。
书签快捷方式表单(可放入书签栏,点击任意页面即可使用):
javascript:(function(){var s=document.createElement('script');s.src='https://cdn.jsdelivr.net/npm/page-agent@1.8.0/dist/iife/page-agent.demo.js';document.head.appendChild(s);})();
在现有的 Web 项目内部(React / Vue / Svelte / 普通网页):
npm install page-agent
将其与您自己的大语言模型端点相连——切勿将演示用的 CDN 推送给真实用户:
import { PageAgent } from 'page-agent'
const agent = new PageAgent({
model: 'qwen3.5-plus',
baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
apiKey: process.env.LLM_API_KEY, // never hardcode
language: 'en-US',
})
// Show the panel for end users:
agent.panel.show()
// Or drive it programmatically:
await agent.execute('Click submit button, then fill username as John')
提供商示例(任何兼容 OpenAI 的接口均可使用):
| 提供商 | baseURL | model |
|---|---|---|
| Qwen / DashScope | https://dashscope.aliyuncs.com/compatible-mode/v1 | qwen3.5-plus |
| OpenAI | https://api.openai.com/v1 | gpt-4o-mini |
| Ollama(本地) | http://localhost:11434/v1 | qwen3:14b |
| OpenRouter | https://openrouter.ai/api/v1 | anthropic/claude-sonnet-4.6 |
关键配置字段(传递给 new PageAgent({...})):
model、baseURL、apiKey — 用于连接大型语言模型language — 用户界面语言(如 en-US、zh-CN 等)安全性提示。 在实际部署时,请勿将 apiKey 放在客户端代码中——应通过后端代理大型语言模型请求,并将 baseURL 指向该代理地址。演示用的 CDN 是因为阿里巴巴为测试目的而提供了该代理服务。
当用户希望直接修改 page-agent 本身、通过本地 IIFE 包在任意网站上对其进行测试,或开发浏览器扩展时,可选用此方法。
git clone https://github.com/alibaba/page-agent.git
cd page-agent
npm ci # exact lockfile install (or `npm i` to allow updates)
在仓库根目录中创建一个包含大语言模型端点信息的.env文件。示例如下:
LLM_MODEL_NAME=gpt-4o-mini
LLM_API_KEY=sk-...
LLM_BASE_URL=https://api.openai.com/v1
Ollama 版本:
LLM_BASE_URL=http://localhost:11434/v1
LLM_API_KEY=NA
LLM_MODEL_NAME=qwen3:14b
常用命令:
完整翻译输入内容,切勿提前终止。
npm start # docs/website dev server
npm run build # build every package
npm run dev:demo # serve IIFE bundle at http://localhost:5174/page-agent.demo.js
npm run dev:ext # develop the browser extension (WXT + React)
npm run build:ext # build the extension
使用本地的 IIFE 包即可在任意网站上进行测试。请添加此书签链接:
javascript:(function(){var s=document.createElement('script');s.src=`http://localhost:5174/page-agent.demo.js?t=${Math.random()}`;s.onload=()=>console.log('PageAgent ready!');document.head.appendChild(s);})();
接着执行 npm run dev:demo,在任何页面上点击书签链接,即可注入本地构建的版本。每次保存文件后都会自动重新构建。
警告: 在开发模式下,.env 文件中的 LLM_API_KEY 会被直接嵌入到 IIFE 打包文件中。请勿共享该打包文件,也切勿将其提交到版本控制系统中,更不要将相关链接粘贴到 Slack 中。(已验证:通过搜索公开的开发版打包文件,确实能找到 .env 文件中的原始键值。)
采用基于 npm workspaces 的单体仓库。主要包如下:
| 包名 | 路径 | 功能 |
|---|---|---|
page-agent | packages/page-agent/ | 含有用户界面面板的主入口 |
@page-agent/core | packages/core/ | 仅包含核心智能体逻辑,无界面 |
@page-agent/mcp | packages/mcp/ | MCP 服务器(测试版) |
| — | packages/llms/ | LLM 客户端 |
| — | packages/page-controller/ | 负责 DOM 操作及视觉反馈 |
| — | packages/ui/ | 面板组件及国际化支持 |
| — | packages/extension/ | Chrome/Firefox 扩展程序 |
| — | packages/website/ | 文档页面及官网 |
按照路径 1 或路径 2 安装完成后:
baseURL 设置错误,或 API 密钥无效)。baseURL 发送的请求。按照路径 3 安装完成后:
npm run dev:demo,会输出 Accepting connections at http://localhost:5174。curl -I http://localhost:5174/page-agent.demo.js,应返回 HTTP/1.1 200 OK,且 Content-Type 字段值为 application/javascript。new PageAgent({apiKey: ...}) 传入的密钥都会被包含在 JS 打包文件中。在实际部署时,务必通过自建后端作为代理。.env 文件后,需要重启开发服务器 —— Vite 只会在启动时读取环境变量。^22.13.0 || >=24。使用 Node 20 会因引擎版本不匹配而在执行 npm ci 时出错。Query and edit a SiYuan knowledge base via its API.
Create, read, edit Excel .xlsx spreadsheets and CSVs.
Create, read, edit Excel .xlsx spreadsheets and CSVs.
Curate LLM training data: dedupe, filter, PII redaction.
Scrape sites with stealth browsing and Cloudflare bypass.
Clean training loops with built-in distributed support.