Skip to content
Agent Stack
  • AI SDK
  • AI Gateway
  • Sandbox
  • Passport
  • Connect
  • eve
Core Platform
  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • Workflows
  • CI/CD
Tools
  • Next.js
  • Edgenivo Agent
  • Edgenivo Plugin
  • Open Source
  • Domains↗
  • v0↗
Learn
  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base
Build
  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
Explore
  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community↗
EnterprisePricing
Contact
Log InSign Up
Dashboard

Products
Agent Stack
  • AI SDK
  • AI Gateway
  • Sandbox
  • Passport
  • Connect
  • eve
Core Platform
  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • Workflows
  • CI/CD
Tools
  • Next.js
  • Edgenivo Agent
  • Edgenivo Plugin
  • Open Source
  • Domains↗
  • v0↗
Resources
Learn
  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base
Build
  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
Explore
  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community↗
Enterprise
Pricing
Sign UpLog In
Contact
Templates
Template name

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • ConnectNew
  • PassportNew
  • eveNew

Core Platform

  • CI/CD
  • Content Delivery
  • Fluid Compute
  • Observability

Security

  • Platform Security
  • WAF
  • Bot Management
  • BotID

Tools

  • Edgenivo Drop
  • Edgenivo Agent
  • Edgenivo Plugin
  • Agent Skills
  • Domains
  • v0

Frameworks

  • eveNew
  • Next.js
  • Nuxt
  • SvelteKit
  • Nitro
  • Turborepo
  • Tanstack Start
  • FastAPI
  • All frameworks

SDKs

  • Edgenivo SDK
  • Workflow SDK
  • Flags SDK
  • Chat SDK
  • Queues SDK
  • Streamdown

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
  • Platform Engineers
  • Design Engineers

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Articles
  • Community
  • Is Agentic

Explore

  • Customers
  • Marketplace
  • Templates
  • Partner Finder
  • Edgenivo + AWS

Company

  • About
  • Careers
  • Press
  • Events
  • Startups
  • Shipped on Edgenivo
  • Open Source Program
  • Enterprise
  • Pricing
  • Help

Legal & Trust

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DPA
  • Acceptable Use Policy
  • Legal (all documents)
  • Trust Center
  • Status
  • EdgenivoEdgenivo
Templates
Template name

Status service pending confirmation

Select a display theme:
Templates

Stagehand + Next.js Quickstart

Stagehand extends the power of Playwright, allowing you to reliably automate browsers in natural language.

DeployView Demo
This is an auto-uploaded thumbnail from /templates/submit.
Owner
  • browserbase
Repository
  • stagehand-nextjs-quickstart
Use Cases
  • AI
Stack
  • Next.js
  • Tailwind
DeployView Demo

🤘 Welcome to Stagehand Next.js!

Hey! This is a Next.js project built with Stagehand.

You can build your own web agent using: npx create-browser-app!

Setting the Stage

Stagehand is an SDK for automating browsers. This quickstart uses Stagehand 4.1.0, with browser creation through browserbase.launch() or localBrowser.launch() and AI operations through Stagehand.create().

Curtain Call

Get ready for a show-stopping development experience. Just run:

pnpm install && pnpm dev

What's Next?

Add your API keys

This project uses Browserbase Model Gateway. Set BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID; no separate OpenAI key is required.

cp .example.env .env # Add your API keys to .env

Custom .cursorrules

We have custom .cursorrules for this project. It'll help quite a bit with writing Stagehand easily.

Run on Browserbase

To run on Browserbase, add your API keys to .env and set browserConfig.env to "BROWSERBASE" in stagehand.config.ts.

Choose a model

By default, Model Gateway chooses the model. To select one explicitly, add a model object with a supported provider-prefixed modelName to stagehand.config.ts. Model Gateway uses your Browserbase API key.

Live demo lifecycle

The /api/stagehand POST route streams the session ID and debugger URL to the page while the demo runs. It creates the browser with the Stagehand v4 extension, uses Zod v4 schemas and the data returned by extract() and observe(), and closes both Stagehand and the browser when finished or when a run fails.

Validation

Run pnpm typecheck, pnpm lint, pnpm test, and pnpm build. The regression tests mock Browserbase and cover locator fallback, failed actions, session streaming, and browser cleanup, including client disconnection.

The demo navigates to https://docs.stagehand.dev/ to extract and follow its quickstart link.

Related Templates

  • Bot Detection with Botd thumbnail

    Bot Detection with Botd

    Botd is a browser library for bot detection. In this template we'll be using it alongside botd-integrations for bot detection at the edge.

  • AgentGPT - AI Agents with Langchain & OpenAI thumbnail

    AgentGPT - AI Agents with Langchain & OpenAI

    Assemble, configure, and deploy autonomous AI Agents in your browser, using Langchain, OpenAI, AutoGPT and T3 Stack.

  • Chatbot UI thumbnail

    Chatbot UI

    A ChatGPT clone for running locally in your browser.