Skip to content

Consolidate Stagehand examples into a flat catalog and link skills - #2934

Draft
shrey150 wants to merge 5 commits into
mainfrom
consolidate/examples-and-skills
Draft

shrey150 wants to merge 5 commits into
mainfrom
consolidate/examples-and-skills

Conversation

@shrey150

@shrey150 shrey150 commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

why

Stagehand examples are spread across templates, playbooks, integrations, and demo projects. This change gives developers a flat catalog under packages/examples, with one directory per example and language variants inside it. Existing framework integrations remain the canonical starting points for frameworks already covered in packages/integrations.

what changed

  • Add 42 top-level example directories, containing 66 retained imported entries: 48 TypeScript/Python template variants, 5 playbook entries, 6 integration example entries, and 7 demos. The 24 paired templates each get a README linking their TypeScript and Python variants.
  • Keep source provenance in the catalog. There are no templates/, integrations/, playbook/, or demos/ category directories under packages/examples.
  • Omit the older CrewAI, DeepAgents, and Mastra imports; link to their existing implementations/examples in packages/integrations. That directory's implementation files are unchanged. The remaining imported integration examples demonstrate additional workflows or adapters.
  • Keep examples self-contained, using published package dependencies outside the root pnpm workspace. This relocation preserves existing SDK generations; migration of older examples to v4 is a separate follow-up.
  • Update directory references, README links, and quickstart cd commands. Preserve the imported license notice at packages/examples/LICENSE.
  • Add explicit standalone lint configuration and exclude independent examples from the SDK's type-aware lint. Use the stable stagehand-demo-kit package name to satisfy the existing retired-package-identity check.
  • Add packages/skills/README.md linking to the external Browserbase skill collections; the browse.sh catalog is tracked separately in browserbase/skills#158.

The selection excludes customer-specific workflows, saved account/browser state, private research, and captured output. Synthetic/demo values remain where documented. Existing source repositories remain unchanged.

resulting layout

packages/
├── integrations/               # Existing implementations and examples
│   ├── crewai/
│   ├── deepagents/
│   └── mastra/
├── examples/                   # 42 directories at this level
│   ├── basic-caching/
│   │   ├── README.md
│   │   ├── typescript/
│   │   └── python/
│   ├── amazon-product-scraping/
│   ├── alaska-flights/
│   ├── mongodb/
│   ├── temporal/
│   ├── qa-agent/
│   └── ...
└── skills/
    └── README.md

validation

Validated the flattened tree:

  • All 42 catalog directories, 66 retained entries, 152 relative documentation links, and 46 repository-relative cd commands resolve. Retained source/configuration files match the audited imports byte-for-byte, except the demo-kit package name; documentation was updated for the layout.
  • Root pnpm lint, standalone example lint, formatting, and Git whitespace checks pass. Lint retains inherited warnings.
  • Parsed 101 JavaScript/TypeScript, 27 Python, 56 JSON, and 24 TOML files.
  • npm run check in packages/examples/v4-demo-kit passes entry-point syntax checks and all 4 tests.
  • The root unit run passes 98 tests, including the retired-package-identity check. Two SDK-related suites cannot load locally because this linked worktree lacks the SDK package's zod/v4 dependency resolution. CI must verify those suites in a clean installation.
  • A fresh, redacted Gitleaks scan of the exact tracked example snapshot reports zero findings.

Individual example typechecks and complete live browser/service workflows have not all been run. This PR consolidates the source collection and does not certify every integration or migrate every example to v4.

example inventory and customer-PII confidence

Assessment refreshed 2026-09-15, for PR head 5f4478a0c66c1fe76514340c6914016f7b054212. These are 66 retained imported entries in 42 example directories; TypeScript/Python template variants appear separately. MongoDB and 1Password each retain multiple runtimes within one entry.

The percentages are my subjective confidence that the committed files contain no hard-coded real customer PII, customer credentials/account identifiers, private customer tenant URLs, or private customer-specific workflows. They are coarse reviewer judgments, not calibrated statistical probabilities or a security certification. Public websites, public support contacts, synthetic names, reserved-domain emails, and illustrative/test values are not classified as customer PII. No entry is assigned 100%.

  • 99%: straightforward public/reserved-domain example with no customer-specific material identified.
  • 95%: no customer-specific material identified, with more uncertainty from authentication, file/data handling, larger code/configuration, or prior sanitization.
  • 90%: no customer-specific material identified, but hosted-demo provenance, excluded research/output, or a larger multi-project surface warrants an additional human pass before merge approval.

Scores carry forward the earlier source-selection/manual audit, with renewed checks of the retained file inventory, relocated links, source hashes, and secrets. Secret scanning cannot detect every form of PII. No actual customer secret or private customer record was identified in the selected files.

Scope: the current imported file snapshot, excluding repository history, third-party dependencies, live websites, remotely fetched assets, and runtime logs/results. Both context variants extract the authenticated user's name and address when run; MFA/context/1Password/booking flows use runtime credentials or account state. These scores do not measure runtime privacy or functional correctness. The existing CrewAI, DeepAgents, and Mastra implementations linked from the catalog, and the external skills collection, are outside this imported-file assessment.

Example under packages/examples Confidence: no embedded customer PII Basis / remaining uncertainty
1password-extension 95% Runtime credentials and extension identifiers; extension archive/account state excluded. Auth-sensitive workflow.
agentkit 95% Generic Stagehand tools and runtime tasks; no private customer target or fixture found.
alaska-flights 99% Public fare search with runtime dates; no passenger records or booking fixture.
amazon-global-price-comparison/python 99% Public storefronts and product queries; no account or customer records bundled.
amazon-global-price-comparison/typescript 99% Public storefronts and product queries; no account or customer records bundled.
amazon-product-scraping/python 99% Public product search; no customer profile or saved results bundled.
amazon-product-scraping/typescript 99% Public product search; no customer profile or saved results bundled.
basic-caching/python 99% Small example.com demonstration; no customer target or account fixture.
basic-caching/typescript 99% Small example.com demonstration; no customer target or account fixture.
basic-recaptcha/python 99% Public reCAPTCHA demonstration; no customer account fixture.
basic-recaptcha/typescript 99% Public reCAPTCHA demonstration; no customer account fixture.
box 95% Public regulatory/product documents; Box account and destination are runtime configuration.
browserbase-reducto/python 95% Public Apple documents and environment-supplied keys; broader download/parser surface.
browserbase-reducto/typescript 95% Public Apple documents and environment-supplied keys; broader download/parser surface.
caching-with-variables 95% Public test login and synthetic reserved-domain emails; illustrative password remains in documentation, with no customer account binding.
company-news-function 95% Public news search with company supplied at runtime; no customer research results bundled.
company-value-prop-generator/python 99% Configurable public-company input; no private tenant or customer dataset found.
company-value-prop-generator/typescript 99% Configurable public-company input; no private tenant or customer dataset found.
configurable-browser-trial 90% Public/demo targets and reserved portal placeholder; local agent material excluded. Larger configurable runner with no customer target list bundled.
context/python 95% Credentials and context IDs are runtime inputs; no profile bundled. Both variants extract a real user name/address when run.
context/typescript 95% Credentials and context IDs are runtime inputs; no profile bundled. Both variants extract a real user name/address when run.
convex 95% Generic Stagehand actions and public sample URLs; deployment/account configuration supplied at runtime.
council-events/python 99% Public council calendar extraction; no captured personal records bundled.
council-events/typescript 99% Public council calendar extraction; no captured personal records bundled.
docs-search 99% Public Stagehand documentation search; no customer data source.
download-financial-statements/python 99% Public Apple financial documents; no private financial records bundled.
download-financial-statements/typescript 99% Public Apple financial documents; no private financial records bundled.
extend-browserbase/python 90% Demo expense-portal workflow; no receipts bundled. Hosted demo/data provenance is less independently established than a reserved-domain example.
extend-browserbase/typescript 90% Demo expense-portal workflow; no receipts bundled. Hosted demo/data provenance is less independently established than a reserved-domain example.
form-filling/python 95% Explicitly synthetic person/company, reserved-domain email; targets Browserbase contact form with submission disabled.
form-filling/typescript 95% Explicitly synthetic person/company, reserved-domain email; targets Browserbase contact form with submission disabled.
gift-finder/python 95% Public retail search with sample recipient preferences; no identified customer or account found.
gift-finder/typescript 95% Public retail search with sample recipient preferences; no identified customer or account found.
google-trends/python 99% Public trends with country/language inputs; no customer dataset.
google-trends/typescript 99% Public trends with country/language inputs; no customer dataset.
hacker-news 99% Small public-headline extraction example; no user/account fixture.
hacker-news-intelligence 90% Public Hacker News research; captured reports excluded. Larger demo with generated-output paths.
image-url-download/python 95% Public website image download; no downloaded assets bundled. Larger file-handling surface.
image-url-download/typescript 95% Public website image download; no downloaded assets bundled. Larger file-handling surface.
job-application/python 90% Agent demo board and generated example.com addresses; references a remotely hosted agent resume whose contents are outside this source-only assessment.
job-application/typescript 90% Agent demo board and generated example.com addresses; references a remotely hosted agent resume whose contents are outside this source-only assessment.
langchain 99% Small public Google-search toolkit example; no account fixture.
manual-mfa-with-contexts/python 95% Interactive GitHub authentication; no saved credentials, context IDs, or account state bundled.
manual-mfa-with-contexts/typescript 95% Interactive GitHub authentication; no saved credentials, context IDs, or account state bundled.
mfa-handling/python 95% Public authentication test site; test credentials/TOTP secret are discovered at runtime.
mfa-handling/typescript 95% Public authentication test site; test credentials/TOTP secret are discovered at runtime.
mongodb 95% Public product extraction with runtime database configuration; larger multi-language persistence example.
pickleball/python 95% Public recreation booking workflow; account credentials and booking choices supplied at runtime.
pickleball/typescript 95% Public recreation booking workflow; account credentials and booking choices supplied at runtime.
polymarket-research/python 99% Public market research; no wallet credentials or customer holdings bundled.
polymarket-research/typescript 99% Public market research; no wallet credentials or customer holdings bundled.
proxies-weather/python 99% Public weather lookup and sample geography; no customer location history bundled.
proxies-weather/typescript 99% Public weather lookup and sample geography; no customer location history bundled.
proxies/python 99% Public IP-information endpoints; no captured IP/session records bundled.
proxies/typescript 99% Public IP-information endpoints; no captured IP/session records bundled.
qa-agent 90% Local synthetic storefront and generic QA agent; larger multi-project fixture surface needs an additional human pass.
sec-filing-research/python 99% Public SEC filings and company identifiers; no private customer records bundled.
sec-filing-research/typescript 99% Public SEC filings and company identifiers; no private customer records bundled.
smart-fetch-scraper/python 95% Generic fetch/browser fallback and public-site defaults; no captured page content bundled.
smart-fetch-scraper/typescript 95% Generic fetch/browser fallback and public-site defaults; no captured page content bundled.
southwest-flights 99% Public fare search with sample route/relative dates; no passenger profile.
temporal 95% Public search and runtime research tasks; broader workflow/configuration surface.
v4-demo-kit 90% Generic example.com/Hacker News harness; private research notes excluded. Confidence depends on completeness of that source separation.
web-performance 95% Generic performance tools with public/reserved-domain targets; no captured session/performance reports bundled.
website-link-tester/python 95% Configurable public website link checker; no customer target list or reports bundled.
website-link-tester/typescript 95% Configurable public website link checker; no customer target list or reports bundled.

@changeset-bot

changeset-bot Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5f4478a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@shrey150
shrey150 marked this pull request as draft September 14, 2026 23:10
@socket-security

socket-security Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

@socket-security

socket-security Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
Critical CVE: Next.js: Unauthenticated Remote Code Execution on windows-hosted servers

CVE: GHSA-p293-qw3h-jr36 Next.js: Unauthenticated Remote Code Execution on windows-hosted servers (CRITICAL)

Affected versions: >= 13.4.0 < 15.5.24; >= 16.0.0 < 16.3.3

Patched version: 15.5.24

From: packages/examples/qa-agent/buggy-app/package.json → npm/next@14.2.35

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/next@14.2.35. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Critical
Critical CVE: Next.js: Unauthenticated Remote Code Execution in Image Optimization API when AVIF files are used

CVE: GHSA-2xp9-vwfh-vxw4 Next.js: Unauthenticated Remote Code Execution in Image Optimization API when AVIF files are used (CRITICAL)

Affected versions: >= 10.0.0 < 15.5.24; >= 16.0.0 < 16.3.3

Patched version: 15.5.24

From: packages/examples/qa-agent/buggy-app/package.json → npm/next@14.2.35

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/next@14.2.35. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm @browserbasehq/convex-stagehand under MIT

Location: Package overview

From: packages/examples/convex/package.json → npm/@browserbasehq/convex-stagehand@0.1.1

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@browserbasehq/convex-stagehand@0.1.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm @types/node is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: packages/examples/langchain/package.json → npm/@langchain/community@0.3.59 → npm/@types/node@18.19.80

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@types/node@18.19.80. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm file-type is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: packages/examples/langchain/package.json → npm/@langchain/community@0.3.59 → npm/file-type@21.3.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/file-type@21.3.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm js-tiktoken is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: packages/examples/caching-with-variables/package.json → npm/@langchain/core@0.3.80 → npm/@langchain/community@0.3.59 → npm/@browserbasehq/stagehand@3.0.7 → npm/@browserbasehq/stagehand@3.0.8 → npm/js-tiktoken@1.0.21

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/js-tiktoken@1.0.21. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm js-tiktoken is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: packages/examples/caching-with-variables/package.json → npm/@langchain/core@0.3.80 → npm/@langchain/community@0.3.59 → npm/@browserbasehq/stagehand@3.0.7 → npm/@browserbasehq/stagehand@3.0.8 → npm/js-tiktoken@1.0.21

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/js-tiktoken@1.0.21. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm strtok3 is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: packages/examples/langchain/package.json → npm/@langchain/community@0.3.59 → npm/strtok3@10.3.5

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/strtok3@10.3.5. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm ts-api-utils is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: packages/examples/temporal/package.json → npm/eslint-plugin-deprecation@1.6.0 → npm/@typescript-eslint/eslint-plugin@6.21.0 → npm/@typescript-eslint/parser@6.21.0 → npm/ts-api-utils@1.4.3

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/ts-api-utils@1.4.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm typescript

