-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Is your feature request related to a problem? Please describe.
We're using Vertex AI in our organisation for managing our requests and models. We'd like to continue to use it as we're playing around with Stagehand and can use it with AISdkClient for the basic act, extract, etc. However we can't seem to figure out a way to use it alongside the agent functionality.
The following works:
import { createVertex } from "@ai-sdk/google-vertex";
import { Stagehand, AISdkClient } from "@browserbasehq/stagehand";
const vertex = createVertex({
project: "some-project",
location: "australia-southeast1",
});
const stagehand = new Stagehand({
env: "LOCAL",
llmClient: new AISdkClient({
model: vertex("gemini-2.5-flash")
}),
});
await stagehand.init();
const page = stagehand.context.pages()[0];
await page.goto("https://google.com");
await stagehand.act('Enter "Japanese Donburi, Sydney CBD" into search');
await stagehand.act("Click on the Google Search button");However if I try to use the agent:
const agent = stagehand.agent();
const res = await agent.execute(
"Find the best restaurant in the Sydney CBD that serves Japanese Donburi",
);It gives the following error:
{
success: false,
actions: [],
message: "Failed to execute task: V3AgentHandler requires an AISDK-backed LLM client. Ensure your model is configured like 'op
enai/gpt-4.1-mini'.",
completed: false
}Describe the solution you'd like
Ideally we would be able to default to using the same AISdkClient as provided when initialising and also allow a custom llmClient:
const agent = stagehand.agent({
cua: true,
llmClient: new AISdkClient({
model: vertex("gemini-2.5-computer-use-preview")
}),
})Describe alternatives you've considered
I've tried a few different methods of getting this to work but none of them seem to work at the moment.
Are you willing to contribute to implementing this feature or fix?
- Yes, I can submit a PR
- Yes, but I need guidance
- Maybe, depending on how complex the fix would be
- No, I cannot contribute at this time