Stagehand Python Starter
FreshSource: GitHub | Language: Python
Setup
bash
pip install steel-sdk stagehand python-dotenvExample
python
import os
from steel import Steel
from stagehand import Stagehand
from dotenv import load_dotenv
load_dotenv()
steel = Steel(steel_api_key=os.getenv("STEEL_API_KEY"))
session = steel.sessions.create()
cdp_url = f"wss://connect.steel.dev?apiKey={os.getenv('STEEL_API_KEY')}&sessionId={session.id}"
stagehand = Stagehand(
env="REMOTE",
api_key=os.getenv("OPENAI_API_KEY"),
cdp_url=cdp_url,
)
stagehand.init()
stagehand.page.goto("https://example.com")
stagehand.act("Click the sign up button")
steel.sessions.release(session.id)