Next.js is a popular framework for developing web-based applications in production. It powers Stagehand apps like Director, Brainrot and Open Operator.
main
function as a server action in app/stagehand/main.ts
. This file will have the following three functions:
main
: Run the main Stagehand scriptrunStagehand
: Initialize and run the main
functionstartBBSSession
: Start a Browserbase sessionmain
function with the server actions we just defined. We’ll first create a Browserbase session and embed the session in an iframe before running the main
function.
StagehandEmbed
componentStagehandEmbed
component in our app.