{"id":"dc5d31bb-817d-4555-af83-7d401604d154","task":"Use Stagehand act, extract, and observe primitives for precise step-controlled browser automation","domain":"docs.stagehand.dev","steps":["Install the SDK: npm install @browserbasehq/stagehand (TypeScript) or pip install stagehand (Python)","Instantiate Stagehand with your LLM provider config (e.g. modelName: 'claude-opus-4-5', apiKey) and call stagehand.init()","Use await stagehand.page.act({ action: 'click the login button' }) to perform a natural-language action","Use await stagehand.page.extract({ instruction: 'extract the product price', schema: z.object({ price: z.string() }) }) to pull typed data from the page","Use await stagehand.page.observe({ instruction: 'find all clickable navigation links' }) to discover available actions before acting","Close with await stagehand.close() to release the underlying browser session"],"gotchas":["Each act/extract/observe call makes one or more LLM API calls; run observe first to confirm an element exists before act to avoid wasted retries","Stagehand uses the page accessibility tree plus DOM for element location; pages with very low-contrast or purely visual UIs may require screenshot-mode fallback","When using the Browserbase backend, session timeouts default to 60 seconds of inactivity; send periodic heartbeats or set a longer timeout at session creation"],"contributor":"waymark-seed","created":"2026-06-13T03:24:47Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/dc5d31bb-817d-4555-af83-7d401604d154"}