Repository navigation
fix: support Claude 4.6 CUA tool version - #1729
Conversation
🦋 Changeset detectedLatest commit: 7c0a52c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 SummaryThis PR adds support for Claude 4.6 models (Opus and Sonnet) by implementing conditional tool version selection for Anthropic's Computer Use API. The newer 4.6 models require Key changes:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 493da43 |
There was a problem hiding this comment.
2 issues found across 4 files
Confidence score: 3/5
- Hardcoded model allowlists in
packages/core/lib/v3/agent/AgentProvider.tsexpand a known anti-pattern, increasing maintenance burden and risk of missing newer models at runtime. - A similar hardcoded addition in
packages/core/lib/v3/types/public/agent.tsrepeats the same issue, making future model support more fragile. - These are medium-severity concerns (7/10) with clear design/maintenance impact, so there is some risk despite being localized.
- Pay close attention to
packages/core/lib/v3/agent/AgentProvider.tsandpackages/core/lib/v3/types/public/agent.ts- hardcoded model allowlist growth.
Prompt for AI agents (all 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/agent/AgentProvider.ts">
<violation number="1" location="packages/core/lib/v3/agent/AgentProvider.ts:24">
P1: Custom agent: **Ensure we never check against hardcoded lists of allowed LLM model names**
Adding another hardcoded model name to `modelToAgentProviderMap` perpetuates the hardcoded-allowlist anti-pattern. Per the rule, newly added code should accept any model name (preferably in `provider/model-name` format) and let the LLM provider reject unsupported models.
Since you're touching this map, consider refactoring `getAgentProvider` to infer the provider from a `provider/model-name` convention (e.g. `anthropic/claude-sonnet-4-6`) or accept an explicit `provider` option, falling back to this map only as a convenience. That way new models work immediately without code changes.</violation>
</file>
<file name="packages/core/lib/v3/types/public/agent.ts">
<violation number="1" location="packages/core/lib/v3/types/public/agent.ts:429">
P1: Custom agent: **Ensure we never check against hardcoded lists of allowed LLM model names**
This PR adds yet another model to a hardcoded allowlist — which is exactly the maintenance burden Rule 1 warns against. Every new Claude/OpenAI/Google model release will require a code change here.
Since you're already touching `AVAILABLE_CUA_MODELS`, consider refactoring CUA mode to accept any `provider/model-name` string and let the upstream API reject unsupported models, rather than maintaining this ever-growing allowlist. If the list is needed for TypeScript autocompletion, consider making it a suggested-values type (e.g., `string & {}` union) rather than a strict constraint.</violation>
</file>
Architecture diagram
sequenceDiagram
participant Runner as Stagehand Runner
participant Provider as AgentProvider
participant CUA as AnthropicCUAClient
participant Anthropic as Anthropic API
Note over Runner,Anthropic: Computer Use Agent (CUA) Request Flow
Runner->>Provider: Request action (model: claude-sonnet-4-6)
Provider->>Provider: CHANGED: Map model to "anthropic" provider
Provider->>CUA: getAction(messages, model)
Note over CUA: NEW: Version Selection Logic
alt Model is Claude 4.6 (Opus/Sonnet) OR Opus 4.5
CUA->>CUA: NEW: Set tool type: "computer_20251124"
CUA->>CUA: NEW: Set beta header: "computer-use-2025-11-24"
else Older CUA-capable models (e.g. Sonnet 4)
CUA->>CUA: Use tool type: "computer_20250124"
CUA->>CUA: Use legacy beta header
end
CUA->>Anthropic: POST /v1/messages
Note right of CUA: Includes selected tool version<br/>and required beta headers
alt Successful Tool Call
Anthropic-->>CUA: 200 OK (tool_use block)
CUA-->>Runner: Return browser action
else Model/Tool Version Mismatch
Anthropic-->>CUA: 400 Bad Request
CUA-->>Runner: Error: Unsupported tool version
end
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| @@ -426,6 +426,7 @@ export const AVAILABLE_CUA_MODELS = [ | |||
| "anthropic/claude-3-7-sonnet-latest", | |||
| "anthropic/claude-opus-4-5-20251101", | |||
| "anthropic/claude-opus-4-6", | |||
| "anthropic/claude-sonnet-4-6", | |||
There was a problem hiding this comment.
P1: Custom agent: Ensure we never check against hardcoded lists of allowed LLM model names
This PR adds yet another model to a hardcoded allowlist — which is exactly the maintenance burden Rule 1 warns against. Every new Claude/OpenAI/Google model release will require a code change here.
Since you're already touching AVAILABLE_CUA_MODELS, consider refactoring CUA mode to accept any provider/model-name string and let the upstream API reject unsupported models, rather than maintaining this ever-growing allowlist. If the list is needed for TypeScript autocompletion, consider making it a suggested-values type (e.g., string & {} union) rather than a strict constraint.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/lib/v3/types/public/agent.ts, line 429:
<comment>This PR adds yet another model to a hardcoded allowlist — which is exactly the maintenance burden Rule 1 warns against. Every new Claude/OpenAI/Google model release will require a code change here.
Since you're already touching `AVAILABLE_CUA_MODELS`, consider refactoring CUA mode to accept any `provider/model-name` string and let the upstream API reject unsupported models, rather than maintaining this ever-growing allowlist. If the list is needed for TypeScript autocompletion, consider making it a suggested-values type (e.g., `string & {}` union) rather than a strict constraint.</comment>
<file context>
@@ -426,6 +426,7 @@ export const AVAILABLE_CUA_MODELS = [
"anthropic/claude-3-7-sonnet-latest",
"anthropic/claude-opus-4-5-20251101",
"anthropic/claude-opus-4-6",
+ "anthropic/claude-sonnet-4-6",
"anthropic/claude-haiku-4-5-20251001",
"anthropic/claude-sonnet-4-20250514",
</file context>
54c3c26 to
34ba3c9
Compare
Claude Opus 4.6 and Sonnet 4.6 require the newer `computer_20251124` tool type and `computer-use-2025-11-24` beta header. The previous hardcoded `computer_20250124` is rejected by the API for these models. - Add conditional tool version selection in AnthropicCUAClient.getAction() - Add claude-sonnet-4-6 to modelToAgentProviderMap and AVAILABLE_CUA_MODELS - Update unit test expectations Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
34ba3c9 to
7c0a52c
Compare
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 - [#1681](#1681) [`e3db9aa`](e3db9aa) Thanks [@tkattkat](https://github.com/tkattkat)! - Add cookie management APIs: `context.addCookies()`, `context.clearCookies()`, & `context.cookies()` - [#1672](#1672) [`b65756e`](b65756e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add boolean keepAlive parameter to allow for configuring whether the browser should be closed when stagehand.close() is called. - [#1708](#1708) [`176d420`](176d420) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add context.setExtraHTTPHeaders() - [#1611](#1611) [`8a3c066`](8a3c066) Thanks [@monadoid](https://github.com/monadoid)! - Using `mode` enum instead of old `cua` boolean in openapi spec ### Patch Changes - [#1683](#1683) [`7584f3e`](7584f3e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: include shadow DOM in .count() & .nth() & support xpath predicates - [#1644](#1644) [`1e1c9c1`](1e1c9c1) Thanks [@monadoid](https://github.com/monadoid)! - Fix unhandled CDP detaches by returning the original sendCDP promise - [#1729](#1729) [`6bef890`](6bef890) Thanks [@shrey150](https://github.com/shrey150)! - fix: support Claude 4.6 (Opus and Sonnet) in CUA mode by using the correct `computer_20251124` tool version and `computer-use-2025-11-24` beta header - [#1647](#1647) [`ffd4b33`](ffd4b33) Thanks [@tkattkat](https://github.com/tkattkat)! - Fix [Agent] - Address bug causing issues with continuing a conversation from past messages in dom mode - [#1614](#1614) [`677bff5`](677bff5) Thanks [@miguelg719](https://github.com/miguelg719)! - Enforce <number>-<number> regex validation on act/observe for elementId - [#1580](#1580) [`65ff464`](65ff464) Thanks [@tkattkat](https://github.com/tkattkat)! - Add unified variables support across act and agent with a single VariableValue type - [#1666](#1666) [`101bcf2`](101bcf2) Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - add support for codex models - [#1728](#1728) [`0a94301`](0a94301) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - handle potential race condition on `.close()` when using the Stagehand API - [#1664](#1664) [`b27c04d`](b27c04d) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fixes issue with context.addInitScript() where scripts were not being applied to out of process iframes (OOPIFs), and popup pages with same process iframes (SPIFs) - [#1632](#1632) [`afbd08b`](afbd08b) Thanks [@pirate](https://github.com/pirate)! - Remove automatic `.env` loading via `dotenv`. If your app relies on `.env` files, install `dotenv` and load it explicitly in your code: ```ts import dotenv from "dotenv"; dotenv.config({ path: ".env" }); ``` - [#1624](#1624) [`0e8d569`](0e8d569) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where screenshot masks were not being applied to dialog elements - [#1596](#1596) [`ff0f979`](ff0f979) Thanks [@tkattkat](https://github.com/tkattkat)! - Update usage/metrics handling in agent - [#1631](#1631) [`2d89d2b`](2d89d2b) Thanks [@miguelg719](https://github.com/miguelg719)! - Add right and middle click support to act and observe - [#1697](#1697) [`aac9a19`](aac9a19) Thanks [@shrey150](https://github.com/shrey150)! - fix: support `<frame>` elements in XPath frame boundary detection so `act()` works on legacy `<frameset>` pages - [#1692](#1692) [`06de50f`](06de50f) Thanks [@shrey150](https://github.com/shrey150)! - fix: skip piercer injection for chrome-extension:// and other non-HTML targets - [#1613](#1613) [`aa4d981`](aa4d981) Thanks [@miguelg719](https://github.com/miguelg719)! - SupportedUnderstudyAction Enum validation for 'method' on act/observe inference - [#1652](#1652) [`18b1e3b`](18b1e3b) Thanks [@miguelg719](https://github.com/miguelg719)! - Add support for gemini 3 flash and pro in hybrid/cua agent - [#1706](#1706) [`957d82b`](957d82b) Thanks [@chrisreadsf](https://github.com/chrisreadsf)! - Add GLM to prompt-based JSON fallback for models without native structured output support - [#1633](#1633) [`22e371a`](22e371a) Thanks [@tkattkat](https://github.com/tkattkat)! - Add warning when incorrect models are used with agents hybrid mode - [#1673](#1673) [`d29b91f`](d29b91f) Thanks [@miguelg719](https://github.com/miguelg719)! - Add multi-region support for Stagehand API with region-specific endpoints - [#1695](#1695) [`7b4f817`](7b4f817) Thanks [@tkattkat](https://github.com/tkattkat)! - Fix: zod bug when pinning zod to v3 and using structured output in agent - [#1609](#1609) [`3f9ca4d`](3f9ca4d) Thanks [@miguelg719](https://github.com/miguelg719)! - Add SupportedUnderstudyActions to observe system prompt - [#1581](#1581) [`49ead1e`](49ead1e) Thanks [@sameelarif](https://github.com/sameelarif)! - **Server-side caching is now available.** When running `env: "BROWSERBASE"`, Stagehand automatically caches `act()`, `extract()`, and `observe()` results server-side — repeated calls with the same inputs return instantly without consuming LLM tokens. Caching is enabled by default and can be disabled via `serverCache: false` on the Stagehand instance or per individual call. Check out the [browserbase blog](https://www.browserbase.com/blog/stagehand-caching) for more details. - [#1642](#1642) [`3673369`](3673369) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where scripts added via context.addInitScripts() were not being injected into new pages that were opened via popups (eg, clicking a link that opens a new page) and/or calling context.newPage(url) - [#1735](#1735) [`c465e87`](c465e87) Thanks [@monadoid](https://github.com/monadoid)! - Supports request header authentication with connectToMCPServer - [#1705](#1705) [`ae533e4`](ae533e4) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - include error cause in UnderstudyCommandException - [#1636](#1636) [`ea33052`](ea33052) Thanks [@miguelg719](https://github.com/miguelg719)! - Include executionModel on the AgentConfigSchema - [#1679](#1679) [`5764ede`](5764ede) Thanks [@shrey150](https://github.com/shrey150)! - fix issue where locator.count() was not working with xpaths that have attribute predicates - [#1646](#1646) [`f09b184`](f09b184) Thanks [@miguelg719](https://github.com/miguelg719)! - Add user-agent to CDP connections - [#1637](#1637) [`a7d29de`](a7d29de) Thanks [@miguelg719](https://github.com/miguelg719)! - Improve error and warning message for legacy model format - [#1685](#1685) [`d334399`](d334399) Thanks [@tkattkat](https://github.com/tkattkat)! - Bump ai sdk & google provider version - [#1662](#1662) [`44416da`](44416da) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where locator.fill() was not working on elements that require direct value setting - [#1612](#1612) [`bdd8b4e`](bdd8b4e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where screenshot mask was only being applied to the first element that the locator resolved to. masks now apply to all matching elements. ## @browserbasehq/[email protected] ### Minor Changes - [#1611](#1611) [`8a3c066`](8a3c066) Thanks [@monadoid](https://github.com/monadoid)! - Using `mode` enum instead of old `cua` boolean in openapi spec ### Patch Changes - [#1604](#1604) [`4753078`](4753078) Thanks [@miguelg719](https://github.com/miguelg719)! - Enable bedrock - [#1636](#1636) [`ea33052`](ea33052) Thanks [@miguelg719](https://github.com/miguelg719)! - Include executionModel on the AgentConfigSchema - [#1602](#1602) [`22a0502`](22a0502) Thanks [@miguelg719](https://github.com/miguelg719)! - Include vertex as a supported provider - Updated dependencies \[[`7584f3e`](7584f3e), [`1e1c9c1`](1e1c9c1), [`6bef890`](6bef890), [`ffd4b33`](ffd4b33), [`677bff5`](677bff5), [`65ff464`](65ff464), [`101bcf2`](101bcf2), [`0a94301`](0a94301), [`b27c04d`](b27c04d), [`afbd08b`](afbd08b), [`e3db9aa`](e3db9aa), [`0e8d569`](0e8d569), [`ff0f979`](ff0f979), [`2d89d2b`](2d89d2b), [`aac9a19`](aac9a19), [`06de50f`](06de50f), [`aa4d981`](aa4d981), [`18b1e3b`](18b1e3b), [`957d82b`](957d82b), [`b65756e`](b65756e), [`22e371a`](22e371a), [`d29b91f`](d29b91f), [`7b4f817`](7b4f817), [`176d420`](176d420), [`3f9ca4d`](3f9ca4d), [`8a3c066`](8a3c066), [`49ead1e`](49ead1e), [`3673369`](3673369), [`c465e87`](c465e87), [`ae533e4`](ae533e4), [`ea33052`](ea33052), [`5764ede`](5764ede), [`f09b184`](f09b184), [`a7d29de`](a7d29de), [`d334399`](d334399), [`44416da`](44416da), [`bdd8b4e`](bdd8b4e)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`7584f3e`](7584f3e), [`1e1c9c1`](1e1c9c1), [`6bef890`](6bef890), [`ffd4b33`](ffd4b33), [`677bff5`](677bff5), [`65ff464`](65ff464), [`101bcf2`](101bcf2), [`0a94301`](0a94301), [`b27c04d`](b27c04d), [`afbd08b`](afbd08b), [`e3db9aa`](e3db9aa), [`0e8d569`](0e8d569), [`ff0f979`](ff0f979), [`2d89d2b`](2d89d2b), [`aac9a19`](aac9a19), [`06de50f`](06de50f), [`aa4d981`](aa4d981), [`18b1e3b`](18b1e3b), [`957d82b`](957d82b), [`b65756e`](b65756e), [`22e371a`](22e371a), [`d29b91f`](d29b91f), [`7b4f817`](7b4f817), [`176d420`](176d420), [`3f9ca4d`](3f9ca4d), [`8a3c066`](8a3c066), [`49ead1e`](49ead1e), [`3673369`](3673369), [`c465e87`](c465e87), [`ae533e4`](ae533e4), [`ea33052`](ea33052), [`5764ede`](5764ede), [`f09b184`](f09b184), [`a7d29de`](a7d29de), [`d334399`](d334399), [`44416da`](44416da), [`bdd8b4e`](bdd8b4e)]: - @browserbasehq/[email protected] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Resolve conflict in AnthropicCUAClient.ts: keep dynamic computerToolType from PR #1729 (Claude 4.6 CUA support). Co-Authored-By: Claude Opus 4.6 <[email protected]>
## Summary - Claude Opus 4.6 and Sonnet 4.6 require the newer `computer_20251124` tool type and `computer-use-2025-11-24` beta header for CUA mode - The previous hardcoded `computer_20250124` is rejected by the Anthropic API for these models - Adds conditional tool version selection in `AnthropicCUAClient.getAction()` — older models are unaffected - Adds `claude-sonnet-4-6` to model maps (Opus 4.6 was already present) ## Test plan - [x] Direct Anthropic API calls confirmed both Opus 4.6 and Sonnet 4.6 work with `computer_20251124` - [x] Stagehand `env: "LOCAL"` CUA mode tested — both models successfully completed tasks - [x] Unit tests pass (18/18 in `llm-and-agents.test.ts`) - [ ] Verify older models (Sonnet 4, Sonnet 4.5, Haiku 4.5) still work with `computer_20250124` 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds CUA support for Claude Opus 4.6 and Sonnet 4.6 by switching to the computer_20251124 tool and computer-use-2025-11-24 beta. Older models continue using computer_20250124 to avoid API rejections. - **Bug Fixes** - Select tool/beta per model in AnthropicCUAClient.getAction(), including prefixed names. - Use new tool/beta for claude-opus-4-6, claude-sonnet-4-6, and claude-opus-4-5-20251101. - Add claude-sonnet-4-6 to modelToAgentProviderMap and AVAILABLE_CUA_MODELS; update unit tests. <sup>Written for commit 7c0a52c. Summary will update on new commits. <a href="https://cubic.dev/pr/browserbase/stagehand/pull/1729">Review in cubic</a></sup> <!-- End of auto-generated description by cubic. -->
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#1681](browserbase#1681) [`e3db9aa`](browserbase@e3db9aa) Thanks [@tkattkat](https://github.com/tkattkat)! - Add cookie management APIs: `context.addCookies()`, `context.clearCookies()`, & `context.cookies()` - [browserbase#1672](browserbase#1672) [`b65756e`](browserbase@b65756e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add boolean keepAlive parameter to allow for configuring whether the browser should be closed when stagehand.close() is called. - [browserbase#1708](browserbase#1708) [`176d420`](browserbase@176d420) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add context.setExtraHTTPHeaders() - [browserbase#1611](browserbase#1611) [`8a3c066`](browserbase@8a3c066) Thanks [@monadoid](https://github.com/monadoid)! - Using `mode` enum instead of old `cua` boolean in openapi spec ### Patch Changes - [browserbase#1683](browserbase#1683) [`7584f3e`](browserbase@7584f3e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: include shadow DOM in .count() & .nth() & support xpath predicates - [browserbase#1644](browserbase#1644) [`1e1c9c1`](browserbase@1e1c9c1) Thanks [@monadoid](https://github.com/monadoid)! - Fix unhandled CDP detaches by returning the original sendCDP promise - [browserbase#1729](browserbase#1729) [`6bef890`](browserbase@6bef890) Thanks [@shrey150](https://github.com/shrey150)! - fix: support Claude 4.6 (Opus and Sonnet) in CUA mode by using the correct `computer_20251124` tool version and `computer-use-2025-11-24` beta header - [browserbase#1647](browserbase#1647) [`ffd4b33`](browserbase@ffd4b33) Thanks [@tkattkat](https://github.com/tkattkat)! - Fix [Agent] - Address bug causing issues with continuing a conversation from past messages in dom mode - [browserbase#1614](browserbase#1614) [`677bff5`](browserbase@677bff5) Thanks [@miguelg719](https://github.com/miguelg719)! - Enforce <number>-<number> regex validation on act/observe for elementId - [browserbase#1580](browserbase#1580) [`65ff464`](browserbase@65ff464) Thanks [@tkattkat](https://github.com/tkattkat)! - Add unified variables support across act and agent with a single VariableValue type - [browserbase#1666](browserbase#1666) [`101bcf2`](browserbase@101bcf2) Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - add support for codex models - [browserbase#1728](browserbase#1728) [`0a94301`](browserbase@0a94301) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - handle potential race condition on `.close()` when using the Stagehand API - [browserbase#1664](browserbase#1664) [`b27c04d`](browserbase@b27c04d) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fixes issue with context.addInitScript() where scripts were not being applied to out of process iframes (OOPIFs), and popup pages with same process iframes (SPIFs) - [browserbase#1632](browserbase#1632) [`afbd08b`](browserbase@afbd08b) Thanks [@pirate](https://github.com/pirate)! - Remove automatic `.env` loading via `dotenv`. If your app relies on `.env` files, install `dotenv` and load it explicitly in your code: ```ts import dotenv from "dotenv"; dotenv.config({ path: ".env" }); ``` - [browserbase#1624](browserbase#1624) [`0e8d569`](browserbase@0e8d569) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where screenshot masks were not being applied to dialog elements - [browserbase#1596](browserbase#1596) [`ff0f979`](browserbase@ff0f979) Thanks [@tkattkat](https://github.com/tkattkat)! - Update usage/metrics handling in agent - [browserbase#1631](browserbase#1631) [`2d89d2b`](browserbase@2d89d2b) Thanks [@miguelg719](https://github.com/miguelg719)! - Add right and middle click support to act and observe - [browserbase#1697](browserbase#1697) [`aac9a19`](browserbase@aac9a19) Thanks [@shrey150](https://github.com/shrey150)! - fix: support `<frame>` elements in XPath frame boundary detection so `act()` works on legacy `<frameset>` pages - [browserbase#1692](browserbase#1692) [`06de50f`](browserbase@06de50f) Thanks [@shrey150](https://github.com/shrey150)! - fix: skip piercer injection for chrome-extension:// and other non-HTML targets - [browserbase#1613](browserbase#1613) [`aa4d981`](browserbase@aa4d981) Thanks [@miguelg719](https://github.com/miguelg719)! - SupportedUnderstudyAction Enum validation for 'method' on act/observe inference - [browserbase#1652](browserbase#1652) [`18b1e3b`](browserbase@18b1e3b) Thanks [@miguelg719](https://github.com/miguelg719)! - Add support for gemini 3 flash and pro in hybrid/cua agent - [browserbase#1706](browserbase#1706) [`957d82b`](browserbase@957d82b) Thanks [@chrisreadsf](https://github.com/chrisreadsf)! - Add GLM to prompt-based JSON fallback for models without native structured output support - [browserbase#1633](browserbase#1633) [`22e371a`](browserbase@22e371a) Thanks [@tkattkat](https://github.com/tkattkat)! - Add warning when incorrect models are used with agents hybrid mode - [browserbase#1673](browserbase#1673) [`d29b91f`](browserbase@d29b91f) Thanks [@miguelg719](https://github.com/miguelg719)! - Add multi-region support for Stagehand API with region-specific endpoints - [browserbase#1695](browserbase#1695) [`7b4f817`](browserbase@7b4f817) Thanks [@tkattkat](https://github.com/tkattkat)! - Fix: zod bug when pinning zod to v3 and using structured output in agent - [browserbase#1609](browserbase#1609) [`3f9ca4d`](browserbase@3f9ca4d) Thanks [@miguelg719](https://github.com/miguelg719)! - Add SupportedUnderstudyActions to observe system prompt - [browserbase#1581](browserbase#1581) [`49ead1e`](browserbase@49ead1e) Thanks [@sameelarif](https://github.com/sameelarif)! - **Server-side caching is now available.** When running `env: "BROWSERBASE"`, Stagehand automatically caches `act()`, `extract()`, and `observe()` results server-side — repeated calls with the same inputs return instantly without consuming LLM tokens. Caching is enabled by default and can be disabled via `serverCache: false` on the Stagehand instance or per individual call. Check out the [browserbase blog](https://www.browserbase.com/blog/stagehand-caching) for more details. - [browserbase#1642](browserbase#1642) [`3673369`](browserbase@3673369) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where scripts added via context.addInitScripts() were not being injected into new pages that were opened via popups (eg, clicking a link that opens a new page) and/or calling context.newPage(url) - [browserbase#1735](browserbase#1735) [`c465e87`](browserbase@c465e87) Thanks [@monadoid](https://github.com/monadoid)! - Supports request header authentication with connectToMCPServer - [browserbase#1705](browserbase#1705) [`ae533e4`](browserbase@ae533e4) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - include error cause in UnderstudyCommandException - [browserbase#1636](browserbase#1636) [`ea33052`](browserbase@ea33052) Thanks [@miguelg719](https://github.com/miguelg719)! - Include executionModel on the AgentConfigSchema - [browserbase#1679](browserbase#1679) [`5764ede`](browserbase@5764ede) Thanks [@shrey150](https://github.com/shrey150)! - fix issue where locator.count() was not working with xpaths that have attribute predicates - [browserbase#1646](browserbase#1646) [`f09b184`](browserbase@f09b184) Thanks [@miguelg719](https://github.com/miguelg719)! - Add user-agent to CDP connections - [browserbase#1637](browserbase#1637) [`a7d29de`](browserbase@a7d29de) Thanks [@miguelg719](https://github.com/miguelg719)! - Improve error and warning message for legacy model format - [browserbase#1685](browserbase#1685) [`d334399`](browserbase@d334399) Thanks [@tkattkat](https://github.com/tkattkat)! - Bump ai sdk & google provider version - [browserbase#1662](browserbase#1662) [`44416da`](browserbase@44416da) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where locator.fill() was not working on elements that require direct value setting - [browserbase#1612](browserbase#1612) [`bdd8b4e`](browserbase@bdd8b4e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix issue where screenshot mask was only being applied to the first element that the locator resolved to. masks now apply to all matching elements. ## @browserbasehq/[email protected] ### Minor Changes - [browserbase#1611](browserbase#1611) [`8a3c066`](browserbase@8a3c066) Thanks [@monadoid](https://github.com/monadoid)! - Using `mode` enum instead of old `cua` boolean in openapi spec ### Patch Changes - [browserbase#1604](browserbase#1604) [`4753078`](browserbase@4753078) Thanks [@miguelg719](https://github.com/miguelg719)! - Enable bedrock - [browserbase#1636](browserbase#1636) [`ea33052`](browserbase@ea33052) Thanks [@miguelg719](https://github.com/miguelg719)! - Include executionModel on the AgentConfigSchema - [browserbase#1602](browserbase#1602) [`22a0502`](browserbase@22a0502) Thanks [@miguelg719](https://github.com/miguelg719)! - Include vertex as a supported provider - Updated dependencies \[[`7584f3e`](browserbase@7584f3e), [`1e1c9c1`](browserbase@1e1c9c1), [`6bef890`](browserbase@6bef890), [`ffd4b33`](browserbase@ffd4b33), [`677bff5`](browserbase@677bff5), [`65ff464`](browserbase@65ff464), [`101bcf2`](browserbase@101bcf2), [`0a94301`](browserbase@0a94301), [`b27c04d`](browserbase@b27c04d), [`afbd08b`](browserbase@afbd08b), [`e3db9aa`](browserbase@e3db9aa), [`0e8d569`](browserbase@0e8d569), [`ff0f979`](browserbase@ff0f979), [`2d89d2b`](browserbase@2d89d2b), [`aac9a19`](browserbase@aac9a19), [`06de50f`](browserbase@06de50f), [`aa4d981`](browserbase@aa4d981), [`18b1e3b`](browserbase@18b1e3b), [`957d82b`](browserbase@957d82b), [`b65756e`](browserbase@b65756e), [`22e371a`](browserbase@22e371a), [`d29b91f`](browserbase@d29b91f), [`7b4f817`](browserbase@7b4f817), [`176d420`](browserbase@176d420), [`3f9ca4d`](browserbase@3f9ca4d), [`8a3c066`](browserbase@8a3c066), [`49ead1e`](browserbase@49ead1e), [`3673369`](browserbase@3673369), [`c465e87`](browserbase@c465e87), [`ae533e4`](browserbase@ae533e4), [`ea33052`](browserbase@ea33052), [`5764ede`](browserbase@5764ede), [`f09b184`](browserbase@f09b184), [`a7d29de`](browserbase@a7d29de), [`d334399`](browserbase@d334399), [`44416da`](browserbase@44416da), [`bdd8b4e`](browserbase@bdd8b4e)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`7584f3e`](browserbase@7584f3e), [`1e1c9c1`](browserbase@1e1c9c1), [`6bef890`](browserbase@6bef890), [`ffd4b33`](browserbase@ffd4b33), [`677bff5`](browserbase@677bff5), [`65ff464`](browserbase@65ff464), [`101bcf2`](browserbase@101bcf2), [`0a94301`](browserbase@0a94301), [`b27c04d`](browserbase@b27c04d), [`afbd08b`](browserbase@afbd08b), [`e3db9aa`](browserbase@e3db9aa), [`0e8d569`](browserbase@0e8d569), [`ff0f979`](browserbase@ff0f979), [`2d89d2b`](browserbase@2d89d2b), [`aac9a19`](browserbase@aac9a19), [`06de50f`](browserbase@06de50f), [`aa4d981`](browserbase@aa4d981), [`18b1e3b`](browserbase@18b1e3b), [`957d82b`](browserbase@957d82b), [`b65756e`](browserbase@b65756e), [`22e371a`](browserbase@22e371a), [`d29b91f`](browserbase@d29b91f), [`7b4f817`](browserbase@7b4f817), [`176d420`](browserbase@176d420), [`3f9ca4d`](browserbase@3f9ca4d), [`8a3c066`](browserbase@8a3c066), [`49ead1e`](browserbase@49ead1e), [`3673369`](browserbase@3673369), [`c465e87`](browserbase@c465e87), [`ae533e4`](browserbase@ae533e4), [`ea33052`](browserbase@ea33052), [`5764ede`](browserbase@5764ede), [`f09b184`](browserbase@f09b184), [`a7d29de`](browserbase@a7d29de), [`d334399`](browserbase@d334399), [`44416da`](browserbase@44416da), [`bdd8b4e`](browserbase@bdd8b4e)]: - @browserbasehq/[email protected]
Summary
computer_20251124tool type andcomputer-use-2025-11-24beta header for CUA modecomputer_20250124is rejected by the Anthropic API for these modelsAnthropicCUAClient.getAction()— older models are unaffectedclaude-sonnet-4-6to model maps (Opus 4.6 was already present)Test plan
computer_20251124env: "LOCAL"CUA mode tested — both models successfully completed tasksllm-and-agents.test.ts)computer_20250124🤖 Generated with Claude Code
Summary by cubic
Adds CUA support for Claude Opus 4.6 and Sonnet 4.6 by switching to the computer_20251124 tool and computer-use-2025-11-24 beta. Older models continue using computer_20250124 to avoid API rejections.
Written for commit 7c0a52c. Summary will update on new commits. Review in cubic