unstale

pypi / stagehand

stagehand

What changed in stagehand 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-23.

13 breaking

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.3 on npm

stagehand 413 changes

Breaking changes 13

  • agent() is gone with no one-for-one replacement; use code mode or build a tool-calling loop around the Stagehand API.

    4.0.0upgrade guide

  • Browser context access moved from the Stagehand instance to the browser handle; page lookups are now async.

    4.0.0upgrade guide

  • serverCache is now cache; enableCaching and cacheDir are gone. Browserbase server caching is on by default, and each call can opt out.

    4.0.0upgrade guide

  • act(), extract(), and observe() now return { data, metadata }; read primitive results from data and call metadata for action ID, cache status, and token usage.

    4.0.0upgrade guide

  • verbose and logger are replaced by a logging object with level, format, and callback settings.

    4.0.0upgrade guide

  • deepLocator() is gone; page.locator() resolves the same selectors, including hop notation and deep XPath.

    4.0.0upgrade guide

  • act(), extract(), and observe() moved from Page to the Stagehand instance; use options.page to target a non-active page.

    4.0.0upgrade guide

  • The Browserbase session ID property is gone; create the session yourself and retain its ID when needed.

    4.0.0upgrade guide

  • Construct Stagehand with Stagehand.create() after launching or connecting a browser; the constructor is private and init() is gone.

    4.0.0upgrade guide

  • modelName and modelClientOptions are replaced by one model object; model names require a provider prefix, and Browserbase can select a model when model is omitted.

    4.0.0upgrade guide

  • extract() now takes the instruction and optional schema as positional arguments; without a schema it returns { extraction: string }.

    4.0.0upgrade guide

  • Metrics access changed from a property to a method.

    4.0.0upgrade guide

  • Stagehand is rebuilt around its v4 browser protocol as a protocol-first monorepo, with TypeScript, Python, and Go SDKs over a shared core.

    4.0.0release notes