Skip to content

Make projectId optional for Browserbase sessions - #1800

Merged
shrey150 merged 12 commits into
mainfrom
chris/optional-project-id
Mar 10, 2026
Merged

shrey150 merged 12 commits into
mainfrom
chris/optional-project-id

Conversation

@shrey150

@shrey150 shrey150 commented Mar 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Browserbase no longer requires a projectId — only an API key
  • Stops Stagehand from throwing when BROWSERBASE_PROJECT_ID is not set, while still passing it through when provided
  • Updates all call sites: requireBrowserbaseCreds(), createBrowserbaseSession(), StagehandAPIClient, and shutdown supervisor

Changes

  • v3.ts — requireBrowserbaseCreds() only throws on missing apiKey, makes projectId optional in return type; removed redundant guard that still checked projectId
  • launch/browserbase.ts — projectId parameter made optional, conditionally included in create payload
  • api.ts — projectId optional in StagehandAPIClient, x-bb-project-id header only sent when set
  • shutdown/supervisor.ts — cleanup no longer requires projectId
  • types/private/shutdown.ts — projectId made optional in ShutdownSupervisorConfig

Test plan

  • Init with BROWSERBASE_API_KEY only (no BROWSERBASE_PROJECT_ID) — succeeds, connects to Browserbase, page loads
  • Verified redundant guard at v3.ts:889 was blocking init — fixed
  • Init with both env vars set — should still work as before
  • Verify session cleanup works without projectId

🤖 Generated with Claude Code

Co-authored-by: Chris Read [email protected]

Browserbase no longer requires a projectId — only an API key. This
stops Stagehand from throwing when BROWSERBASE_PROJECT_ID is not set,
while still passing it through when provided.
@changeset-bot

changeset-bot Bot commented Mar 10, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 522c663

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-evals Patch
@browserbasehq/stagehand-server-v3 Patch
@browserbasehq/stagehand-server-v4 Patch

Not sure what this means? Click here to learn what changesets are.

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

The requireBrowserbaseCreds() method was updated to make projectId
optional, but a second guard immediately after still checked for it
and threw. Remove the redundant check.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@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.

2 issues found across 5 files

Confidence score: 2/5

  • There is a high-confidence functional issue in packages/core/lib/v3/v3.ts: the post-requireBrowserbaseCreds() guard still throws on missing projectId (!apiKey || !projectId), which appears to negate the intended behavior change and is likely user-impacting.
  • packages/core/lib/v3/api.ts introduces a behavioral change (conditional x-bb-project-id header) without the requested integration coverage under packages/server/test, so regression risk against the REST client/server contract remains.
  • Given one very severe, concrete logic problem plus an unverified API behavior change, this looks risky to merge until corrected and tested.
  • Pay close attention to packages/core/lib/v3/v3.ts, packages/core/lib/v3/api.ts, and packages/server/test - credential guard logic and header-contract changes need validation with integration tests.
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/core/lib/v3/api.ts">

<violation number="1" location="packages/core/lib/v3/api.ts:847">
P2: Custom agent: **Any breaking changes to Stagehand REST API client / server implementation must be covered by an integration test under packages/server/test**

The conditional `x-bb-project-id` header is a behavioral change to the API client's `request()` method, but no integration test in `packages/server/test/` covers the new code path where `projectId` is absent. The existing `start.test.ts` always asserts `BROWSERBASE_PROJECT_ID` is set and sends the header. Add a test that starts a session without `x-bb-project-id` to verify the server accepts requests when `projectId` is omitted.</violation>
</file>

<file name="packages/core/lib/v3/v3.ts">

<violation number="1" location="packages/core/lib/v3/v3.ts:915">
P0: The guard after `requireBrowserbaseCreds()` still throws when `projectId` is missing (`!apiKey || !projectId`), which completely defeats the purpose of this PR. Since `requireBrowserbaseCreds()` now handles the `apiKey` check internally, this entire guard block should be removed.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant Env as Environment/Process
    participant V3 as V3 Orchestrator
    participant Launch as Session Launcher
    participant Client as Stagehand API Client
    participant BB as Browserbase API
    participant Super as Shutdown Supervisor

    Note over Env,BB: Session Initialization & Credential Guard
    V3->>Env: requireBrowserbaseCreds()
    Env-->>V3: apiKey, projectId (optional)
    alt apiKey missing
        V3-->>V3: Throw MissingEnvironmentVariableError
    else apiKey present
        V3->>V3: CHANGED: Cache apiKey (and optional projectId)
    end

    Note over V3,BB: Session Creation Flow
    V3->>Launch: createBrowserbaseSession(apiKey, projectId?)
    Launch->>Launch: CHANGED: Build createPayload
    opt projectId exists
        Launch->>Launch: Set projectId in payload
    end
    Launch->>BB: bb.sessions.create(payload)
    BB-->>Launch: sessionId, debugUrl, etc.
    Launch-->>V3: session metadata

    Note over V3,BB: Runtime API Communication
    V3->>Client: Initialize with apiKey, projectId?
    Client->>BB: performRequest()
    Note right of Client: NEW: Conditional Header Logic
    opt projectId is defined
        Client->>BB: Add "x-bb-project-id" header
    end
    BB-->>Client: response

    Note over V3,Super: Cleanup & Shutdown
    V3->>Super: registerSession(sessionId, apiKey, projectId?)
    Note over Super,BB: On Process Exit / Close
    Super->>Super: CHANGED: Verify apiKey + sessionId exist
    Super->>BB: bb.sessions.update(sessionId, { status: "REQUEST_RELEASE" })
    Note right of Super: NEW: Includes projectId in update only if provided
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread packages/core/lib/v3/v3.ts Resolved
const defaultHeaders: Record<string, string> = {
"x-bb-api-key": this.apiKey,
"x-bb-project-id": this.projectId,
...(this.projectId ? { "x-bb-project-id": this.projectId } : {}),

@cubic-dev-ai cubic-dev-ai Bot Mar 10, 2026 •

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: Custom agent: Any breaking changes to Stagehand REST API client / server implementation must be covered by an integration test under packages/server/test

The conditional x-bb-project-id header is a behavioral change to the API client's request() method, but no integration test in packages/server/test/ covers the new code path where projectId is absent. The existing start.test.ts always asserts BROWSERBASE_PROJECT_ID is set and sends the header. Add a test that starts a session without x-bb-project-id to verify the server accepts requests when projectId is omitted.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/lib/v3/api.ts, line 847:

<comment>The conditional `x-bb-project-id` header is a behavioral change to the API client's `request()` method, but no integration test in `packages/server/test/` covers the new code path where `projectId` is absent. The existing `start.test.ts` always asserts `BROWSERBASE_PROJECT_ID` is set and sends the header. Add a test that starts a session without `x-bb-project-id` to verify the server accepts requests when `projectId` is omitted.</comment>

<file context>
@@ -844,7 +844,7 @@ export class StagehandAPIClient {
     const defaultHeaders: Record<string, string> = {
       "x-bb-api-key": this.apiKey,
-      "x-bb-project-id": this.projectId,
+      ...(this.projectId ? { "x-bb-project-id": this.projectId } : {}),
       "x-bb-session-id": this.sessionId,
       // we want real-time logs, so we stream the response
</file context>
Fix with Cubic

@greptile-apps

greptile-apps Bot commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes projectId optional across all Browserbase integration points — credential validation, session creation, the API client, and the shutdown supervisor — so users can initialize with only a BROWSERBASE_API_KEY. The changes to api.ts, types/private/shutdown.ts, and the credential validation are clean and safe.

Key finding:

  • Spread overwrite bug in v3.ts (line 915-931): When constructing createSessionPayload, projectId is conditionally set first, then ...effectiveSessionParams is spread immediately after. If effectiveSessionParams contains projectId: undefined (or any explicit undefined value), the spread will silently overwrite the correctly resolved value. The same pattern in browserbase.ts handles this correctly by destructuring projectId out before spreading ...rest. The v3 code should follow the same pattern for consistency and correctness.

The code changes to browserbase.ts, supervisor.ts, api.ts, and the type system are appropriate for making projectId optional.

Confidence Score: 3/5

  • PR is mostly safe but has one legitimate logic issue in v3.ts that should be fixed before merging.
  • The PR correctly makes projectId optional across most integration points with clean, safe implementations in api.ts, shutdown.ts, and browserbase.ts. However, there is a real logic issue in v3.ts where the spread of effectiveSessionParams can overwrite a correctly resolved projectId with undefined. While this only triggers if a caller explicitly passes projectId: undefined (a less common edge case), it's a correctness issue that should be addressed. The fix is straightforward: follow the same destructuring pattern already used in browserbase.ts to prevent the overwrite. The issue isn't critical for the typical use case but affects code quality and consistency.
  • packages/core/lib/v3/v3.ts - Needs destructuring fix for spread overwrite issue

Comments Outside Diff (1)

  1. packages/core/lib/v3/v3.ts, line 915-931 (link)

    The resolved projectId can be silently overwritten by the spread of effectiveSessionParams.

    When resolvedProjectId is conditionally added and then ...effectiveSessionParams is spread immediately after, any projectId key in effectiveSessionParams (even if undefined) will overwrite the correctly resolved value.

    For example, if a caller passes browserbaseSessionCreateParams: { projectId: undefined }:

    • resolvedProjectId = effectiveSessionParams.projectId ?? projectId = projectId (from env/parameter)
    • { projectId: resolvedProjectId } is added ✓
    • ...effectiveSessionParams spreads projectId: undefined → overwrites ✗

    The pattern in browserbase.ts avoids this by destructuring projectId out before spreading:

Last reviewed commit: 77db848

shrey150 and others added 6 commits March 9, 2026 17:26
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Destructure projectId, browserSettings, and userMetadata out of
effectiveSessionParams before spreading, matching the pattern in
browserbase.ts. Prevents projectId: undefined from overwriting
the resolved value.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Verify that a browserbase session can be started with only
x-bb-api-key and no x-bb-project-id header. Also fix comment
on existing test to reflect that only API key is required.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
… routes

The server-side guard was still requiring both x-bb-api-key and
x-bb-project-id headers, causing the integration test to fail.
Now only x-bb-api-key is required, matching the client-side changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@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.

1 issue found across 2 files (changes from recent commits).

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/server-v3/src/routes/v1/sessions/start.ts">

<violation number="1" location="packages/server-v3/src/routes/v1/sessions/start.ts:114">
P2: Error message says "Missing required headers" (plural) but now only `x-bb-api-key` is checked. Update the message to reflect the single required header so callers get actionable feedback.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

shrey150 and others added 4 commits March 9, 2026 18:57
SessionCreateParams requires projectId, but it's now optional.
Changed satisfies to as to allow the payload without projectId.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Keeps type safety on all other fields while allowing projectId to be
optional, until the Browserbase SDK type is updated upstream.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
SDK 2.7.0 already has projectId as optional in SessionCreateParams,
so we can use a clean satisfies instead of the Omit workaround.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
shrey150 added a commit that referenced this pull request Mar 10, 2026
Only BROWSERBASE_API_KEY is required for remote mode, matching the
core SDK changes in #1800.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@shrey150
shrey150 merged commit 2abf5b9 into main Mar 10, 2026
174 checks passed
This was referenced Mar 10, 2026
shrey150 added a commit that referenced this pull request Mar 10, 2026
## Summary
- Stacked on #1800
- Only `BROWSERBASE_API_KEY` is required for remote mode in the CLI
- `BROWSERBASE_PROJECT_ID` is still passed through if set, but no longer
checked

## Changes
- `packages/cli/src/index.ts` — `hasBrowserbaseCredentials()` only
checks for API key
- `packages/cli/tests/mode.test.ts` — Updated test to match new error
message
- `packages/cli/README.md` — Updated docs to reflect optional project ID

## Test plan
- [x] Existing mode test updated
- [x] Manual: `browse env remote` with only `BROWSERBASE_API_KEY` set

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Make `BROWSERBASE_PROJECT_ID` optional in the CLI for remote mode, so
only `BROWSERBASE_API_KEY` is required. The project ID is still
forwarded when provided.

- **Bug Fixes**
- Updated remote mode check and error message to only require
`BROWSERBASE_API_KEY`.
- Autodetection now defaults to `remote` when the API key is set;
otherwise `local`.
  - Updated tests and `@browserbasehq/browse-cli` README to match.

<sup>Written for commit 99eb186.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1803">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
miguelg719 pushed a commit that referenced this pull request Mar 18, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @browserbasehq/[email protected]

### Minor Changes

- [#1816](#1816)
[`687d54a`](687d54a)
Thanks [@shrey150](https://github.com/shrey150)! - Add `--context-id`
and `--persist` flags to `browse open` for loading and persisting
Browserbase Contexts across sessions

- [#1793](#1793)
[`e38c13b`](e38c13b)
Thanks [@shrey150](https://github.com/shrey150)! - Initial release of
browse CLI - browser automation for AI agents

### Patch Changes

- [#1806](#1806)
[`f8c7738`](f8c7738)
Thanks [@shrey150](https://github.com/shrey150)! - Fix `browse env`
showing stale mode after `browse env remote`

- Updated dependencies
\[[`505e8c6`](505e8c6),
[`2f43ffa`](2f43ffa),
[`63ee247`](63ee247),
[`7dc35f5`](7dc35f5),
[`335cf47`](335cf47),
[`6ba0a1d`](6ba0a1d),
[`4ff3bb8`](4ff3bb8),
[`c27054b`](c27054b),
[`2abf5b9`](2abf5b9),
[`7817fcc`](7817fcc),
[`7390508`](7390508),
[`611f43a`](611f43a),
[`521a10e`](521a10e),
[`2402a3c`](2402a3c)]:
    -   @browserbasehq/[email protected]

## @browserbasehq/[email protected]

### Minor Changes

- [#1779](#1779)
[`2f43ffa`](2f43ffa)
Thanks [@shrey150](https://github.com/shrey150)! - feat: add
`cdpHeaders` option to `localBrowserLaunchOptions` for passing custom
HTTP headers when connecting to an existing browser via CDP URL

- [#1834](#1834)
[`63ee247`](63ee247)
Thanks [@tkattkat](https://github.com/tkattkat)! - Update stagehand
agents search tool

- [#1774](#1774)
[`521a10e`](521a10e)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add new
page.setExtraHTTPHeaders() method

### Patch Changes

- [#1759](#1759)
[`505e8c6`](505e8c6)
Thanks [@shrey150](https://github.com/shrey150)! - Add bedrock to the
provider enum in model configuration schemas and regenerate OpenAPI
spec.

- [#1814](#1814)
[`7dc35f5`](7dc35f5)
Thanks [@tkattkat](https://github.com/tkattkat)! - Change usage of
openai provider in agent to default to store:false

- [#1846](#1846)
[`335cf47`](335cf47)
Thanks [@aq17](https://github.com/aq17)! - Fix streaming finished event
being silently dropped. The final SSE event containing the result
payload (success status, message, actions, usage, and messages) was
previously discarded instead of being yielded to the caller.

- [#1764](#1764)
[`6ba0a1d`](6ba0a1d)
Thanks [@shrey150](https://github.com/shrey150)! - Expose `headers` in
`GoogleVertexProviderSettings` so model configs can pass custom provider
headers (for example `X-Goog-Priority`) without TypeScript errors.

- [#1847](#1847)
[`4ff3bb8`](4ff3bb8)
Thanks [@miguelg719](https://github.com/miguelg719)! - Enable FlowLogger
on BROWSERBASE_FLOW_LOGS=1

- [#1752](#1752)
[`c27054b`](c27054b)
Thanks [@derekmeegan](https://github.com/derekmeegan)! - fix: pause
Browserbase agents while captcha solving is active and improve CUA
recovery after the solve completes

- [#1800](#1800)
[`2abf5b9`](2abf5b9)
Thanks [@shrey150](https://github.com/shrey150)! - Make projectId
optional for Browserbase sessions — only BROWSERBASE_API_KEY is required

- [#1766](#1766)
[`7817fcc`](7817fcc)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add configurable
timeout to tools in agent

- [#1749](#1749)
[`7390508`](7390508)
Thanks [@pirate](https://github.com/pirate)! - When connecting to a
browser session that has zero open tabs, Stagehand now automatically
creates an initial `about:blank` tab so the connection can continue.

- [#1761](#1761)
[`611f43a`](611f43a)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue
where handlePossibleNavigation was producing unnecessary error logs on
clicks that trigger page close

- [#1817](#1817)
[`2402a3c`](2402a3c)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for
passing custom headers in clientOptions

## @browserbasehq/[email protected]

### Patch Changes

- Updated dependencies
\[[`505e8c6`](505e8c6),
[`2f43ffa`](2f43ffa),
[`63ee247`](63ee247),
[`7dc35f5`](7dc35f5),
[`335cf47`](335cf47),
[`6ba0a1d`](6ba0a1d),
[`4ff3bb8`](4ff3bb8),
[`c27054b`](c27054b),
[`2abf5b9`](2abf5b9),
[`7817fcc`](7817fcc),
[`7390508`](7390508),
[`611f43a`](611f43a),
[`521a10e`](521a10e),
[`2402a3c`](2402a3c)]:
    -   @browserbasehq/[email protected]

## @browserbasehq/[email protected]

### Patch Changes

- [#1759](#1759)
[`505e8c6`](505e8c6)
Thanks [@shrey150](https://github.com/shrey150)! - Add bedrock to the
provider enum in model configuration schemas and regenerate OpenAPI
spec.

- Updated dependencies
\[[`505e8c6`](505e8c6),
[`2f43ffa`](2f43ffa),
[`63ee247`](63ee247),
[`7dc35f5`](7dc35f5),
[`335cf47`](335cf47),
[`6ba0a1d`](6ba0a1d),
[`4ff3bb8`](4ff3bb8),
[`c27054b`](c27054b),
[`2abf5b9`](2abf5b9),
[`7817fcc`](7817fcc),
[`7390508`](7390508),
[`611f43a`](611f43a),
[`521a10e`](521a10e),
[`2402a3c`](2402a3c)]:
    -   @browserbasehq/[email protected]

## @browserbasehq/[email protected]

### Patch Changes

- Updated dependencies
\[[`505e8c6`](505e8c6),
[`2f43ffa`](2f43ffa),
[`63ee247`](63ee247),
[`7dc35f5`](7dc35f5),
[`335cf47`](335cf47),
[`6ba0a1d`](6ba0a1d),
[`4ff3bb8`](4ff3bb8),
[`c27054b`](c27054b),
[`2abf5b9`](2abf5b9),
[`7817fcc`](7817fcc),
[`7390508`](7390508),
[`611f43a`](611f43a),
[`521a10e`](521a10e),
[`2402a3c`](2402a3c)]:
    -   @browserbasehq/[email protected]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
felipeofdev-ai pushed a commit to felipeofdev-ai/stagehand that referenced this pull request Aug 4, 2026
felipeofdev-ai pushed a commit to felipeofdev-ai/stagehand that referenced this pull request Aug 4, 2026
## Summary
- Stacked on browserbase#1800
- Only `BROWSERBASE_API_KEY` is required for remote mode in the CLI
- `BROWSERBASE_PROJECT_ID` is still passed through if set, but no longer
checked

## Changes
- `packages/cli/src/index.ts` — `hasBrowserbaseCredentials()` only
checks for API key
- `packages/cli/tests/mode.test.ts` — Updated test to match new error
message
- `packages/cli/README.md` — Updated docs to reflect optional project ID

## Test plan
- [x] Existing mode test updated
- [x] Manual: `browse env remote` with only `BROWSERBASE_API_KEY` set

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Make `BROWSERBASE_PROJECT_ID` optional in the CLI for remote mode, so
only `BROWSERBASE_API_KEY` is required. The project ID is still
forwarded when provided.

- **Bug Fixes**
- Updated remote mode check and error message to only require
`BROWSERBASE_API_KEY`.
- Autodetection now defaults to `remote` when the API key is set;
otherwise `local`.
  - Updated tests and `@browserbasehq/browse-cli` README to match.

<sup>Written for commit 99eb186.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1803">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->
felipeofdev-ai pushed a commit to felipeofdev-ai/stagehand that referenced this pull request Aug 4, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @browserbasehq/[email protected]

### Minor Changes

- [browserbase#1816](browserbase#1816)
[`687d54a`](browserbase@687d54a)
Thanks [@shrey150](https://github.com/shrey150)! - Add `--context-id`
and `--persist` flags to `browse open` for loading and persisting
Browserbase Contexts across sessions

- [browserbase#1793](browserbase#1793)
[`e38c13b`](browserbase@e38c13b)
Thanks [@shrey150](https://github.com/shrey150)! - Initial release of
browse CLI - browser automation for AI agents

### Patch Changes

- [browserbase#1806](browserbase#1806)
[`f8c7738`](browserbase@f8c7738)
Thanks [@shrey150](https://github.com/shrey150)! - Fix `browse env`
showing stale mode after `browse env remote`

- Updated dependencies
\[[`505e8c6`](browserbase@505e8c6),
[`2f43ffa`](browserbase@2f43ffa),
[`63ee247`](browserbase@63ee247),
[`7dc35f5`](browserbase@7dc35f5),
[`335cf47`](browserbase@335cf47),
[`6ba0a1d`](browserbase@6ba0a1d),
[`4ff3bb8`](browserbase@4ff3bb8),
[`c27054b`](browserbase@c27054b),
[`2abf5b9`](browserbase@2abf5b9),
[`7817fcc`](browserbase@7817fcc),
[`7390508`](browserbase@7390508),
[`611f43a`](browserbase@611f43a),
[`521a10e`](browserbase@521a10e),
[`2402a3c`](browserbase@2402a3c)]:
    -   @browserbasehq/[email protected]

## @browserbasehq/[email protected]

### Minor Changes

- [browserbase#1779](browserbase#1779)
[`2f43ffa`](browserbase@2f43ffa)
Thanks [@shrey150](https://github.com/shrey150)! - feat: add
`cdpHeaders` option to `localBrowserLaunchOptions` for passing custom
HTTP headers when connecting to an existing browser via CDP URL

- [browserbase#1834](browserbase#1834)
[`63ee247`](browserbase@63ee247)
Thanks [@tkattkat](https://github.com/tkattkat)! - Update stagehand
agents search tool

- [browserbase#1774](browserbase#1774)
[`521a10e`](browserbase@521a10e)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add new
page.setExtraHTTPHeaders() method

### Patch Changes

- [browserbase#1759](browserbase#1759)
[`505e8c6`](browserbase@505e8c6)
Thanks [@shrey150](https://github.com/shrey150)! - Add bedrock to the
provider enum in model configuration schemas and regenerate OpenAPI
spec.

- [browserbase#1814](browserbase#1814)
[`7dc35f5`](browserbase@7dc35f5)
Thanks [@tkattkat](https://github.com/tkattkat)! - Change usage of
openai provider in agent to default to store:false

- [browserbase#1846](browserbase#1846)
[`335cf47`](browserbase@335cf47)
Thanks [@aq17](https://github.com/aq17)! - Fix streaming finished event
being silently dropped. The final SSE event containing the result
payload (success status, message, actions, usage, and messages) was
previously discarded instead of being yielded to the caller.

- [browserbase#1764](browserbase#1764)
[`6ba0a1d`](browserbase@6ba0a1d)
Thanks [@shrey150](https://github.com/shrey150)! - Expose `headers` in
`GoogleVertexProviderSettings` so model configs can pass custom provider
headers (for example `X-Goog-Priority`) without TypeScript errors.

- [browserbase#1847](browserbase#1847)
[`4ff3bb8`](browserbase@4ff3bb8)
Thanks [@miguelg719](https://github.com/miguelg719)! - Enable FlowLogger
on BROWSERBASE_FLOW_LOGS=1

- [browserbase#1752](browserbase#1752)
[`c27054b`](browserbase@c27054b)
Thanks [@derekmeegan](https://github.com/derekmeegan)! - fix: pause
Browserbase agents while captcha solving is active and improve CUA
recovery after the solve completes

- [browserbase#1800](browserbase#1800)
[`2abf5b9`](browserbase@2abf5b9)
Thanks [@shrey150](https://github.com/shrey150)! - Make projectId
optional for Browserbase sessions — only BROWSERBASE_API_KEY is required

- [browserbase#1766](browserbase#1766)
[`7817fcc`](browserbase@7817fcc)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add configurable
timeout to tools in agent

- [browserbase#1749](browserbase#1749)
[`7390508`](browserbase@7390508)
Thanks [@pirate](https://github.com/pirate)! - When connecting to a
browser session that has zero open tabs, Stagehand now automatically
creates an initial `about:blank` tab so the connection can continue.

- [browserbase#1761](browserbase#1761)
[`611f43a`](browserbase@611f43a)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue
where handlePossibleNavigation was producing unnecessary error logs on
clicks that trigger page close

- [browserbase#1817](browserbase#1817)
[`2402a3c`](browserbase@2402a3c)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for
passing custom headers in clientOptions

## @browserbasehq/[email protected]

### Patch Changes

- Updated dependencies
\[[`505e8c6`](browserbase@505e8c6),
[`2f43ffa`](browserbase@2f43ffa),
[`63ee247`](browserbase@63ee247),
[`7dc35f5`](browserbase@7dc35f5),
[`335cf47`](browserbase@335cf47),
[`6ba0a1d`](browserbase@6ba0a1d),
[`4ff3bb8`](browserbase@4ff3bb8),
[`c27054b`](browserbase@c27054b),
[`2abf5b9`](browserbase@2abf5b9),
[`7817fcc`](browserbase@7817fcc),
[`7390508`](browserbase@7390508),
[`611f43a`](browserbase@611f43a),
[`521a10e`](browserbase@521a10e),
[`2402a3c`](browserbase@2402a3c)]:
    -   @browserbasehq/[email protected]

## @browserbasehq/[email protected]

### Patch Changes

- [browserbase#1759](browserbase#1759)
[`505e8c6`](browserbase@505e8c6)
Thanks [@shrey150](https://github.com/shrey150)! - Add bedrock to the
provider enum in model configuration schemas and regenerate OpenAPI
spec.

- Updated dependencies
\[[`505e8c6`](browserbase@505e8c6),
[`2f43ffa`](browserbase@2f43ffa),
[`63ee247`](browserbase@63ee247),
[`7dc35f5`](browserbase@7dc35f5),
[`335cf47`](browserbase@335cf47),
[`6ba0a1d`](browserbase@6ba0a1d),
[`4ff3bb8`](browserbase@4ff3bb8),
[`c27054b`](browserbase@c27054b),
[`2abf5b9`](browserbase@2abf5b9),
[`7817fcc`](browserbase@7817fcc),
[`7390508`](browserbase@7390508),
[`611f43a`](browserbase@611f43a),
[`521a10e`](browserbase@521a10e),
[`2402a3c`](browserbase@2402a3c)]:
    -   @browserbasehq/[email protected]

## @browserbasehq/[email protected]

### Patch Changes

- Updated dependencies
\[[`505e8c6`](browserbase@505e8c6),
[`2f43ffa`](browserbase@2f43ffa),
[`63ee247`](browserbase@63ee247),
[`7dc35f5`](browserbase@7dc35f5),
[`335cf47`](browserbase@335cf47),
[`6ba0a1d`](browserbase@6ba0a1d),
[`4ff3bb8`](browserbase@4ff3bb8),
[`c27054b`](browserbase@c27054b),
[`2abf5b9`](browserbase@2abf5b9),
[`7817fcc`](browserbase@7817fcc),
[`7390508`](browserbase@7390508),
[`611f43a`](browserbase@611f43a),
[`521a10e`](browserbase@521a10e),
[`2402a3c`](browserbase@2402a3c)]:
    -   @browserbasehq/[email protected]
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