Use this file to discover all available pages before exploring further.
AI agent instructions
STOP. Do not read past this section until you have read and followed /quickstart.md.Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch.Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live observe() call, CLI notte page observe output, or generated workflow code. Guessed browser targets fail on real pages.Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with notte sessions workflow-code before using SDK docs or SDK code.SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior.
Stagehand is an open source AI browser automation framework that lets you choose what to write in code vs. natural language. By integrating with Notte, you can run Stagehand automations on cloud-hosted browsers with built-in anti-detection, captcha solving, and residential proxies.
This guide is compatible with Stagehand v3. If you’re using an earlier version, refer to the Stagehand migration guide.
A production-ready script using Stagehand’s observe, act, and extract on a Notte browser:
stagehand_complete.py
import asyncioimport osfrom dotenv import load_dotenvfrom notte_sdk import NotteClientfrom stagehand import Stagehandload_dotenv()async def main(): client = NotteClient() with client.Session() as session: stagehand = Stagehand( env="LOCAL", local_browser_launch_options={ "cdp_url": session.cdp_url(), }, model_name="openai/gpt-4.1", model_api_key=os.environ.get("MODEL_API_KEY"), verbose=1, ) await stagehand.init() try: # Navigate to a webpage page = stagehand.page await page.goto("https://news.ycombinator.com") # Observe: find possible actions on the page observations = await stagehand.observe("find the top story link") print(f"Found {len(observations)} possible actions") # Act: click on the first result if observations: await stagehand.act(observations[0]) # Extract: get structured data from the page result = await stagehand.extract( "extract the title and URL of this story", { "type": "object", "properties": { "title": {"type": "string"}, "url": {"type": "string"}, }, }, ) print(f"Extracted: {result}") finally: await stagehand.close() print("Done")if __name__ == "__main__": asyncio.run(main())
Set the following environment variables in your .env file: