Browser-Use agents run asynchronously by default. Start a task, then poll for results. Our SDKs include a 
startAndWait() helper that handles polling automatically and returns when the task completes.How It Works
You can use Browser-Use in two ways:- Start and Wait: SDKs provide a startAndWait()method that blocks until the task completes and returns the result
- Async Pattern: Start a task, get a job ID, then poll for status and results—useful for long-running tasks or when you want more control
Installation
Quick Start
The simplest way to run a Browser-Use task is withstartAndWait(), which handles the entire lifecycle for you:
Async Pattern
When you need more control, use the async pattern to start a task and poll for results:Stop a Running Task
Stop a task before it completes:Parameters
Natural language description of what the agent should accomplish.
Language model to use. Options: 
gpt-4o, gpt-4o-mini, gpt-4.1, gpt-4.1-mini, claude-sonnet-4-5, claude-sonnet-4-20250514, claude-3-7-sonnet-20250219, claude-3-5-sonnet-20241022, claude-3-5-haiku-20241022, gemini-2.0-flash, gemini-2.5-flashMaximum number of steps the agent can take. Increase if tasks aren’t able to complete within the given number of steps.
ID of an existing browser session to reuse. Useful for multi-step workflows that need to maintain the same browser session.
Enable screenshot analysis for better context understanding.
Validate agent output against a schema.
Provide screenshots to the planning component.
Maximum actions per step before reassessing.
Maximum tokens for LLM input.
Separate language model for planning (can be different from main LLM).
Separate language model for extracting structured data from pages.
How often (in steps) the planner reassesses strategy.
Maximum consecutive failures before aborting the task.
List of actions to execute before starting the main task.
Key-value pairs to mask the data sent to the LLM. The LLM only sees placeholders (x_user, x_pass), browser-use filters your sensitive data from the input text. Real values are injected directly into form fields after the LLM call.
Valid JSON schema for structured output.
Keep session alive after task completes.
Session configuration (proxy, stealth, captcha solving, etc.). Only applies when creating a new session. If you provide an existing 
sessionId, these options are ignored.Use your own LLM API keys instead of Hyperbrowser’s. You will only be charged for browser usage.
API keys for 
openai, anthropic, and google. Required when useCustomApiKeys is true. Must provide keys based on the LLMs you are using.The agent may not complete the task within the specified 
maxSteps. If that happens, try increasing the maxSteps parameter.Additionally, the browser session used by the AI Agent will time out based on your team’s default Session Timeout settings or the session’s timeoutMinutes parameter if provided. You can adjust the default Session Timeout in the Settings page.Reuse Browser Sessions
You can pass in an existingsessionId to the Browser Use task so that it can execute the task on an existing session. Also, if you want to keep the session open after executing the task, you can supply the keepBrowserOpen parameter.
Always set 
keepBrowserOpen: true on tasks that you want to reuse the session from. Otherwise, the session will be automatically closed when the task completes.Use Your Own API Keys
You can provide your own API Keys to the Browser Use task so that it doesn’t charge credits to your Hyperbrowser account for the steps it takes during execution. Only the credits for the usage of the browser itself will be charged. Depending on which model you select for thellm, plannerLlm, and pageExtractionLlm parameters, the API keys from those providers will need to be provided when useCustomApiKeys is set to true.
Session Configuration
Configure the browser environment with proxies, stealth mode, CAPTCHA solving, and more:sessionOptions only apply when creating a new session. If you provide an existing sessionId, these options are ignored.Proxies and CAPTCHA solving add latency. Only enable them when necessary for your use case.