Page Agent is a JavaScript library that adds a natural-language agent to a web page from inside the page itself. You include one script or an npm import, and the agent can then carry out instructions such as "Click the login button" by reading and manipulating the DOM as text. It does not need a browser extension, a Python runtime, a headless browser, screenshots, or a multimodal model.
You instantiate PageAgent with a model name, an OpenAI-compatible baseURL, an API key, and a language, then call agent.execute(...) with a task. Most mainstream models work, including locally deployed ones. A demo build served from a CDN uses a free testing LLM API for evaluation only; adding ?autoInit=false loads the script without creating the demo agent so you can construct one with your own model.
Typical uses are shipping an in-product copilot for a SaaS app, reducing multi-click ERP, CRM, or admin workflows to one sentence, and making a web app operable by voice or screen-reader users through natural language. An optional Chrome extension extends tasks across browser tabs, and an MCP server in beta lets external agent clients drive the page. The DOM-processing components and prompt derive from browser-use, but the library is intended for client-side enhancement rather than server-side automation.
Features
- In-page integration: a single script tag or an npm package, with no backend changes
- Text-based DOM control: the agent reads and acts on the DOM as text, so no screenshots, vision models, or special permissions are required
- Bring your own model: works with OpenAI-compatible endpoints, including local deployments
- Programmatic API: new PageAgent({...}) and await agent.execute('...') for scripted tasks
- Chrome extension: optional extension for multi-page tasks across tabs
- MCP server (beta): lets MCP clients control the browser from outside the page
- Demo CDN build: a free testing LLM endpoint for evaluation, with an opt-out from auto-initialisation
- TypeScript: published as a typed package