License: LicenseRef-W3C-Community-Final-Specification-Agreement - The applicable license policy does not permit this license (5) (package/ThirdPartyNoticeText.txt)

From: packages/examples/temporal/package.json → npm/typescript@4.9.5

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/typescript@4.9.5. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm typescript

License: LicenseRef-W3C-Community-Final-Specification-Agreement - The applicable license policy does not permit this license (5) (package/ThirdPartyNoticeText.txt)

From: packages/examples/box/package.json → npm/typescript@6.0.3

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/typescript@6.0.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

36 issues found across 382 files

Confidence score: 2/5

  • Raw provider errors can be exposed to users through packages/examples/templates/python/google-trends/main.py, packages/examples/demos/v4-demo-kit/src/session.mjs, and packages/examples/demos/v4-demo-kit/src/http-server.mjs, potentially leaking request or infrastructure details; sanitize provider exceptions before printing, rethrowing, or returning them.
  • Several examples are likely unusable from a fresh install: packages/examples/integrations/langchain/package.json has an ESM/CommonJS mismatch, packages/examples/demos/hacker-news-intelligence/package.json cannot load its ESM-only dependencies from CommonJS, and packages/examples/demos/configurable-browser-trial/package.json omits the runtime tsx dependency; align module settings and package runtime dependencies.
  • The Python quickstarts in packages/examples/templates/python/download-financial-statements/README.md and packages/examples/templates/python/manual-mfa-with-contexts/README.md do not execute or install the example correctly, so following the documented steps fails; invoke the entrypoint through the project environment and install requirements into the active virtual environment.
  • Dependency/API compatibility can break examples at startup: packages/examples/integrations/mongodb/python/requirements.txt allows Stagehand 4.x despite 0.3-era code, while packages/examples/demos/qa-agent/qa-agent/src/shared/stagehand-init.ts calls an API unavailable in its declared Stagehand version; pin compatible versions or update the code and declarations together.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/examples/templates/python/download-financial-statements/README.md">

<violation number="1" location="packages/examples/templates/python/download-financial-statements/README.md:25">
P1: Following this quickstart does not run `main.py`: `uvx` treats `stagehand` as the executable and passes `main.py` as its argument. Run the Python entrypoint through the project environment instead.</violation>
</file>

<file name="packages/examples/integrations/langchain/package.json">

<violation number="1" location="packages/examples/integrations/langchain/package.json:8">
P1: This package cannot start because `src/index.js` is ESM while `type: commonjs` makes Node parse it as CommonJS. Set the package type to `module` (or convert the entrypoint to CommonJS).</violation>
</file>

<file name="packages/examples/templates/python/browserbase-reducto/README.md">

<violation number="1" location="packages/examples/templates/python/browserbase-reducto/README.md:42">
P2: This step copies a file that the template does not include, so `cp` fails before the user can configure credentials. Add `.env.example` or replace this step with instructions to create `.env` directly.</violation>
</file>

<file name="packages/examples/demos/v4-demo-kit/src/http-server.mjs">

<violation number="1" location="packages/examples/demos/v4-demo-kit/src/http-server.mjs:32">
P1: Custom agent: **Exception and error message sanitization**

When `createSession()` or `run()` fails, this endpoint returns the upstream `error.message` verbatim, which can include Browserbase or model-provider request details. Return a fixed sanitized message from the HTTP handler and use a typed error for the startup configuration failure instead of exposing raw errors.</violation>

<violation number="2" location="packages/examples/demos/v4-demo-kit/src/http-server.mjs:36">
P1: When browser or provider cleanup rejects, this async HTTP listener rejects after sending its response, so Node 22 can terminate the demo server. Catch and log cleanup failures instead of allowing `finally` to reject the request handler.</violation>
</file>

<file name="packages/examples/demos/hacker-news-intelligence/package.json">

<violation number="1" location="packages/examples/demos/hacker-news-intelligence/package.json:25">
P1: The CommonJS build cannot load the ESM-only `chalk` 5 and `ora` 8 dependencies. Downgrade these dependencies to CommonJS-compatible majors, or migrate the entire example to ESM with matching compiler settings and import specifiers.</violation>
</file>

<file name="packages/examples/integrations/mongodb/python/requirements.txt">

<violation number="1" location="packages/examples/integrations/mongodb/python/requirements.txt:1">
P1: A fresh install can resolve Stagehand 4.x and make this example fail at import or initialization because this code uses the 0.3 API. Pin the dependency to the cataloged compatible version instead of allowing incompatible major versions.</violation>
</file>

<file name="packages/examples/integrations/box/src/browserbase.ts">

