Skip to content

Update the init template to use Stagehand - #42

Merged
akeimach merged 2 commits into
mainfrom
alyssamaruyama/ap-2918-swap-out-pw-for-stagehand-in-functions-quick-start
Sep 30, 2026
Merged

akeimach merged 2 commits into
mainfrom
alyssamaruyama/ap-2918-swap-out-pw-for-stagehand-in-functions-quick-start

Conversation

@akeimach

@akeimach akeimach commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

We can use Stagehand as our starter template now that we support secrets!

Testing:

  1. [in the sdk-functions-node repo] pnpm build && pnpm pack
  2. alias bb-dev="node $HOME/dev/sdk-functions-node/dist/cli.js" to create your local version of bb
  3. cd ~/dev && bb-dev init sdk-test && cd sdk-test. Check that index.ts is the inline Stagehand starter, that pnpm-workspace.yaml has only allowBuilds, that package.json has packageManager and no devEngines, and the printed instructions share how to upload the extension id
  4. cp ~/dev/sdk-functions-node/browserbasehq-sdk-functions-*.tgz . && pnpm add ./browserbasehq-sdk-functions-1.0.2.tgz. package.json should now show "@browserbasehq/sdk-functions": "file:browserbasehq-sdk-functions-1.0.2.tgz".
  5. browse cloud extensions upload node_modules/@browserbasehq/stagehand/dist/assets/stagehand-extension.zip,, then replace your-extension-id in index.ts
  6. Put your prod key in .env as BROWSERBASE_API_KEY=<your prod key> and also run export BROWSERBASE_API_KEY=<your prod key>
  7. browse cloud secrets create BROWSERBASE_API_KEY --env BROWSERBASE_API_KEY
  8. pnpm bb dev index.ts, then in a new terminal:
    curl -X POST http://127.0.0.1:14113/v1/functions/my-function/invoke -H 'Content-Type: application/json' --data '{}'
  9. pnpm bb publish index.ts
  10. browse functions secrets attach <functionId> <secretId>
  11. pnpm bb invoke <functionId> and make sure you get the same result as step 8.

@Kylejeong2 Kylejeong2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, i assume you tested locally

only note is to maybe use model gateway instead

@akeimach
akeimach merged commit 8467bdc into main Sep 30, 2026
6 checks passed
@akeimach
akeimach deleted the alyssamaruyama/ap-2918-swap-out-pw-for-stagehand-in-functions-quick-start branch September 30, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants