Skip to content

Feature: Allow passing managed client and session to HyperbrowserProvider #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

imsahsol
Copy link

Description

This update allows users to manage their own Hyperbrowser session and client separately if needed.

Example Usage

const client: HyperbrowserClient = new Hyperbrowser({
  apiKey: process.env.HYPERBROWSER_API_KEY,
});

const session: SessionDetail = await client.sessions.create({
  adblock: true,
  annoyances: true,
  enableWebRecording: false,
  proxyCountry: "US",
  proxyState: "CA",
  solveCaptchas: true,
  timeoutMinutes: 120,
  trackers: true,
  useProxy: true,
  useStealth: true,
});

const agent: HyperAgent = new HyperAgent({
  browserProvider: "Hyperbrowser",
  hyperbrowserConfig: {
    client,
    session,
  },
});

Additionally, users can pass the keepBrowserOpen option as true to attempt keeping the browser session alive:

const agent: HyperAgent = new HyperAgent({
  browserProvider: "Hyperbrowser",
  hyperbrowserConfig: {
    // Other options
    keepBrowserOpen: true,
  },
});

⚠️ Note: Even if keepBrowserOpen is set to true, the browser context will still be destroyed if the terminal running your agent process receives a SIGINT signal (e.g., when you manually stop the process with Ctrl+C).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant