Skip to content

[fix]: bump ai-sdk for opus 5.5 support - #3340

Merged
akeimach merged 4 commits into
mainfrom
alyssamaruyama/ap-3103-upgrade-ai-sdk-for-opus-55-compatibility
Oct 29, 2026
Merged

akeimach merged 4 commits into
mainfrom
alyssamaruyama/ap-3103-upgrade-ai-sdk-for-opus-55-compatibility

Conversation

@akeimach

@akeimach akeimach commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

why

Fixes #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

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.

Written for commit a91cae9. Summary will update on new commits.

View guided diff Turn on auto-fix

@changeset-bot

changeset-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a91cae9

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

This PR includes changesets to release 23 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-python Patch
@browserbasehq/stagehand-extension Patch
browse Patch
@browserbasehq/stagehand-examples Patch
@browserbasehq/stagehand-integrations-claude-cua-sdk Patch
@browserbasehq/stagehand-integrations Patch
@browserbasehq/eve Patch
@browserbasehq/stagehand-integrations-gemini-cua-sdk Patch
@browserbasehq/stagehand-integrations-example-pi-facade Patch
@browserbasehq/stagehand-integrations-claude-agent-sdk Patch
@browserbasehq/stagehand-integrations-example-claude-code-facade Patch
@browserbasehq/stagehand-integrations-codex-sdk Patch
@browserbasehq/stagehand-integrations-example-codex-facade Patch
@browserbasehq/stagehand-integrations-cursor-sdk Patch
@browserbasehq/stagehand-integrations-example-cursor-facade Patch
@browserbasehq/stagehand-integrations-deepagents-sdk Patch
@browserbasehq/stagehand-integrations-eve-sdk Patch
@browserbasehq/stagehand-integrations-fx-sdk Patch
@browserbasehq/stagehand-integrations-mastra-sdk Patch
@browserbasehq/stagehand-integrations-example-mastra-facade Patch
@browserbasehq/stagehand-integrations-pi-sdk Patch
@browserbasehq/stagehand-integrations-example-vercel-ai-facade 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

@socket-security

socket-security Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​ai-sdk/​anthropic@​4.0.8 ⏵ 4.0.9093 +1910085 -298100
Updatednpm/​ai@​7.0.16 ⏵ 7.0.1559910010099100

View full report

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant Ext as Stagehand Extension
    participant LLM as LLM Service
    participant SDK as AI SDK (ai + @ai-sdk/anthropic)
    participant Provider as Anthropic Provider
    participant API as Anthropic API (Opus 5.5)

    Note over Ext,API: Structured Output Flow (act/observe/extract)

    Ext->>LLM: generate() with tool definitions + tool_choice: "required"
    LLM->>SDK: generateText() with structured output config
    SDK->>Provider: Convert to Anthropic Responses API format
    Provider->>API: POST /v1/messages/responses (native tool use)
    API-->>Provider: Response with function_call output
    Provider->>Provider: Process native structured output
    Provider-->>SDK: Return validated tool call result
    SDK-->>LLM: Tool call result
    LLM-->>Ext: Parsed action/observation/extraction

    Note over SDK,Provider: Version alignment
    SDK->>SDK: Ensure @ai-sdk/provider version compatibility
    SDK->>Provider: Shared provider interface contract

    Note over Provider,API: Opus 5.5 native structured output
    alt Native structured output supported (new SDK)
        Provider->>API: Use native tool_choice (no forced "any")
        API-->>Provider: Tool call in output
    else Legacy forced tool choice (old SDK)
        Provider->>API: Send tool_choice: { type: "any" }
        API-->>Provider: Rejected - 400 error (model incompatibility)
    end

    Note over LLM,Provider: Gateway Test Fixture (NEW)
    LLM->>Provider: Simulate reply with no tool call
    Provider->>Provider: NEW: Validate tool_choice "required" + missing call
    Provider-->>LLM: Reject with error
    LLM-->>Ext: Handle error as no valid tool call
Loading

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread .changeset/extension-opus-5-5.md Outdated
Comment thread .changeset/extension-opus-5-5.md
@akeimach
akeimach merged commit edb76b0 into main Oct 29, 2026
62 checks passed
@akeimach
akeimach deleted the alyssamaruyama/ap-3103-upgrade-ai-sdk-for-opus-55-compatibility branch October 29, 2026 18:59
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.

v4 extension: act/observe/extract fail on Claude Opus 5.5 (bundled @ai-sdk/anthropic predates the model)

2 participants