LogoLogo
SupportDashboard
  • Community
  • Welcome to Hyperbrowser
  • Get Started
    • Quickstart
      • AI Agents
        • Browser Use
        • Claude Computer Use
        • OpenAI CUA
      • Web Scraping
        • Scrape
        • Crawl
        • Extract
      • Browser Automation
        • Puppeteer
        • Playwright
        • Selenium
  • Agents
    • Browser Use
    • Claude Computer Use
    • OpenAI CUA
  • HyperAgent
    • About HyperAgent
      • HyperAgent SDK
      • HyperAgent Types
  • Quickstart
  • Multi-Page actions
  • Custom Actions
  • MCP Support
    • Tutorial
  • Examples
    • Custom Actions
    • LLM support
    • Cloud Support
      • Setting Up
      • Proxies
      • Profiles
    • MCP Examples
      • Google Sheets
      • Weather
        • Weather Server
    • Output to Schema
  • Web Scraping
    • Scrape
    • Crawl
    • Extract
  • Sessions
    • Overview
      • Session Parameters
    • Advanced Privacy & Anti-Detection
      • Stealth Mode
      • Proxies
      • Static IPs
      • CAPTCHA Solving
      • Ad Blocking
    • Profiles
    • Recordings
    • Live View
    • Extensions
    • Downloads
  • Guides
    • Model Context Protocol
    • Scraping
    • AI Function Calling
    • Extract Information with an LLM
    • Using Hyperbrowser Session
    • CAPTCHA Solving
  • Integrations
    • ⛓️LangChain
    • 🦙LlamaIndex
  • reference
    • Pricing
    • SDKs
      • Node
        • Sessions
        • Profiles
        • Scrape
        • Crawl
        • Extensions
      • Python
        • Sessions
        • Profiles
        • Scrape
        • Crawl
        • Extensions
    • API Reference
      • Sessions
      • Scrape
      • Crawl
      • Extract
      • Agents
        • Browser Use
        • Claude Computer Use
        • OpenAI CUA
      • Profiles
      • Extensions
Powered by GitBook
On this page
Export as PDF

Multi-Page actions

PreviousQuickstartNextCustom Actions

Last updated 1 month ago

HyperAgent is built around playwright, and offers a natural way to extend the functionality of playwright to also perform tasks like an independent web-agent.

This can be done simply by using the .ai() method available on all page objects.

Here is a simple example showing how to do this:

const agent = new HyperAgent();

const page1 = await agent.newPage();
const page2 = await agent.newPage();

// Execute tasks on specific pages
const page1Response = await page1.ai(
  "Go to google.com/travel/explore and set the starting ___location to New York. Then, return to me the first recommended destination that shows up. Return to me only the name of the ___location."
);
const page2Response = await page2.ai(
  `I want to plan a trip to ${page1Response.output}. Recommend me places to visit there.`
);

console.log(page2Response.output);

Each page can act as a separate web-agent by itself.

All page.ai calls can take in two parameters:

  • task : A string describing the task to be completed on this page

  • params (Optional): An object containing the parameters of the task. A list of accepted parameters can be found in the

Extracting info from a page

HyperAgent also offers a quick method of extracting information from a page using the .extract() method

const agent = new HyperAgent();

const page = await agent.newPage();

// Execute tasks on specific pages
await page.goto("https://en.wikipedia.org/wiki/2014_FIFA_World_Cup");
const pageResponse = await page.extract("Tell me the countries that participated in the 2014 FIFA world cup");

console.log(pageResponse);

All page.extract calls can take in two parameters:

  • task: A string describing what needs to be extracted from the current page

  • outputSchema (optional): A zod object describing the schema of the output expected.

HyperAgent Types page