Skip to content

Add the official Stagehand run contract to Browsie - #32

Open
shubh24 wants to merge 5 commits into
mainfrom
shubh24/browsie-stagehand-run-contract
Open

shubh24 wants to merge 5 commits into
mainfrom
shubh24/browsie-stagehand-run-contract

Conversation

@shubh24

@shubh24 shubh24 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Add the official Stagehand v4 agent-framework run contract to Browsie.

  • Accept exactly one of model-authored code or snapshot-ID actions.
  • Support the official action shape: op + id for click, hover, fill, type, press, and select.
  • Execute code in Stagehand's browser-extension callback batch with Playwright-shaped page, context, and browser objects.
  • Preserve Browsie's persistent browser, Browserbase Context, CAPTCHA wait, cancellation, recovery, and Live View lifecycle.
  • Show the executed code or actions in the workbench activity feed with credential-oriented redaction.
  • Track snapshot URL and page identity so stale IDs cannot run after navigation or tab changes.

Design and security

The Playwright compatibility runtime is vendored from browserbase/stagehand commit da27625712448f3eaab47e697c2e69665109bd37, which matches the installed Stagehand 4.0.2 package. The source and license notice is in projects/browsie/THIRD_PARTY_NOTICES.md.

The model-authored JavaScript is converted to a callback in the Node process, but Stagehand executes that callback inside its browser extension service worker. It does not execute in Eve or Next.js. The code can access all data in the current browser session, so Browserbase remains the isolation boundary.

Validation

  • pnpm test — 89 passed, 8 skipped
  • pnpm typecheck
  • pnpm lint — passed with existing warnings
  • pnpm build
  • python3 scripts/catalog.py check
  • python3 scripts/authored_manifest.py check
  • python3 scripts/verify.py
  • python3 -B -m unittest discover -s tests
  • npx --yes prettier@3.9.6 --check . --ignore-unknown

The opt-in local Chrome smoke test was attempted, but Chrome did not expose its dynamic debugging port in this environment. No paid Browserbase live test was run.

Publication and provenance

  • No credentials, cookies, session URLs, customer data, or generated runtime output are included.
  • Vendored Stagehand source revision and license are documented.
  • Cookbook-authored provenance and generated catalog data are current.

@shubh24
shubh24 requested review from a team as code owners October 9, 2026 20:30
@shubh24
shubh24 requested a review from Kylejeong2 October 9, 2026 22:14
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.

1 participant