<violation number="1" location="packages/examples/integrations/box/src/browserbase.ts:43">
P2: When Browserbase returns an error, `responseError` exposes the entire provider response body through the thrown `Error`, and the caller logs that message directly. Replace the response body with a fixed sanitized message; keep provider details only in controlled internal diagnostics.</violation>
</file>

<file name="packages/examples/integrations/mongodb/python/env.example">

<violation number="1" location="packages/examples/integrations/mongodb/python/env.example:6">
P2: The setup uses `STAGEHAND_API_KEY`, but `main.py` reads `MODEL_API_KEY`, so following the README leaves the model credential as the placeholder and authentication fails. Update the setup documentation or runtime to use one canonical variable.</violation>
</file>

<file name="packages/examples/demos/configurable-browser-trial/package.json">

<violation number="1" location="packages/examples/demos/configurable-browser-trial/package.json:18">
P2: When users follow this example's `npm ci` setup, npm exits before installing anything because this standalone package has no lockfile. Commit a lockfile or change the setup to use `npm install`.</violation>

<violation number="2" location="packages/examples/demos/configurable-browser-trial/package.json:28">
P1: When users install this CLI from npm, `bin/bbpoc.mjs` cannot resolve `tsx`, so every `bbpoc` command fails before `src/cli.ts` runs. Put `tsx` in `dependencies` or publish a compiled JavaScript entrypoint.</violation>
</file>

<file name="packages/examples/integrations/mongodb/typescript/README.md">

<violation number="1" location="packages/examples/integrations/mongodb/typescript/README.md:60">
P2: The README documents reviews that this example never extracts or stores. Remove the review claims from the usage, data-model, and collection sections, or implement the missing review flow.</violation>
</file>

<file name="packages/examples/playbook/1password-extension/README.md">

<violation number="1" location="packages/examples/playbook/1password-extension/README.md:5">
P2: After `npm run upload-extension`, the generated ID must be written to `.env` before `npm start`; otherwise Stagehand starts without the uploaded extension. Document copying `.env.example` to `.env`, supplying the initial values, and inserting the printed `EXTENSION_ID` between the two commands.</violation>
</file>

<file name="packages/examples/integrations/temporal/README.md">

<violation number="1" location="packages/examples/integrations/temporal/README.md:52">
P2: The example cannot use the advertised Anthropic alternative because the activity always selects OpenAI and reads only `OPENAI_API_KEY`. Remove that option or add an actual model/provider selection before documenting it.</violation>
</file>

<file name="packages/examples/demos/qa-agent/qa-agent/.env.example">

<violation number="1" location="packages/examples/demos/qa-agent/qa-agent/.env.example:5">
P2: With the shipped value, both approaches direct the Browserbase-hosted browser to `localhost:3000`, which cannot reach the developer's local BugMart app. Use the public ngrok placeholder documented in the README.</violation>
</file>

<file name="packages/examples/integrations/temporal/.env.example">

<violation number="1" location="packages/examples/integrations/temporal/.env.example:15">
P2: When a user follows the `choose one` instruction and fills `ANTHROPIC_API_KEY`, this example still hardcodes OpenAI and ignores that key. Remove the Anthropic option or select the model and credential from the configured provider.</violation>
</file>

<file name="packages/examples/playbook/alaska-flights/searchAlaskaFlights.ts">

<violation number="1" location="packages/examples/playbook/alaska-flights/searchAlaskaFlights.ts:86">
P2: When navigation, an action, or extraction fails, this handler only logs the error and `npm start` can still report success. Set `process.exitCode = 1` or rethrow after logging.</violation>
</file>

<file name="packages/examples/integrations/agentkit/src/index.ts">

<violation number="1" location="packages/examples/integrations/agentkit/src/index.ts:119">
P2: When `searchNetwork.run` throws, execution skips the following `close-browserbase-session` step, leaving the `keepAlive` session running and billable. Put cleanup in a `finally` block and explicitly request Browserbase release.</violation>
</file>

<file name="packages/examples/templates/python/manual-mfa-with-contexts/README.md">

<violation number="1" location="packages/examples/templates/python/manual-mfa-with-contexts/README.md:23">
P1: Step 4 does not install the example’s dependencies into the activated virtual environment. Use `uv pip install -r requirements.txt` instead.</violation>

<violation number="2" location="packages/examples/templates/python/manual-mfa-with-contexts/README.md:24">
P2: Step 5 fails because this template does not include `.env.example`. Add the tracked template or instruct users to create `.env` directly.</violation>
</file>

<file name="packages/examples/demos/qa-agent/qa-agent/src/shared/stagehand-init.ts">

<violation number="1" location="packages/examples/demos/qa-agent/qa-agent/src/shared/stagehand-init.ts:22">
P1: With the QA agent’s declared `@browserbasehq/stagehand: ^2.5.2`, this call is unavailable because `page.setExtraHTTPHeaders()` was added in Stagehand 3.2.0. `npm start` reaches this line after creating the session and throws at runtime (or fails type checking); upgrade the standalone dependency to a compatible release or use a v2-supported header mechanism.</violation>
</file>

