Skip to content

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

Closed

Description

@tinadj

Bug

On Stagehand v4 (4.2.1 and 4.3.0), every act, observe and extract call fails when the model is anthropic/claude-opus-5-5:

tool_choice: type "tool" and "any" are not supported for this model.

These primitives run inside the extension's service worker (dist/assets/stagehand-extension.zip), which bundles @ai-sdk/anthropic. The bundled provider's getModelCapabilities doesn't recognize claude-opus-5 or claude-opus-5-5, so the model falls through to the unknown-model row (supportsStructuredOutput: false, maxOutputTokens: 4096). With structuredOutputMode: "auto" that means a forced JSON tool call, which Opus 5.5 rejects.

Reproduction

Clean project with only @browserbasehq/[email protected] and zod installed:

import { Stagehand, browserbase } from '@browserbasehq/stagehand'
import { z } from 'zod'

const modelName = process.argv[2] ?? 'anthropic/claude-opus-5-5'
const browser = await browserbase.launch({
  apiKey: process.env.BROWSERBASE_API_KEY,
  projectId: process.env.BROWSERBASE_PROJECT_ID,
})
const stagehand = await Stagehand.create({ browser, model: { modelName, apiKey: process.env.ANTHROPIC_API_KEY }, cache: false })
const page = await browser.context.activePage()
await page.goto('https://example.com')
console.log(await stagehand.extract('the page title', z.object({ title: z.string() }), { page }))
  • anthropic/claude-opus-5-5: tool_choice: type "tool" and "any" are not supported for this model.
  • anthropic/claude-opus-4-8 (same script): { title: "Example Domain" }

Suggested fix

Bump @ai-sdk/anthropic for the extension. It recognizes Opus 5.5 from 4.0.60 (published 2026-09-22); main locks 4.0.8. With the newer provider, structuredOutputMode: "auto" resolves to native structured output, the same way #2231 fixed Fable 5 with no code changes to the primitives. #3132 fixed the related forced done tool call for Opus 5.5 on v3.

Workaround

A postinstall script that adds claude-opus-5 to the Opus 4.8 capability row in the bundled worker, both inside stagehand-extension.zip and in dist/extension/service-worker.js. Since v4's model config only accepts modelName, apiKey and headers, there's no supported way to pass structuredOutputMode: "outputFormat" instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions