Skip to content

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

Open
imsahsol wants to merge 1 commit into
hyperbrowserai:mainfrom
imsahsol:feature/managed-sessions-and-keepAlive
Open

Feature: Allow passing managed client and session to HyperbrowserProvider#24
imsahsol wants to merge 1 commit into
hyperbrowserai:mainfrom
imsahsol:feature/managed-sessions-and-keepAlive

Conversation

@imsahsol

Copy link
Copy Markdown

Description

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

Example Usage

constclient: HyperbrowserClient=newHyperbrowser({apiKey: process.env.HYPERBROWSER_API_KEY,});constsession: SessionDetail=awaitclient.sessions.create({adblock: true,annoyances: true,enableWebRecording: false,proxyCountry: "US",proxyState: "CA",solveCaptchas: true,timeoutMinutes: 120,trackers: true,useProxy: true,useStealth: true,});constagent: HyperAgent=newHyperAgent({browserProvider: "Hyperbrowser",hyperbrowserConfig: {
client,
session,},});

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

constagent: HyperAgent=newHyperAgent({browserProvider: "Hyperbrowser",hyperbrowserConfig: {// Other optionskeepBrowserOpen: 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 freeto 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

@imsahsol