May 13, 2026

Reduce context bloat in Stagehand 3.4

Stagehand 3.4.0 is live.

Use ignoreSelectors to keep noisy parts of a page out of extract() and observe(): ads, nav, modals, related posts, and anything else your agent should ignore.

const article = await stagehand.extract(
  "extract the article title and body",
  z.object({
    title: z.string(),
    body: z.string(),
  }),
  {
    ignoreSelectors: [".ad", ".newsletter-modal"],
  },
);

Plus:

  • Agent variables are now supported in the Stagehand API schema without the experimental requirement.
  • Agent mode now defaults to hybrid for compatible models and DOM mode otherwise.
  • New CUA model support: openai/gpt-5.4-mini, openai/gpt-5.5, and anthropic/claude-haiku-4-5.
  • Better OOPIF frame handling and stronger observe element ID prompting.

Read the Stagehand docs for extract() and observe().