page-agent Documentation

JavaScript in-page GUI agent. Control web interfaces with natural language.

28,606 stars TypeScript TypeScript 1 file ยท ~8,584 tokens #agent#ai#ai-agents#browser-automation#javascript#mcp#typescript#web
RAW Doc

File: README.md

Page Agent








The GUI Agent Living in Your Webpage. One script gives any web page its own AI agent.

๐ŸŒ English | ไธญๆ–‡

๐Ÿš€ Demo | ๐Ÿ“– Docs | ๐Ÿ“ข HN Discussion | ๐• Follow on X


โœจ Features

  • ๐ŸŽฏ Easy integration
    • No need for browser extension / python / headless browser.
    • Just in-page javascript. Everything happens in your web page.
  • ๐Ÿ“– Text-based DOM manipulation
    • No screenshots. No multi-modal LLMs or special permissions needed.
  • ๐Ÿง  Bring your own LLMs
    • Works with most mainstream models, including locally deployed ones. See supported models.
  • ๐Ÿ™ Optional chrome extension for multi-page tasks.

๐Ÿ’ก Use Cases

  • 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. Perfect for ERP, CRM, and admin systems.
  • Accessibility โ€” Make any web app accessible through natural language. Voice commands, screen readers, zero barrier.
  • Multi-page Agent โ€” Extend your own web agent's reach across browser tabs via the Chrome extension.
  • MCP - Allow your agent clients to control your browser.

๐Ÿš€ Quick Start

One-line integration

Fastest way to try PageAgent with our free Demo LLM:

html
<script
    src="https://cdn.jsdelivr.net/npm/[email protected]/dist/iife/page-agent.demo.js"
    crossorigin="anonymous"
></script>

โš ๏ธ For technical evaluation only. This demo CDN uses our free testing LLM API. By using it, you agree to its terms.

Add ?autoInit=false to load the script without creating the demo agent automatically. You can then instantiate it with new window.PageAgent(...) and your own LLMs.

NPM Installation

bash
npm install page-agent
javascript
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')

For more programmatic usage, see ๐Ÿ“– Documentations.

๐Ÿค Contributing

We welcome contributions from the community! See CONTRIBUTING.md for guidelines and docs/developer-guide.md for local development workflows.

Built something cool with PageAgent? Share it in Show and Tell. ๐Ÿ™Œ

Please read the maintainer's note on principles and current state.

Contributions generated entirely by bots or AI without substantial human involvement will not be accepted.

โš–๏ธ License

MIT License

๐Ÿ‘ Acknowledgments

This project builds upon the excellent work of browser-use.

PageAgent is designed for client-side web enhancement, not server-side automation.

text
DOM processing components and prompt are derived from browser-use:

Browser Use <https://github.com/browser-use/browser-use>
Copyright (c) 2024 Gregor Zunic
Licensed under the MIT License

We gratefully acknowledge the browser-use project and its contributors for their
excellent work on web automation and DOM interaction patterns that helped make
this project possible.

โญ Star this repo if you find PageAgent helpful!


File: docs/CODE_OF_CONDUCT.md

Alibaba Open Source Code of Conduct

ยถไธญๆ–‡็‰ˆ

Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

Our Standards

Examples of behavior that contributes to creating a positive environment
include:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints and experiences
  • Gracefully accepting constructive criticism
  • Focusing on what is best for the community
  • Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

  • The use of sexualized language or imagery and unwelcome sexual attention or
    advances
  • Trolling, insulting/derogatory comments, and personal or political attacks
  • Public or private harassment
  • Publishing others' private information, such as a physical or electronic
    address, without explicit permission
  • Other conduct which could reasonably be considered inappropriate in a
    professional setting

Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html


Chinese Version
ใ€Š้˜ฟ้‡Œๅทดๅทดๅผ€ๆบ่กŒไธบๅ‡†ๅˆ™ใ€‹

ๆˆ‘ไปฌ็š„ไฟ่ฏ

ไธบไบ†ไฟƒ่ฟ›ไธ€ไธชๅผ€ๆ”พ้€ๆ˜Žไธ”ๅ‹ๅฅฝ็š„็Žฏๅขƒ๏ผŒๆˆ‘ไปฌไฝœไธบ่ดก็Œฎ่€…ๅ’Œ็ปดๆŠค่€…ไฟ่ฏ๏ผšๆ— ่ฎบๅนด้พ„ใ€็งๆ—ใ€ๆฐ‘ๆ—ใ€ๆ€งๅˆซ่ฎคๅŒๅ’Œ่กจ่พพ๏ผˆๆ–นๅผ๏ผ‰ใ€ไฝ“ๅž‹ใ€่บซไฝ“ๅฅๅ…จไธŽๅฆใ€็ป้ชŒๆฐดๅนณใ€ๅ›ฝ็ฑใ€ไธชไบบ่กจ็Žฐใ€ๅฎ—ๆ•™ๆˆ–ๆ€งๅˆซๅ–ๅ‘๏ผŒๅ‚ไธŽ่€…ๅœจๆˆ‘ไปฌ้กน็›ฎๅ’Œ็คพๅŒบไธญ้ƒฝๅ…ไบŽ้ชšๆ‰ฐใ€‚

ๆˆ‘ไปฌ็š„ๆ ‡ๅ‡†

ๆœ‰ๅŠฉไบŽๅˆ›้€ ๆญฃ้ข็Žฏๅขƒ็š„่กŒไธบๅŒ…ๆ‹ฌไฝ†ไธ้™ไบŽ๏ผš

  • ไฝฟ็”จๅ‹ๅฅฝๅ’ŒๅŒ…ๅฎนๆ€ง่ฏญ่จ€
  • ๅฐŠ้‡ไธๅŒ็š„่ง‚็‚นๅ’Œ็ปๅކ
  • ่€ๅฟƒๅœฐๆŽฅๅ—ๅปบ่ฎพๆ€งๆ‰น่ฏ„
  • ๅ…ณๆณจๅฏน็คพๅŒบๆœ€ๆœ‰ๅˆฉ็š„ไบ‹ๆƒ…
  • ๅ‹ๅ–„ๅฏนๅพ…ๅ…ถไป–็คพๅŒบๆˆๅ‘˜

่บซไธบๅ‚ไธŽ่€…ไธ่ƒฝๆŽฅๅ—็š„่กŒไธบๅŒ…ๆ‹ฌไฝ†ไธ้™ไบŽ๏ผš

  • ไฝฟ็”จไธŽๆ€งๆœ‰ๅ…ณ็š„่จ€่ฏญๆˆ–ๆ˜ฏๅ›พๅƒ๏ผŒไปฅๅŠไธๅ—ๆฌข่ฟŽ็š„ๆ€ง้ชšๆ‰ฐ
  • ๆฃไนฑ/็…ฝๅŠจ/้€ ่ฐฃ็š„่กŒไธบๆˆ–่ฟ›่กŒไพฎ่พฑ/่ดฌๆŸ็š„่ฏ„่ฎบ๏ผŒไบบ่บซๆ”ปๅ‡ปๅŠๆ”ฟๆฒปๆ”ปๅ‡ป
  • ๅ…ฌๅผ€ๆˆ–็งไธ‹็š„้ชšๆ‰ฐ
  • ๆœช็ป่ฎธๅฏๅœฐๅ‘ๅธƒไป–ไบบ็š„ไธชไบบ่ต„ๆ–™๏ผŒไพ‹ๅฆ‚ไฝๅ€ๆˆ–ๆ˜ฏ็”ตๅญๅœฐๅ€
  • ๅ…ถไป–ๅฏไปฅ่ขซๅˆ็†ๅœฐ่ฎคๅฎšไธบไธๆฐๅฝ“ๆˆ–่€…่ฟๅ่Œไธšๆ“ๅฎˆ็š„่กŒไธบ

ๆˆ‘ไปฌ็š„่ดฃไปป

้กน็›ฎ็ปดๆŠค่€…ๆœ‰่ดฃไปปไธบใ€ŒๅฏๆŽฅๅ—็š„่กŒไธบใ€ๆ ‡ๅ‡†ๅšๅ‡บ่ฏ ้‡Š๏ผŒไปฅๅŠๅฏนๅทฒๅ‘็”Ÿ็š„ไธ่ขซๆŽฅๅ—็š„่กŒไธบ้‡‡ๅ–ๆฐๅฝ“ไธ”ๅ…ฌๅนณ็š„็บ ๆญฃๆŽชๆ–ฝใ€‚

้กน็›ฎ็ปดๆŠค่€…ๆœ‰ๆƒๅˆฉๅŠ่ดฃไปปๅŽปๅˆ ้™คใ€็ผ–่พ‘ใ€ๆ‹’็ปไธŽๆœฌ่กŒไธบๆ ‡ๅ‡†ๆœ‰ๆ‰€่ฟ่ƒŒ็š„่ฏ„่ฎบ (comments)ใ€ๆไบค (commits)ใ€ไปฃ็ ใ€wiki ็ผ–่พ‘ใ€้—ฎ้ข˜ (issues) ๅ’Œๅ…ถไป–่ดก็Œฎ๏ผŒไปฅๅŠ้กน็›ฎ็ปดๆŠค่€…ๅฏๆš‚ๆ—ถๆˆ–ๆฐธไน…ๆ€ง็š„็ฆๆญขไปปไฝ•ไป–ไปฌ่ฎคไธบๆœ‰ไธ้€‚ๅฝ“ใ€ๅจ่ƒใ€ๅ†’็Šฏใ€ๆœ‰ๅฎณ่กŒไธบ็š„่ดก็Œฎ่€…ใ€‚

ไฝฟ็”จ่Œƒๅ›ด

ๅฝ“ไธ€ไธชไบบไปฃ่กจ่ฏฅ้กน็›ฎๆˆ–ๆ˜ฏๅ…ถ็คพๅŒบๆ—ถ๏ผŒๆœฌ่กŒไธบๆ ‡ๅ‡†้€‚็”จไบŽๅ…ถ้กน็›ฎๅนณๅฐๅ’Œๅ…ฌๅ…ฑๅนณๅฐใ€‚

ไปฃ่กจ้กน็›ฎๆˆ–ๆ˜ฏ็คพๅŒบ็š„ๆƒ…ๅ†ต๏ผŒไธพไพ‹ๆฅ่ฏดๅŒ…ๆ‹ฌไฝฟ็”จๅฎ˜ๆ–น้กน็›ฎ็š„็”ตๅญ้‚ฎไปถๅœฐๅ€ใ€้€š่ฟ‡ๅฎ˜ๆ–น็š„็คพๅŒบๅช’ไฝ“่ดฆๅทๅ‘ๅธƒๆˆ–็บฟไธŠๆˆ–็บฟไธ‹ไบ‹ไปถไธญๆ‹…ไปปๆŒ‡ๅฎšไปฃ่กจใ€‚

่ฏฅ้กน็›ฎ็š„ๅ‘ˆ็Žฐๆ–นๅผๅฏ็”ฑๅ…ถ้กน็›ฎ็ปดๆŠค่€…่ฟ›่กŒ่ฟ›ไธ€ๆญฅ็š„ๅฎšไน‰ๅŠ่งฃ้‡Šใ€‚

ๅผบๅˆถๆ‰ง่กŒ

ๅฏไปฅ้€š่ฟ‡ [email protected] ๆฅ่”็ณป้กน็›ฎๅ›ข้˜ŸๆฅไธพๆŠฅๆปฅ็”จใ€้ชšๆ‰ฐๆˆ–ๅ…ถไป–ไธ่ขซๆŽฅๅ—็š„่กŒไธบใ€‚

ไปปไฝ•็ปดๆŠคๅ›ข้˜Ÿ่ฎคไธบๆœ‰ๅฟ…่ฆไธ”้€‚ๅˆ็š„ๆ‰€ๆœ‰ๆŠ•่ฏ‰้ƒฝๅฐ†่ฟ›่กŒๅฎกๆŸฅๅŠ่ฐƒๆŸฅ๏ผŒๅนถๅšๅ‡บ็›ธๅฏนๅบ”็š„ๅ›žๅบ”ใ€‚้กน็›ฎๅฐ็ป„ๆœ‰ๅฏนไบ‹ไปถๅ›žๆŠฅ่€…ๆœ‰ไฟๅฏ†็š„ไน‰ๅŠกใ€‚ๅ…ทไฝ“ๆ‰ง่กŒ็š„ๆ–น้’ˆ่ฟ‘ไธ€ๆญฅ็ป†่Š‚ๅฏ่ƒฝไผšๅ•็‹ฌๅ…ฌๅธƒใ€‚

ๆฒกๆœ‰ๅˆ‡ๅฎžๅœฐ้ตๅฎˆๆˆ–ๆ˜ฏๆ‰ง่กŒๆœฌ่กŒไธบๆ ‡ๅ‡†็š„้กน็›ฎ็ปดๆŠคไบบๅ‘˜๏ผŒๅฏ่ƒฝไผšๅ› ้กน็›ฎ้ข†ๅฏผไบบๆˆ–ๆ˜ฏๅ…ถไป–ๆˆๅ‘˜็š„ๅ†ณๅฎš๏ผŒๆš‚ๆ—ถๆˆ–ๆ˜ฏๆฐธไน…ๅœฐๅ–ๆถˆๅ…ถๅ‚ไธŽ่ต„ๆ ผใ€‚

ๆฅๆบ

ๆœฌ่กŒไธบๆ ‡ๅ‡†ๆ”น็ผ–่‡ช่ดก็Œฎ่€…ๅ…ฌ็บฆ๏ผŒ็‰ˆๆœฌ 1.4
ๅฏๅœจๆญคๆŸฅ็œ‹https://www.contributor-covenant.org/zh-cn/version/1/4/code-of-conduct.html


File: docs/developer-guide.md

Developer Guide

This file is for local development workflows.

For contribution rules and expectations, see ../CONTRIBUTING.md.

๐Ÿš€ Quick Start

Development Setup

  1. Prerequisites

    • macOS / Linux / WSL
    • node.js ^22.13 || >=24 with npm >= 11
    • An editor that supports ts/eslint/prettier
    • Make sure eslint, prettier and commitlint work well. Un-linted code won't pass the CI.
  2. Setup

    bash
    npm i            # Or `npm ci` if you don't want to change the lockfile
    npm start        # Start website dev server
    npm run build    # Build everything

๐Ÿ“ฆ Project Structure

This is a monorepo with npm workspaces.

Published packages:

  • Page Agent (packages/page-agent/) - Main entry with built-in UI Panel (npm: page-agent)
  • MCP (packages/mcp/) - MCP server for browser control via Page Agent extension (npm: @page-agent/mcp)
  • Core (packages/core/) - Core agent logic without UI (npm: @page-agent/core)
  • LLMs (packages/llms/) - LLM client with reflection-before-action mental model
  • Page Controller (packages/page-controller/) - DOM operations and visual feedback, independent of LLM
  • UI (packages/ui/) - Panel and i18n, decoupled from PageAgent

Applications:

  • Extension (packages/extension/) - Browser extension (WXT + React)
  • Website (packages/website/) - React docs, landing page, and dev playground (private)

Source-first monorepo with npm workspaces + ts references + vite alias. Library package.json exports point to src/*.ts during development, and point to dist/*.js when published. workspaces in root package.json must be in topological order.

๐Ÿค– AGENTS.md Alias

If your AI assistant does not support AGENTS.md. Add an alias for it.

๐Ÿ”ง Development Workflows

Test With Your Own LLM API

  • Create a .env file in the repo root with your LLM API config

    env
    LLM_MODEL_NAME=gpt-5.2
    LLM_API_KEY=your-api-key
    LLM_BASE_URL=https://api.your-llm-provider.com/v1
  • Ollama example (tested on 0.15 + qwen3:14b, RTX3090 24GB):

    env
    LLM_BASE_URL="http://localhost:11434/v1"
    LLM_API_KEY="NA"
    LLM_MODEL_NAME="qwen3:14b"

    @see https://alibaba.github.io/page-agent/docs/features/models#ollama for configuration

  • Restart the dev server to load new env vars

  • If not provided, the demo will use the free testing proxy by default. By using it, you agree to its terms.

Extension Development

bash
npm run dev:ext
npm run build:ext
  • Update packages/extension/docs/extension_api.md for API integration details

Testing on Other Websites

  • Start and serve a local iife script

    bash
    npm run dev:demo # Serving IIFE with auto rebuild at http://localhost:5174/page-agent.demo.js
  • Add a new bookmark

    javascript
    javascript:(function(){var s=document.createElement('script');s.src=`http://localhost:5174/page-agent.demo.js?lang=en-US&t=${Math.random()}`;s.onload=()=>console.log(%27PageAgent ready!%27);document.head.appendChild(s);})();
  • Click the bookmark on any page to load Page-Agent

Warning: AK in your local .env will be inlined in the iife script. Be very careful when you distribute the script.

Adding Documentation

Ask an AI to help you add documentation to the website/ package. Follow the existing style.

Our AGENTS.md file and guardrails are designed for this purpose. But please be careful and review anything AI generated.


File: docs/README-zh.md

Page Agent








็บฏ JS ๅฎž็Žฐ็š„ GUI agentใ€‚ไฝฟ็”จ่‡ช็„ถ่ฏญ่จ€ๆ“ไฝœไฝ ็š„ Web ๅบ”็”จใ€‚ๆ— ้กปๅŽ็ซฏใ€ๅฎขๆˆท็ซฏใ€ๆต่งˆๅ™จๆ’ไปถใ€‚

๐ŸŒ English | ไธญๆ–‡

๐Ÿš€ Demo | ๐Ÿ“– Docs | ๐Ÿ“ข HN Discussion | ๐• Follow on X


โœจ Features

  • ๐ŸŽฏ ่ฝปๆพ้›†ๆˆ
    • ๆ— ้œ€ ๆต่งˆๅ™จๆ’ไปถ / Python / ๆ— ๅคดๆต่งˆๅ™จ๏ผŒ็บฏ้กต้ขๅ†… JavaScript
  • ๐Ÿ“– ๅŸบไบŽๆ–‡ๆœฌ็š„ DOM ๆ“ไฝœ
    • ๆ— ้œ€ๆˆชๅ›พ๏ผŒๆ— ้œ€ๅคšๆจกๆ€ๆจกๅž‹ๆˆ–็‰นๆฎŠๆƒ้™
  • ๐Ÿง  ่‡ชๅค‡ LLM
    • ๆ”ฏๆŒๅคšๆ•ฐไธปๆตๆจกๅž‹๏ผŒๅŒ…ๆ‹ฌๆœฌๅœฐ้ƒจ็ฝฒๆจกๅž‹ใ€‚ๅ‚่งๆ”ฏๆŒ็š„ๆจกๅž‹ใ€‚
  • ๐Ÿ™ ๅฏ้€‰็š„ Chrome ๆ‰ฉๅฑ•๏ผŒๆ”ฏๆŒ่ทจ้กต้ขไปปๅŠก

๐Ÿ’ก ๅบ”็”จๅœบๆ™ฏ

  • SaaS AI Copilot โ€” ๅ‡ ่กŒไปฃ็ ไธบไฝ ็š„ไบงๅ“ๅŠ ไธŠ AI ๅ‰ฏ้ฉพ้ฉถ๏ผŒๆ— ้œ€้‡ๅ†™ๅŽ็ซฏใ€‚
  • ๆ™บ่ƒฝ่กจๅ•ๅกซๅ†™ โ€” ๆŠŠ 20 ๆฌก็‚นๅ‡ปๅ˜ๆˆไธ€ๅฅ่ฏใ€‚ERPใ€CRMใ€็ฎก็†ๅŽๅฐ็š„ๆœ€ไฝณๆ‹ๆกฃใ€‚
  • ๆ— ้šœ็ขๅขžๅผบ โ€” ็”จ่‡ช็„ถ่ฏญ่จ€่ฎฉไปปไฝ•็ฝ‘้กตๆ— ้šœ็ขใ€‚่ฏญ้ŸณๆŒ‡ไปคใ€ๅฑๅน•้˜…่ฏปๅ™จ๏ผŒ้›ถ้—จๆง›ใ€‚
  • ่ทจ้กต้ข Agent โ€” ้€š่ฟ‡ๅฏ้€‰็š„ Chrome ๆ‰ฉๅฑ•๏ผŒ่ฎฉไฝ ่‡ชๅทฑ็š„ Web Agent ่ทจๆ ‡็ญพ้กตๅทฅไฝœใ€‚
  • ้€š่ฟ‡ MCP ไธบ็Žฐๆœ‰ Agent ๅŠ ๅ…ฅๆต่งˆๅ™จๆŽงๅˆถ่ƒฝๅŠ›ใ€‚

๐Ÿš€ ๅฟซ้€Ÿๅผ€ๅง‹

ไธ€่กŒไปฃ็ ้›†ๆˆ

้€š่ฟ‡ๆˆ‘ไปฌๅ…่ดน็š„ Demo LLM ๅฟซ้€Ÿไฝ“้ชŒ PageAgent๏ผš

html
<script
    src="https://registry.npmmirror.com/page-agent/1.12.2/files/dist/iife/page-agent.demo.js"
    crossorigin="anonymous"
></script>

โš ๏ธ ไป…็”จไบŽๆŠ€ๆœฏ่ฏ„ไผฐใ€‚ ่ฏฅ Demo CDN ไฝฟ็”จไบ†ๅ…่ดน็š„ๆต‹่ฏ• LLM API๏ผŒไฝฟ็”จๅณ่กจ็คบๆ‚จๅŒๆ„ๅ…ถๆกๆฌพใ€‚

ๅœจ URL ๅŽๆทปๅŠ  ?autoInit=false ๅฏๅชๅŠ ่ฝฝ่„šๆœฌ๏ผŒไธ่‡ชๅŠจๅˆ›ๅปบ Demo Agent๏ผŒไน‹ๅŽๅฏ้€š่ฟ‡ new window.PageAgent(...) ๆ‰‹ๅŠจๅˆๅง‹ๅŒ–๏ผŒๅนถไฝฟ็”จ่‡ชๅฎšไน‰ LLMใ€‚

NPM ๅฎ‰่ฃ…

bash
npm install page-agent
javascript
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: 'zh-CN',
})

await agent.execute('็‚นๅ‡ป็™ปๅฝ•ๆŒ‰้’ฎ')

ๆ›ดๅคš็ผ–็จ‹็”จๆณ•๏ผŒ่ฏทๅ‚้˜… ๐Ÿ“– ๆ–‡ๆกฃใ€‚

๐Ÿค ่ดก็Œฎ

ๆฌข่ฟŽ็คพๅŒบ่ดก็Œฎ๏ผ่ฏทๅ‚้˜… CONTRIBUTING.md ไบ†่งฃๅฎ‰่ฃ…ไธŽ่ดก็ŒฎๆŒ‡ๅ—ใ€‚

ๆไบค issue ๆˆ– PR ไน‹ๅ‰๏ผŒ่ฏทๅ…ˆ้˜…่ฏปไฝœ่€…ๅฃฐๆ˜Žๅ’Œ่กŒไธบๅ‡†ๅˆ™ใ€‚

ๆˆ‘ไปฌไธๆŽฅๅ—ๆœช็ปๅฎž่ดจๆ€งไบบ็ฑปๅ‚ไธŽใ€ๅฎŒๅ…จ็”ฑ Bot ๆˆ– Agent ่‡ชๅŠจ็”Ÿๆˆ็š„ไปฃ็ ใ€‚

็”จ PageAgent ๅšไบ†ๆœ‰่ถฃ็š„ไธœ่ฅฟ๏ผŸๆฌข่ฟŽๅˆฐ Show and Tell ๅˆ†ไบซใ€‚๐Ÿ™Œ

๐Ÿ‘ ๅฃฐๆ˜ŽไธŽ่‡ด่ฐข

ๆœฌ้กน็›ฎๅŸบไบŽ browser-use ็š„ไผ˜็ง€ๅทฅไฝœๆž„ๅปบใ€‚

PageAgent ไธ“ไธบๅฎขๆˆท็ซฏ็ฝ‘้กตๅขžๅผบ่ฎพ่ฎก๏ผŒไธๆ˜ฏๆœๅŠก็ซฏ่‡ชๅŠจๅŒ–ๅทฅๅ…ทใ€‚

text
DOM processing components and prompt are derived from browser-use:

Browser Use <https://github.com/browser-use/browser-use>
Copyright (c) 2024 Gregor Zunic
Licensed under the MIT License

We gratefully acknowledge the browser-use project and its contributors for their
excellent work on web automation and DOM interaction patterns that helped make
this project possible.

โš–๏ธ ่ฎธๅฏ่ฏ

MIT License

โญ ๅฆ‚ๆžœ่ง‰ๅพ— PageAgent ๆœ‰็”จๆˆ–ๆœ‰่ถฃ๏ผŒ่ฏท็ป™้กน็›ฎ็‚นไธชๆ˜Ÿ๏ผ


File: docs/SECURITY.md

Security Policy

Supported Versions

We provide security fixes on a best-effort basis for:

Version Supported
main Yes
Latest npm release of page-agent and workspace packages Yes
Older releases No

Please upgrade to the latest release before reporting an issue against an older build.

Reporting a Vulnerability

Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.

Use GitHub's private vulnerability reporting flow:

If private reporting is unavailable, open a minimal public issue only to request a private contact channel. Do not include exploit details.

What to Include

  • Affected package or feature
  • Exact version, commit, or build
  • Browser, OS, and runtime environment
  • Reproduction steps or a proof of concept
  • Expected impact

Scope

We prioritize reports that show a real security boundary failure, such as:

  • Unauthorized access to data, tokens, or extension capabilities
  • Bypassing explicit safety constraints
  • Sensitive data exposure caused by default behavior

The following usually do not qualify by themselves:

  • Unsafe custom integrations that ignore documented safeguards
  • Intentionally embedding secrets into client-side builds
  • Reports against unsupported older versions

Disclosure

Please avoid public disclosure until maintainers have had a reasonable chance to investigate and ship a fix.


File: docs/terms-and-privacy.md

Terms of Use & Privacy

Last updated: March 2026

"We" in this document refers to the maintainers of the open-source Page Agent project (https://github.com/alibaba/page-agent). "The software" refers to Page Agent (the JavaScript library) and Page Agent Ext (the browser extension). This document covers the software itself and the testing API we provide โ€” not any third-party product or service built with it.


1. Open Source Software Privacy

The software is a client-side only tool with a "Bring Your Own Key" (BYOK) architecture. The software itself does not include any backend service. The software does not collect or transmit any user data on its own, and we do not have access to your browsing activity, page content, or task instructions through the software.

All data transmission occurs only between your browser and the LLM provider you configure. You are in full control of which provider receives your data.

The project is open source under the MIT License and can be audited at: https://github.com/alibaba/page-agent


2. Testing API and Demo Disclaimer & Terms of Use

To facilitate easy testing and technical evaluation, we provide a free testing LLM API. This API is used in the project homepage's live demo, the pre-built demo CDN bundles, and the browser extension's default configuration. Users may also use it independently for their own technical evaluation of the software.

This free testing API is provided strictly for technical evaluation and R&D purposes only. It must not be used in any production environment. By using this API, you agree to the following terms:

  • Permitted Use Only: This API must be used solely for technical evaluation of the software. Any other use โ€” including integration into other products or services, unlawful activities, violation of the underlying LLM provider's usage policies, or automated scraping at scale โ€” is strictly prohibited.

  • No Sensitive Data: You are strictly prohibited from inputting any Personal Identifiable Information (PII), confidential business data, financial/medical records, or using this agent on web pages containing such sensitive information.

  • Data Processing: We do not store or log your prompts, webpage data (HTML), or any submitted content, nor do we use such data for model training. All data is processed in-transit and immediately discarded. We perform in-memory request validation to prevent abuse of the testing API, and temporarily process IP addresses for rate-limiting purposes. No data from these processes is retained. Data is processed through Alibaba Cloud infrastructure, which is subject to its own privacy policy.

  • Independent Infrastructure: The software is completely frontend-based with a "Bring Your Own Key" (BYOK) architecture and no built-in backend. To facilitate easy testing, the maintainers have purchased public cloud services from Alibaba Cloud China (aliyun.com Function Compute and BaiLian Qwen models). This project is not a product of, nor endorsed by, Alibaba Cloud.

  • No Guaranteed Availability: This testing API may be rate-limited, degraded, or discontinued at any time without prior notice.

  • "AS IS" & Limitation of Liability: This service is provided strictly on an "AS IS" and "AS AVAILABLE" basis, without any warranties. The maintainers bear no liability for any data loss, service interruption, or legal consequences arising from your use of this service.

  • Recommendation for Real Usage: For secure and continuous usage, we strongly advise using the BYOK mode with your own legally compliant commercial LLM API keys, or connecting to local, offline models (e.g., Ollama).

Note: This free testing LLM API processes data via servers located in Mainland China. If you are located in a region with strict data localization laws (such as the EU/EEA), please do not use this API.

Age Requirement: The software and testing API are not intended for use by individuals under the age of 13 (or the minimum age of digital consent in your jurisdiction).


3. Browser Extension (Page Agent Ext)

Data Processing

The extension performs DOM analysis and automation actions locally in your browser. Your browsing history, passwords, and form data are not accessed or collected by the extension developer.

Data is transmitted to external servers only when you initiate an automation task. When this occurs:

  • Your task instructions (natural language commands)
  • Simplified page structure (cleaned HTML) of all pages under the extension's control

are sent to the LLM API endpoint configured in your settings.

Note: The HTML cleaning process simplifies page structure for AI readability but does not guarantee removal of sensitive information (e.g., visible text, form values, or personal data on the page). Please be mindful of the page content when initiating tasks.

If you configure a third-party LLM provider (e.g., OpenAI, Anthropic, or others), data is sent directly to that provider. Their privacy policies apply.

If you use the testing API, the terms in Section 2 apply. By using the extension with the default testing API, you agree to those terms.

Data Storage

  • Local storage only: Your configuration (API endpoint, API key, model selection) is stored in your browser via chrome.storage.local (or equivalent browser storage APIs)
  • No cloud sync: Configuration is not synced to any external server
  • No analytics: The extension does not include any analytics or tracking code

Your Control

  • The extension is open source and can be audited by anyone
  • You choose which LLM provider to use
  • You may configure your own API endpoint at any time
  • You can clear all stored data by removing the extension

Changes

We may update these terms at our discretion.

Contact

https://github.com/alibaba/page-agent/issues


File: packages/mcp/README.md

@page-agent/mcp

MCP server that lets AI agent clients (Claude Desktop, Copilot, etc.) control your browser through the Page Agent extension.

Prerequisites

Installation

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{
    "mcpServers": {
        "page-agent": {
            "command": "npx",
            "args": ["-y", "@page-agent/mcp"],
            "env": {
                "LLM_BASE_URL": "https://dashscope.aliyuncs.com/compatible-mode/v1",
                "LLM_API_KEY": "sk-xxx",
                "LLM_MODEL_NAME": "qwen3.5-plus"
            }
        }
    }
}

Cursor / Copilot

Same format โ€” add the config to the MCP settings of your client.

MCP Tools

Tool Input Description
execute_task { task: string } Execute a browser task in natural language. Blocking.
get_status โ€” Returns { connected, busy }
stop_task โ€” Stop the currently running task.

Environment Variables

Variable Default Description
LLM_BASE_URL โ€” LLM API base URL
LLM_API_KEY โ€” LLM API key
LLM_MODEL_NAME โ€” Model name
PORT 38401 HTTP + WebSocket port

How It Works

text
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  stdio   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  WebSocket   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Claude /     โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ @page-agent/mcp  โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ Hub tab      โ”‚
โ”‚ Copilot      โ”‚  (MCP)   โ”‚ (Node.js)        โ”‚  (localhost) โ”‚ (extension)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                   โ”‚                               โ”‚
                                   โ”‚ HTTP                          โ”‚ useAgent
                                   โ–ผ                               โ–ผ
                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                          โ”‚ Launcher page    โ”‚              โ”‚ MultiPage    โ”‚
                          โ”‚ (localhost:PORT) โ”‚              โ”‚ Agent        โ”‚
                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. Agent client starts the MCP server via stdio (npx @page-agent/mcp).
  2. Server starts HTTP + WS on localhost:PORT, opens the launcher page in browser.
  3. Launcher page triggers the extension to open a hub tab (hub.html?ws=PORT).
  4. Hub connects to the WS server. MCP tools now proxy tasks to the hub.

The hub tab speaks a generic WebSocket protocol (defined in hub-ws.ts in the extension package) and has no knowledge of MCP. See the hub's protocol docs for message format details.

Architecture

Pure JS ESM, no build step. Source files are the published artifacts.

text
src/
โ”œโ”€โ”€ index.js        # CLI entry: MCP server (stdio) + opens launcher
โ”œโ”€โ”€ hub-bridge.js   # HTTP server + WebSocket bridge to hub tab
โ””โ”€โ”€ launcher.html   # Bootstrap page: detects extension, triggers hub open

Dev

bash
npm run dev:ext
npx @modelcontextprotocol/inspector node packages/mcp/src/index.js

File: packages/extension/docs/extension_api.md

Page Agent Extension API

Integrate the Page Agent extension into your web app and trigger multi-page browser tasks from page JavaScript.

Installation

1. Install the browser extension

Primary channel:

Latest updates are often published earlier on:

bash
npm install @page-agent/core --save-dev

3. Authorization (Token)

The token allows your page JS to call the extension API (window.PAGE_AGENT_EXT) and execute multi-page tasks.

Why token-based access is required:

  • The extension has broad browser permissions (page access, navigation, multi-tab control).
  • If abused, it can harm user privacy and security.
  • Users must explicitly provide the token only to applications they trust.

Setup:

  1. Open the extension side panel and copy your auth token.
  2. Set the token in your page:
typescript
localStorage.setItem('PageAgentExtUserAuthToken', 'your-token')

Quick Start

typescript
import type { AgentActivity, AgentStatus, ExecutionResult, HistoricalEvent } from '@page-agent/core'

// Wait for extension injection (up to 1 second)
async function waitForExtension(timeout = 1000): Promise {
    const start = Date.now()
    while (Date.now() - start < timeout) {
        if (window.PAGE_AGENT_EXT) return true
        await new Promise((r) => setTimeout(r, 100))
    }
    return false
}

// Usage
if (await waitForExtension()) {
    const result = await window.PAGE_AGENT_EXT!.execute('Click the login button', {
        baseURL: 'https://api.openai.com/v1',
        apiKey: 'your-api-key',
        model: 'gpt-5.2',
        onStatusChange: (status) => console.log('Status:', status),
        onActivity: (activity) => console.log('Activity:', activity),
    })
    console.log('Result:', result)
}

Global API

After token match, the extension injects APIs into window.

`window.PAGE_AGENT_EXT_VERSION`

Extension version string (for capability checks before using the main API).

`window.PAGE_AGENT_EXT`

Main namespace object.

`PAGE_AGENT_EXT.execute(task, config)`

Execute one agent task.

Parameters:

Name Type Required Description
task string Yes Task description
config ExecuteConfig Yes LLM settings, options, and callbacks

Returns: Promise<ExecutionResult>

`PAGE_AGENT_EXT.stop()`

Stop the current task.

Limitations

  • Normal browser windows only. This extension relies on tab group API which does not work for pop-up window or PWA App window.

Types

Install @page-agent/core for complete types:

typescript
import type { AgentActivity, AgentStatus, ExecutionResult, HistoricalEvent } from '@page-agent/core'

export interface ExecuteConfig {
    baseURL: string
    model: string
    apiKey?: string

    // Global system-level instructions for the agent.
    // Equivalent to AgentConfig.instructions.system.
    systemInstruction?: string

    // Include the initial tab where page JS starts. Default: true.
    includeInitialTab?: boolean

    // Control all unpinned tabs in the window instead of only the tab group.
    // When enabled, agent sees and can switch to every non-pinned tab.
    // Default: false. Experimental.
    experimentalIncludeAllTabs?: boolean

    onStatusChange?: (status: AgentStatus) => void
    onActivity?: (activity: AgentActivity) => void
    onHistoryUpdate?: (history: HistoricalEvent[]) => void
}

export type Execute = (task: string, config: ExecuteConfig) => Promise<ExecutionResult>

AgentStatus

typescript
type AgentStatus = 'idle' | 'running' | 'completed' | 'error' | 'stopped'

AgentActivity

typescript
type AgentActivity =
    | { type: 'thinking' }
    | { type: 'executing'; tool: string; input: unknown }
    | { type: 'executed'; tool: string; input: unknown; output: string; duration: number }
    | { type: 'retrying'; attempt: number; maxAttempts: number }
    | { type: 'error'; message: string }

HistoricalEvent

typescript
type HistoricalEvent =
    | { type: 'step'; stepIndex: number; reflection: AgentReflection; action: Action }
    | { type: 'observation'; content: string }
    | { type: 'user_takeover' }
    | { type: 'retry'; message: string; attempt: number; maxAttempts: number }
    | { type: 'error'; message: string; rawResponse?: unknown }

ExecutionResult

typescript
interface ExecutionResult {
    success: boolean
    data: string
    history: HistoricalEvent[]
}

Usage Examples

Basic Execution

typescript
const result = await window.PAGE_AGENT_EXT!.execute(
    'Fill in the email field with [email protected] and click Submit',
    {
        baseURL: 'https://api.openai.com/v1',
        apiKey: process.env.OPENAI_API_KEY!,
        model: 'gpt-5.2',
        includeInitialTab: false, // Optional: exclude current tab
        onStatusChange: (status) => console.log(status),
        onActivity: (activity) => console.log(activity),
    }
)

Stop the Current Task

typescript
window.PAGE_AGENT_EXT!.stop()

Window Type Declaration

If you are not importing @page-agent/core, add:

typescript
import type { AgentActivity, AgentStatus, ExecutionResult, HistoricalEvent } from '@page-agent/core'

interface ExecuteConfig {
    baseURL: string
    model: string
    apiKey?: string

    systemInstruction?: string

    includeInitialTab?: boolean
    experimentalIncludeAllTabs?: boolean
    onStatusChange?: (status: AgentStatus) => void
    onActivity?: (activity: AgentActivity) => void
    onHistoryUpdate?: (history: HistoricalEvent[]) => void
}

declare global {
    interface Window {
        PAGE_AGENT_EXT_VERSION?: string
        PAGE_AGENT_EXT?: {
            version: string
            execute: Execute
            stop: () => void
        }
    }
}