Skip to content

Conversation

@tkattkat
Copy link
Collaborator

@tkattkat tkattkat commented Nov 12, 2025

why

currently, there is no way to use a custom baseURL with the google cua client

what changed

when a baseurl is provided in the model object and google cua is used, the client will now proxy all requests through the defined base url

test plan

tested locally
tested on api

I have also made a separate branch, with a proxy server and example script to test if desired
https://github.com/browserbase/stagehand/tree/google-baseurl-example

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2025

🦋 Changeset detected

Latest commit: 1e7e69a

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

This PR includes changesets to release 2 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-evals 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

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 12, 2025

Greptile Overview

Greptile Summary

Adds support for custom baseURL in the Google Computer Use Agent client, enabling requests to be proxied through user-defined endpoints. The implementation extracts baseURL from clientOptions and configures the GoogleGenAI client using httpOptions.baseUrl, aligning with patterns used in Anthropic and OpenAI CUA clients.

Confidence Score: 4/5

  • This PR is safe to merge with one minor property naming inconsistency that should be corrected
  • The implementation correctly adds baseURL support following the same pattern as other CUA clients. However, there's a property naming inconsistency in clientOptions storage (line 100 uses baseURL while the Google SDK expects baseUrl) that could cause issues if this stored value is used elsewhere
  • packages/core/lib/v3/agent/GoogleCUAClient.ts needs attention for the property naming fix on line 100

Important Files Changed

File Analysis

Filename Score Overview
.changeset/shiny-eels-stand.md 5/5 Standard changeset file documenting the baseUrl feature for Google CUA client
packages/core/lib/v3/agent/GoogleCUAClient.ts 4/5 Adds custom baseURL support using httpOptions.baseUrl in GoogleGenAI initialization, with minor inconsistency in clientOptions storage

Sequence Diagram

sequenceDiagram
    participant User
    participant AgentProvider
    participant GoogleCUAClient
    participant GoogleGenAI
    participant ProxyServer

    User->>AgentProvider: getClient(modelName, clientOptions)
    Note over User,AgentProvider: clientOptions contains baseURL
    
    AgentProvider->>GoogleCUAClient: new GoogleCUAClient(type, modelName, instructions, clientOptions)
    
    GoogleCUAClient->>GoogleCUAClient: Extract baseURL from clientOptions
    GoogleCUAClient->>GoogleCUAClient: Build genAIOptions with httpOptions.baseUrl
    
    GoogleCUAClient->>GoogleGenAI: new GoogleGenAI(genAIOptions)
    Note over GoogleGenAI: Configured to use custom baseURL
    
    GoogleCUAClient->>GoogleCUAClient: Store baseURL in clientOptions
    
    User->>GoogleCUAClient: execute(executionOptions)
    GoogleCUAClient->>GoogleGenAI: models.generateContent()
    
    alt Custom baseURL provided
        GoogleGenAI->>ProxyServer: API request via custom baseURL
        ProxyServer->>GoogleGenAI: Response
    else No custom baseURL
        GoogleGenAI->>GoogleGenAI: API request to default endpoint
    end
    
    GoogleGenAI-->>GoogleCUAClient: GenerateContentResponse
    GoogleCUAClient-->>User: AgentResult
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@tkattkat tkattkat merged commit 92d32ea into main Nov 12, 2025
15 checks passed
miguelg719 pushed a commit that referenced this pull request Nov 14, 2025
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/stagehand@3.0.2

### Patch Changes

- [#1245](#1245)
[`a224b33`](a224b33)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - allow act()
to call hover()

- [#1234](#1234)
[`6fc9de2`](6fc9de2)
Thanks [@miguelg719](https://github.com/miguelg719)! - Add a
page.sendCDP method

- [#1233](#1233)
[`4935be7`](4935be7)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - extend
page.screenshot() options to mirror playwright

- [#1232](#1232)
[`bdd76fc`](bdd76fc)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - export Page
type

- [#1229](#1229)
[`7ea18a4`](7ea18a4)
Thanks [@tkattkat](https://github.com/tkattkat)! - Adjust extract tool +
expose extract response in agent result

- [#1239](#1239)
[`d4de014`](d4de014)
Thanks [@miguelg719](https://github.com/miguelg719)! - Fix
stagehand.metrics on api mode

- [#1241](#1241)
[`2d1b573`](2d1b573)
Thanks [@miguelg719](https://github.com/miguelg719)! - Return response
on page.goto api mode

- [#1253](#1253)
[`5556041`](5556041)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix missing
page issue when connecting to existing browser

- [#1235](#1235)
[`7e4b43e`](7e4b43e)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - make
page.goto() return a Response object

- [#1254](#1254)
[`7e72adf`](7e72adf)
Thanks [@sameelarif](https://github.com/sameelarif)! - Added custom
error types to allow for a smoother debugging experience.

- [#1227](#1227)
[`9bf09d0`](9bf09d0)
Thanks [@miguelg719](https://github.com/miguelg719)! - Fix readme's
media links and add instructions for installing from a branch

- [#1257](#1257)
[`92d32ea`](92d32ea)
Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for a
custom baseUrl with google cua client

- [#1230](#1230)
[`ebcf3a1`](ebcf3a1)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add
stagehand.browserbaseSessionID getter

- [#1262](#1262)
[`c29a4f2`](c29a4f2)
Thanks [@miguelg719](https://github.com/miguelg719)! - Remove error
throwing when api and experimental are both set

- [#1223](#1223)
[`6d21efa`](6d21efa)
Thanks [@miguelg719](https://github.com/miguelg719)! - Disable api mode
when using custom LLM clients

- [#1228](#1228)
[`525ef0c`](525ef0c)
Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - update slack link
in docs

- [#1226](#1226)
[`9ddb872`](9ddb872)
Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add support
for page.on('console') events

## @browserbasehq/stagehand-evals@1.1.2

### Patch Changes

- Updated dependencies
\[[`a224b33`](a224b33),
[`6fc9de2`](6fc9de2),
[`4935be7`](4935be7),
[`bdd76fc`](bdd76fc),
[`7ea18a4`](7ea18a4),
[`d4de014`](d4de014),
[`2d1b573`](2d1b573),
[`5556041`](5556041),
[`7e4b43e`](7e4b43e),
[`7e72adf`](7e72adf),
[`9bf09d0`](9bf09d0),
[`92d32ea`](92d32ea),
[`ebcf3a1`](ebcf3a1),
[`c29a4f2`](c29a4f2),
[`6d21efa`](6d21efa),
[`525ef0c`](525ef0c),
[`9ddb872`](9ddb872)]:
    -   @browserbasehq/stagehand@3.0.2

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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