Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A Next.js starter for building AI browser agents with the Stagehand SDK, Browserbase sessions, and the Browserbase Model Gateway.

A free Next.js, Tailwind CSS and React Intl dashboard starter with internationalized routing and a Localizely translation workflow.
Stagehand Next.js Quickstart is a Next.js starter project from Browserbase for building AI browser agents with the Stagehand SDK (version 4.1.0), scaffoldable with the single command npx create-browser-app.
It is a Next.js application template that wires the Stagehand browser-automation SDK into a working web agent demo. You supply two credentials — BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID — and the project launches a browser either through browserbase.launch() for cloud sessions or localBrowser.launch() for a local browser, then runs AI operations via Stagehand.create(). Its output is a running Next.js app whose demo navigates to https://docs.stagehand.dev/, extracts content with Zod v4 schemas, and follows the quickstart link on that page. The template is published by Browserbase, the company behind Stagehand and the Browserbase browser platform, and it can be deployed directly to Vercel.
browserbase.launch() or localBrowser.launch(), and AI operations with Stagehand.create().BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID are required; no separate OpenAI key is needed./api/stagehand POST route streams the session ID and debugger URL to the page while the demo runs, then closes both Stagehand and the browser when the run finishes or fails.data from extract() and observe() is schema-validated.model object with a supported provider-prefixed modelName in stagehand.config.ts.browserConfig.env to "BROWSERBASE" in stagehand.config.ts moves the demo from a local browser to Browserbase cloud browsers.pnpm typecheck, pnpm lint, pnpm test, and pnpm build are the validation scripts, and the tests mock Browserbase to cover locator fallback, failed actions, session streaming, and browser cleanup, including client disconnection.extract(), and consume validated JSON from the /api/stagehand route.browserConfig.env to "BROWSERBASE" and route sessions through Browserbase browsers using your project credentials..example.env to .env and add BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID.pnpm install && pnpm dev to start the app.browserConfig.env to "BROWSERBASE" and define a model object in stagehand.config.ts./api/stagehand; the route streams the session ID and debugger URL while the demo runs against https://docs.stagehand.dev/.You need BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID, stored in a .env file copied from .example.env. Because the project uses the Browserbase Model Gateway, a separate OpenAI API key is not required.
Yes. Browser creation goes through either browserbase.launch() or localBrowser.launch(), and setting browserConfig.env to "BROWSERBASE" in stagehand.config.ts switches the demo to Browserbase sessions.
The Model Gateway chooses the model automatically. To pin one, add a model object with a supported provider-prefixed modelName to stagehand.config.ts; the gateway authenticates with your Browserbase API key.
The demo navigates to https://docs.stagehand.dev/, uses Zod v4 schemas and the data returned by extract() and observe(), and follows the quickstart link on that documentation page.
The regression suite mocks Browserbase and covers locator fallback, failed actions, session streaming, and browser cleanup — including cleanup when the client disconnects. Validation runs through pnpm typecheck, pnpm lint, pnpm test, and pnpm build.