<file name="packages/examples/templates/python/context/README.md">

<violation number="1" location="packages/examples/templates/python/context/README.md:22">
P2: This quickstart cannot run: `context-template` and `requirements.txt` do not exist, and the pip commands omit declared `stagehand` and `python-dotenv` dependencies. Replace these steps with the project’s `uv` setup, for example `uv sync` followed by `uv run main.py`.</violation>
</file>

<file name="packages/examples/demos/configurable-browser-trial/src/classify.ts">

<violation number="1" location="packages/examples/demos/configurable-browser-trial/src/classify.ts:101">
P1: When the grader contradicts an explicit CAPTCHA or block signal, this branch reports `pass` and skips the page-based attribution. Evaluate the hard page signals before accepting grader success, or gate the pass on the absence of those signals.</violation>

<violation number="2" location="packages/examples/demos/configurable-browser-trial/src/classify.ts:101">
P2: When `timedOut` is true, this branch still returns `pass` whenever the grader reports success. Since `timeoutMs` is the per-attempt wall-clock budget, require `!timedOut` before accepting a pass.</violation>
</file>

<file name="packages/examples/demos/company-news-function/index.ts">

<violation number="1" location="packages/examples/demos/company-news-function/index.ts:8">
P1: The documented invocations fail schema validation because `apiKey` is required, while setup only sets `MODEL_API_KEY` and never supplies it as a parameter. Read the configured model key from the function environment or make it an explicit documented parameter, then keep the schema consistent.</violation>

<violation number="2" location="packages/examples/demos/company-news-function/index.ts:61">
P1: The agent prompt asks for JSON, but this call does not request structured output and the function never parses `message`. The documented client therefore receives no `summary`, `topLinks`, or `metadata`; add an output schema and map `result.output` into the documented response shape.</violation>
</file>

<file name="packages/examples/integrations/langchain/src/index.js">

<violation number="1" location="packages/examples/integrations/langchain/src/index.js:2">
P1: A clean install cannot resolve `@stagehand/langchain` because this standalone example does not declare it. Import `StagehandToolkit` from the declared `@langchain/community/agents/toolkits/stagehand` package, or add the missing dependency.</violation>
</file>

<file name="packages/examples/templates/python/download-financial-statements/main.py">

<violation number="1" location="packages/examples/templates/python/download-financial-statements/main.py:31">
P1: When Browserbase returns its placeholder empty ZIP while the PDFs are still pending, `payload` is already truthy, so this saves an empty archive and stops retrying. Require a real archive, such as `len(payload) > 100`, before returning.</violation>
</file>

<file name="packages/examples/integrations/agentkit/src/stagehand-tools.ts">

<violation number="1" location="packages/examples/integrations/agentkit/src/stagehand-tools.ts:14">
P1: When Browserbase session initialization fails, `getStagehand()` runs before each handler's `try`, so the tool rejects instead of returning a tool result. This skips the workflow's later session cleanup and exposes the raw provider error; catch initialization failures, return a fixed sanitized error, and preserve cleanup.

(Based on your team's feedback about sanitizing Browserbase initialization failures.)</violation>
</file>

<file name="packages/examples/templates/python/gift-finder/README.md">

<violation number="1" location="packages/examples/templates/python/gift-finder/README.md:26">
P1: This setup fails because the project has no `requirements.txt`; its dependencies, including Stagehand and `python-dotenv`, are declared in `pyproject.toml`. Replace the venv/install block with `uv sync` and activation of the resulting `.venv`.</violation>
</file>

<file name="packages/examples/demos/v4-demo-kit/src/session.mjs">

<violation number="1" location="packages/examples/demos/v4-demo-kit/src/session.mjs:15">
P1: When Browserbase launch or connection fails, `createSession` propagates the raw SDK/provider error, and the HTTP demo returns its message to callers. Put the remote launch in a cleanup boundary and throw a fixed, sanitized Browserbase initialization error instead of exposing provider details.</violation>

<violation number="2" location="packages/examples/demos/v4-demo-kit/src/session.mjs:42">
P1: Custom agent: **Exception and error message sanitization**

When Browserbase or Stagehand initialization fails, this rethrows the raw provider error, and the HTTP demo returns its message directly to the caller. Replace initialization failures with a fixed-message typed error, and use typed sanitized errors for the local validation branches instead of generic `new Error(...)`.</violation>
</file>

<file name="packages/examples/integrations/temporal/src/research-worker.ts">

<violation number="1" location="packages/examples/integrations/temporal/src/research-worker.ts:13">
P1: When a supervisor sends `SIGTERM`, this worker skips Temporal cleanup, while `SIGINT` exits before the graceful shutdown can drain. Register both signals and let `worker.run()` resolve after `worker.shutdown()` instead of forcing process exit.</violation>
</file>

<file name="packages/examples/templates/python/google-trends/main.py">

<violation number="1" location="packages/examples/templates/python/google-trends/main.py:82">
P1: Custom agent: **Exception and error message sanitization**

When Browserbase or Stagehand fails, this catch-all prints the raw exception and then re-raises it, so provider details can reach the user through output and the traceback. Use an individually typed exception with a fixed sanitized message, and keep raw provider details out of user-facing output.</violation>
</file>

<file name="packages/examples/integrations/temporal/package.json">

<violation number="1" location="packages/examples/integrations/temporal/package.json:11">
P1: When users follow the README’s `.env` setup, the worker never loads that file, so Browserbase and model credentials remain undefined and startup fails. Add a dotenv preload or an equivalent env-file flag to the entry-point scripts.</violation>
</file>

<file name="packages/examples/integrations/mongodb/typescript/package.json">

<violation number="1" location="packages/examples/integrations/mongodb/typescript/package.json:6">
P1: When users follow the README and put credentials in `.env`, `npm start` does not load that file and exits before scraping. Preload `dotenv/config` in the start script or import it before reading `process.env`.</violation>
</file>

Note: This PR contains a large number of files. cubic selects up to 200 of the highest-priority eligible files for this review, so some files may not have been reviewed.

Re-trigger cubic

};
} catch (error) {
await browser.close();
throw error;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: Custom agent: Exception and error message sanitization

When Browserbase or Stagehand initialization fails, this rethrows the raw provider error, and the HTTP demo returns its message directly to the caller. Replace initialization failures with a fixed-message typed error, and use typed sanitized errors for the local validation branches instead of generic new Error(...).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/demos/v4-demo-kit/src/session.mjs, line 42:

<comment>When Browserbase or Stagehand initialization fails, this rethrows the raw provider error, and the HTTP demo returns its message directly to the caller. Replace initialization failures with a fixed-message typed error, and use typed sanitized errors for the local validation branches instead of generic `new Error(...)`.</comment>

<file context>
@@ -0,0 +1,44 @@
+    };
+  } catch (error) {
+    await browser.close();
+    throw error;
+  }
+}
</file context>

"keywords": [],
"license": "ISC",
"author": "",
"type": "commonjs",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: This package cannot start because src/index.js is ESM while type: commonjs makes Node parse it as CommonJS. Set the package type to module (or convert the entrypoint to CommonJS).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/integrations/langchain/package.json, line 8:

<comment>This package cannot start because `src/index.js` is ESM while `type: commonjs` makes Node parse it as CommonJS. Set the package type to `module` (or convert the entrypoint to CommonJS).</comment>

<file context>
@@ -0,0 +1,19 @@
+  "keywords": [],
+  "license": "ISC",
+  "author": "",
+  "type": "commonjs",
+  "main": "index.js",
+  "scripts": {
</file context>
Suggested change
"type": "commonjs",
"type": "module",

@@ -0,0 +1,6 @@
stagehand>=0.3.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: A fresh install can resolve Stagehand 4.x and make this example fail at import or initialization because this code uses the 0.3 API. Pin the dependency to the cataloged compatible version instead of allowing incompatible major versions.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/integrations/mongodb/python/requirements.txt, line 1:

<comment>A fresh install can resolve Stagehand 4.x and make this example fail at import or initialization because this code uses the 0.3 API. Pin the dependency to the cataloged compatible version instead of allowing incompatible major versions.</comment>

<file context>
@@ -0,0 +1,6 @@
+stagehand>=0.3.0
+pymongo>=4.6.0
+pydantic>=2.0.0
</file context>
Suggested change
stagehand>=0.3.0
stagehand==0.3.0

"type": "module",
"scripts": {
"build": "tsc",
"start": "tsx index.ts",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: When users follow the README and put credentials in .env, npm start does not load that file and exits before scraping. Preload dotenv/config in the start script or import it before reading process.env.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/integrations/mongodb/typescript/package.json, line 6:

<comment>When users follow the README and put credentials in `.env`, `npm start` does not load that file and exits before scraping. Preload `dotenv/config` in the start script or import it before reading `process.env`.</comment>

<file context>
@@ -0,0 +1,24 @@
+  "type": "module",
+  "scripts": {
+    "build": "tsc",
+    "start": "tsx index.ts",
+    "postinstall": "playwright install"
+  },
</file context>
Suggested change
"start": "tsx index.ts",
"start": "node --import tsx --import dotenv/config index.ts",

Comment thread packages/examples/integrations/deepagents/requirements.txt Outdated
"https://github.com/browserbase/stagehand/issues/new",
)}\n`,
);
})().catch(console.error);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: When navigation, an action, or extraction fails, this handler only logs the error and npm start can still report success. Set process.exitCode = 1 or rethrow after logging.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/playbook/alaska-flights/searchAlaskaFlights.ts, line 86:

<comment>When navigation, an action, or extraction fails, this handler only logs the error and `npm start` can still report success. Set `process.exitCode = 1` or rethrow after logging.</comment>

<file context>
@@ -0,0 +1,86 @@
+      "https://github.com/browserbase/stagehand/issues/new",
+    )}\n`,
+  );
+})().catch(console.error);
</file context>
Suggested change
})().catch(console.error);
})().catch((error) => {
console.error(error);
process.exitCode = 1;
});

