Skip to content

Commit 51e0170

Browse files
authored
Add media resolution high to gemini 3 hybrid agent (#1465)
# why This setting improves the performance of gemini 3 models for computer use applications (recommended by [Deepmind](https://colab.research.google.com/drive/1OK30EUqrukGsYhHQZIlKq3wCNWlfsrkn#scrollTo=APbcS_6TUI8F)) # what changed Added a `providerOption` to google models (specifically filtered by gemini-3) to include MEDIA_RESOLUTION_HIGH (nit: ULTRA_HIGH not supported by aisdk yet) # test plan <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Set the Google provider option mediaResolution to MEDIA_RESOLUTION_HIGH for Gemini 3 models in the hybrid agent to improve computer-use performance. Applied conditionally when the modelId includes "gemini-3" for both step execution and streaming paths. <sup>Written for commit 5e00581. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
1 parent abb3469 commit 51e0170

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.changeset/quiet-needles-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
Add media resolution high provider option to gemini 3 hybrid agent

packages/core/lib/v3/handlers/v3AgentHandler.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,13 @@ export class V3AgentHandler {
273273
prepareStep: callbacks?.prepareStep,
274274
onStepFinish: this.createStepHandler(state, callbacks?.onStepFinish),
275275
abortSignal: preparedOptions.signal,
276+
providerOptions: wrappedModel.modelId.includes("gemini-3")
277+
? {
278+
google: {
279+
mediaResolution: "MEDIA_RESOLUTION_HIGH",
280+
},
281+
}
282+
: undefined,
276283
});
277284

278285
return this.consolidateMetricsAndResult(
@@ -407,6 +414,13 @@ export class V3AgentHandler {
407414
rejectResult(new AgentAbortError(reason));
408415
},
409416
abortSignal: options.signal,
417+
providerOptions: wrappedModel.modelId.includes("gemini-3")
418+
? {
419+
google: {
420+
mediaResolution: "MEDIA_RESOLUTION_HIGH",
421+
},
422+
}
423+
: undefined,
410424
});
411425

412426
const agentStreamResult = streamResult as AgentStreamResult;

0 commit comments

Comments
 (0)