Skip to content

stagehand-python@4.4.0a0.dev1662

@akeimach akeimach tagged this 29 Oct 18:59
# why

Fixes https://github.com/browserbase/stagehand/issues/3337

The extension used `@ai-sdk/anthropic` 4.0.8 which predates opus 5.5.
For structured output, it sent a forced tool call (`tool_choice: { type:
"any" }`), which opus 5.5 rejected. Because of this, `act`, `observe`
and `extract` were also failing.

# what changed

- Bump `@ai-sdk/anthropic` to ^4.0.90. This version uses native
structured output for Opus 5.5.
- Bump `ai` to ^7.0.155. It must use the same `@ai-sdk/provider` version
as the new Anthropic package.
- Pin `@ai-sdk/anthropic` to 4.0.26 in mastra-sdk to match the
`@ai-sdk/provider` version that `@mastra/core` uses

# test plan

- Added a gateway test fixture to catch when tool choice is required but
the reply has no tool call


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Bumps `@ai-sdk/anthropic` and `ai` in the extension so it works with
Claude Opus 5.5, fixing `act`, `observe`, and `extract` failures for
that model.

- Fixes #3337, where forced tool calls (`tool_choice: { type: "any" }`)
were rejected by Opus 5.5.
- Updates the mastra-sdk `NativeMastraModel` type to accept both OpenAI
and Anthropic models, since providers can use different
`@ai-sdk/provider` versions.
- Adds a gateway test fixture to catch when tool choice is required but
the reply has no tool call.

<sup>Written for commit a91cae96f07ac7d239a7bcd4f197d9bb53290a1f.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/browserbase/stagehand/pull/3340?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/browserbase/stagehand/3340?returnTo=https%3A%2F%2Fgithub.com%2Fbrowserbase%2Fstagehand%2Fpull%2F3340&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

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