return session.id;
});

const response = await searchNetwork.run(event.data.input, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: When searchNetwork.run throws, execution skips the following close-browserbase-session step, leaving the keepAlive session running and billable. Put cleanup in a finally block and explicitly request Browserbase release.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/integrations/agentkit/src/index.ts, line 119:

<comment>When `searchNetwork.run` throws, execution skips the following `close-browserbase-session` step, leaving the `keepAlive` session running and billable. Put cleanup in a `finally` block and explicitly request Browserbase release.</comment>

<file context>
@@ -0,0 +1,141 @@
+      return session.id;
+    });
+
+    const response = await searchNetwork.run(event.data.input, {
+      state: new State({
+        data: { browserbaseSessionID },
</file context>

Comment on lines +24 to +25
5. cp .env.example .env
6. Add your Browserbase API key, GitHub username, and password to .env

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Step 5 fails because this template does not include .env.example. Add the tracked template or instruct users to create .env directly.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/templates/python/manual-mfa-with-contexts/README.md, line 24:

<comment>Step 5 fails because this template does not include `.env.example`. Add the tracked template or instruct users to create `.env` directly.</comment>

<file context>
@@ -0,0 +1,69 @@
+2. uv venv venv
+3. source venv/bin/activate # On Windows: venv\Scripts\activate
+4. uvx install stagehand browserbase python-dotenv pydantic requests
+5. cp .env.example .env
+6. Add your Browserbase API key, GitHub username, and password to .env
+7. Ensure 2FA is enabled on your GitHub test account (Settings → Password and authentication → Enable two-factor authentication)
</file context>
Suggested change
5. cp .env.example .env
6. Add your Browserbase API key, GitHub username, and password to .env
5. Create a `.env` file containing `BROWSERBASE_API_KEY`, `GITHUB_USERNAME`, and `GITHUB_PASSWORD`

Comment on lines +22 to +28
1. cd context-template
2. uv venv venv
3. source venv/bin/activate # On Windows: venv\Scripts\activate
4. pip install -r requirements.txt
5. pip install browserbase pydantic requests
6. cp .env.example .env # Add your Browserbase API key and SF Rec Park credentials to .env
7. python main.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This quickstart cannot run: context-template and requirements.txt do not exist, and the pip commands omit declared stagehand and python-dotenv dependencies. Replace these steps with the project’s uv setup, for example uv sync followed by uv run main.py.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/templates/python/context/README.md, line 22:

<comment>This quickstart cannot run: `context-template` and `requirements.txt` do not exist, and the pip commands omit declared `stagehand` and `python-dotenv` dependencies. Replace these steps with the project’s `uv` setup, for example `uv sync` followed by `uv run main.py`.</comment>

<file context>
@@ -0,0 +1,63 @@
+
+## QUICKSTART
+
+1.  cd context-template
+2.  uv venv venv
+3.  source venv/bin/activate # On Windows: venv\Scripts\activate
</file context>
Suggested change
1. cd context-template
2. uv venv venv
3. source venv/bin/activate # On Windows: venv\Scripts\activate
4. pip install -r requirements.txt
5. pip install browserbase pydantic requests
6. cp .env.example .env # Add your Browserbase API key and SF Rec Park credentials to .env
7. python main.py
1. uv sync
2. cp .env.example .env # Add your Browserbase API key and SF Rec Park credentials to .env
3. uv run main.py

};
}

if (graderSuccess && !graderBlocked) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: When timedOut is true, this branch still returns pass whenever the grader reports success. Since timeoutMs is the per-attempt wall-clock budget, require !timedOut before accepting a pass.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/examples/demos/configurable-browser-trial/src/classify.ts, line 101:

<comment>When `timedOut` is true, this branch still returns `pass` whenever the grader reports success. Since `timeoutMs` is the per-attempt wall-clock budget, require `!timedOut` before accepting a pass.</comment>

<file context>
@@ -0,0 +1,145 @@
+    };
+  }
+
+  if (graderSuccess && !graderBlocked) {
+    return { outcome: "pass", detected, reason: "Task completed and success criteria met." };
+  }
</file context>
Suggested change
if (graderSuccess && !graderBlocked) {
if (!timedOut && graderSuccess && !graderBlocked) {

@shrey150 shrey150 changed the title Consolidate Stagehand examples and link skills Consolidate Stagehand examples into a flat catalog and link skills Sep 15, 2026

This branch has not been deployed

No deployments
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