By the end of this guide you will have a working browser automation agent: a program that opens a real browser, follows a task you describe in plain language, and returns structured results you can use in your own code. The pieces are an automation framework that drives the browser, a language model that decides what to do on each page, and optionally a cloud browser service that runs the sessions for you.
Choosing the right mix is the main job in AI browser automation, because the tools in our Developer platforms category cover different layers. This guide explains the layers, walks through the build in order, and compares seven tools from the directory.
Key takeaways
- A browser agent has three parts: a browser (local or cloud), a driver such as Playwright, and a model that turns instructions into actions. Decide which of the three you need to buy and which you already have.
- Start locally with a code-first framework, then move to a cloud browser service when you need concurrency, saved logins, proxies or CAPTCHA handling.
- Cloud browser limits matter: Browser Use caps a single session at 4 hours and runs Chromium only, and Browserbase's Free plan has 15-minute sessions.
- Agents act on real accounts. Test on non-critical accounts first, and keep a person in the loop for payments, deletions and anything legal or financial.
What you need before you start
- A target task. One concrete workflow, such as filling a form or pulling a table from a logged-in portal. Do not start with "automate everything".
- A development environment. Node.js or Python, depending on the tool. Playwright lists TypeScript and JavaScript, Python, .NET and Java. Stagehand lists TypeScript, Python and Go.
- A model API key. Stagehand works with OpenAI, Anthropic and Google models. Check each tool's listing for the model providers it supports.
- Permission. You need the right to automate the site and to use any account you log in with. Read the site's terms first.
- Time. A first working script takes under an hour. A dependable agent with retries and logging takes longer.
- Difficulty. Moderate. Every tool here expects you to write some code.
Which kind of AI tool fits this job
Think in layers and pick one tool for each layer you need.
A browser framework you control. Playwright is Microsoft's open-source framework that drives Chromium, Firefox and WebKit from one API, in headless or headed mode. It has auto-waiting, a test generator that records actions into code, and a Trace Viewer for debugging. It does not decide what to click by itself, so you pair it with a model or an agent layer.
An agent SDK that adds natural-language steps. Stagehand is an open-source SDK that mixes ordinary code with three calls: act performs an action, extract pulls structured data against a schema, and observe inspects what can be done. The open-source Browser Use agent, maintained by the same company as its cloud product, completes web tasks from a prompt.
A cloud browser service. When you need many sessions or login persistence, a hosted browser saves you from running fleets yourself. Browserbase runs headless browsers you can drive from Playwright, Puppeteer, Selenium or Stagehand. Hyperbrowser offers hosted Chrome sessions, saved logins and session recordings. Steel Browser has a Sessions API and is also free and open source if you prefer to self-host.
An MCP server for coding agents. Playwright MCP lets an MCP client such as VS Code, Cursor or Claude Code operate a browser through accessibility snapshots instead of screenshots, so no vision model is needed. Its listing names exploratory automation, self-healing tests and long-running workflows where browser state persists as good fits.
Step 1: Define the task and the success check
You end this step with a one-paragraph spec the agent can be measured against.
- Write the starting page, the actions required and the data you want back.
- Decide the output shape, for example a list of records with named fields.
- List what must never happen, such as submitting an order or deleting data.
- Decide how you will know a run succeeded, such as a record count or a visible confirmation message.
Check it worked by handing the spec to a colleague and asking whether they could do the task by hand without questions.
Step 2: Pick your browser and driver
Choose where the browser runs and what controls it.
- For a first prototype, run a browser on your own machine through Playwright, which downloads browser binaries on install.
- If you want an agent to explore a site for you inside your editor, try Playwright MCP, which needs Node.js 18 or newer.
- If you will need Firefox or WebKit, note that Browser Use's cloud browsers are Chromium only.
- If you use Selenium, note that Browser Use's listing says Selenium cannot attach to its sessions, while Browserbase and Steel Browser list Selenium support. Check the exact driver list before you commit.
Check it worked by launching a browser from a five-line script and loading a page.
Step 3: Add an agent layer
This step turns fixed scripts into steps written in plain language.
- Install an agent SDK such as Stagehand, which is installed with npm and is listed as MIT-licensed.
- Set your model key as an environment variable, not in source code.
- Replace brittle selectors with natural-language calls where pages change often, and keep ordinary code for stable steps.
- Use extract with a schema so results come back as typed data rather than free text.
Check it worked by running one act call and one extract call on a public page and reading the returned data.
Step 4: Move to a cloud browser when you need scale
A local browser is fine for a prototype. Hosted browsers matter when you need parallel sessions, saved logins or proxies.
- Compare plans against your workload. Browserbase's Free plan includes 3 concurrent browsers, 1 browser hour and 15-minute sessions. Steel Browser's Launch plan allows 10 concurrent sessions and 15-minute sessions.
- Create a session through the vendor's API and connect your driver to it. Browser Use lists Chrome DevTools Protocol access for Playwright, Puppeteer and Stagehand.
- Turn on persistent profiles if the task needs a login that survives between runs. Hyperbrowser, Steel Browser and Browser Use all list saved browser profiles or logins.
- Use the live view or recordings to watch what the agent does. Browser Use, Hyperbrowser and Steel Browser list live session viewing.
Check it worked by running the same script against the cloud session and confirming it returns the same data as the local run.
Step 5: Handle logins, CAPTCHAs and bot protection carefully
Many sites are built to block automated traffic, and the rules differ by site.
- Prefer an official API where one exists.
- Store credentials in a secrets manager rather than in prompts. Browser Use lists a 1Password integration; check each listing for how other services handle credentials.
- Know what your plan includes. Hyperbrowser lists proxy usage and CAPTCHA solving as paid-plan features, and Steel Browser's Launch plan needs a $10 paid deposit to verify the account before CAPTCHA solving and its proxies.
- Respect the target site's terms and rate limits.
Check it worked by running the flow with a throwaway account and confirming login state survives a second session.
Step 6: Add limits, retries and logging
An agent that can click anything needs guardrails.
- Set a maximum number of steps per run and a timeout per page.
- Restrict which sites the browser may visit. Playwright MCP lists allowed and blocked origin options.
- Stop sessions explicitly in your code. Browser Use's listing warns that closing a CDP connection does not stop billing.
- Log every action and keep recordings or traces so you can see why a run failed. Playwright's Trace Viewer records DOM snapshots, network requests and console logs.
- Require human approval for irreversible actions.
Check it worked by forcing a failure, such as a wrong password, and confirming the run stops cleanly and the session closes.
Step 7: Test and schedule the agent
Run the agent on realistic data before you trust it.
- Run it ten times on the same task and compare outputs against your success check from Step 1.
- Spot-check extracted data against the live page. Models can misread tables and mix up similar fields.
- Schedule runs with your own job runner or workflow tool once results are consistent.
- Review failures weekly, since sites change layouts without notice.
Check it worked by confirming scheduled runs produce the same record count as a manual run.
Tools for this job compared
| Tool | Good fit for | Pricing | Stated limits |
|---|---|---|---|
| Playwright | Driving Chromium, Firefox and WebKit from code | Open source | No hosted plan listed; browser binaries are downloaded and updated with the framework |
| Stagehand | Natural-language act, extract and observe calls in code | Open source | Requires code; Model Gateway and caching need Browserbase-hosted browsers |
| Browser Use | Cloud Chromium sessions and hosted web agents via API, web and CLI | Paid, from $0.02, usage-based (checked 24 Oct 2026) | Chromium only; sessions last at most 4 hours; closing a CDP connection does not stop billing |
| Browserbase | Cloud headless browsers over the web and API | Freemium, paid from $20/mo (checked 24 Oct 2026) | Free plan: 3 concurrent browsers, 1 browser hour, 15-minute sessions; HIPAA, DPA and SSO on Scale only |
| Hyperbrowser | Hosted Chrome sessions for Playwright or Puppeteer, via API, CLI and Python SDK | Freemium, paid from $30/mo (checked 24 Oct 2026) | Free plan: 1 concurrent session, 7 days of data retention; proxies and CAPTCHA solving are paid |
| Steel Browser | Cloud sessions or self-hosting, via API and web | Freemium, paid from $250/mo (checked 24 Oct 2026) | Launch: 10 concurrent sessions, 15-minute sessions; self-hosting means you maintain it |
| Playwright MCP | Letting a coding agent operate a browser over MCP | Open source | Needs Node.js 18 or newer; accessibility trees add to context size |
Prices and plan limits change, so confirm the current terms on each vendor's site before you build around them.
Common mistakes to avoid
- Automating before you define success. Without a clear check, an agent can report success while returning wrong data. Fix it by writing the success check first (Step 1) and testing against it.
- Leaving sessions running. Cloud browsers bill by time, and Browser Use warns that closing the connection does not stop billing. Fix it by stopping sessions explicitly in a finally block or equivalent.
- Ignoring driver compatibility. Not every cloud browser works with every driver: Browser Use is Chromium only and cannot take Selenium. Fix it by checking the driver and browser support in the listing before you write code.
- Putting secrets in prompts. Prompts can be logged or shown to a model provider. Fix it by keeping credentials in a secrets store and using saved profiles where the service offers them.
- Giving the agent unchecked power. An agent with a logged-in browser can submit forms or delete records. Fix it by limiting allowed sites, capping steps and requiring approval for irreversible actions.
How we put this together
This is an evidence-based guide built from each tool's listing in our directory, which is compiled from the vendor's own site and pricing page. It is not a review based on using the tools. We don't rank tools, and nobody paid to be included. Some outbound links may be affiliate links; see our disclosure.
Frequently asked questions
Is there a free way to build a browser automation agent?
Yes. Playwright, Stagehand and Playwright MCP are open source, and the vendors list no paid plans for Playwright or Playwright MCP. Browserbase has a Free plan, Hyperbrowser has a Free plan, and Steel Browser has a Launch plan with one-time credits. Free cloud plans are small, so expect to hit concurrency or session-length limits.
Do I need to know how to code?
Yes, for the tools in this guide. Stagehand's listing says it requires writing code, and Playwright is a framework for developers. If you want a no-code agent, see our guide on building an AI agent without code.
Can AI browser automation be reliable enough for production?
It can handle repeatable tasks, but pages change and models misread them, so build in checks. Use traces or recordings, limit the agent's steps, and keep a person in the loop for anything financial, legal or irreversible. Tools such as Playwright also help by waiting for elements automatically.
Should I run the browser locally or in the cloud?
Run locally while you prototype, because it is simpler and costs nothing beyond your model usage. Move to a cloud service when you need parallel sessions, saved logins, proxies or recordings. The cloud services above state concurrency and session limits by plan, so compare them against your workload.
Can I keep my data private?
You can keep the browser on your own machine with Playwright or a self-hosted Steel Browser, though page content you send to a model still goes to that provider. Cloud browsers run on vendor infrastructure, so read each vendor's data terms. Browserbase lists SOC 2 coverage on every plan.
Compare more options in our Developer platforms category.