-
Notifications
You must be signed in to change notification settings - Fork 6
Migrate Python templates from Stagehand SDK v2 to v3 #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Great work on the migration! One suggestion for simplification: Not all templates need Playwright connection For templates that only use act(), extract(), and observe() (without needing Playwright-specific methods like wait_for_load_state(), locator(), or event listeners), you can use the pure Stagehand API without connecting Playwright. Like: council-events, polymarket-research, form-filling, and license-verification all connect via Playwright CDP but only use Stagehand's act() and extract(). |
|
Please can you also update the READMEs for each template for python, referencing the new docs and new syntax? |
| print("4. Verify Browserbase account has sufficient credits") | ||
| print("5. Check if the calendar page structure has changed") | ||
|
|
||
| client.sessions.end(id=session_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are double session end calls here, could this be put in a Finally block?
Restore important descriptive comments across all 18 Python templates: - Replace "V3 BYOB architecture" with "cloud-based browser automation" - Add "Connect to the browser via CDP" comments before sync_playwright sections - Restore Pydantic model explanations and compatibility notes - Restore caching behavior and context management documentation - Restore login/navigation sequence explanations - Keep all Pydantic models using model_json_schema() for extract All templates tested for correctness where API keys available. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Address PR review feedback: - Remove Playwright CDP connection from templates that only use act() and extract() - Use client.sessions.navigate() instead of page.goto() - Move session.end() to finally blocks to avoid duplicate calls - Remove unnecessary inline schema comment - Update READMEs with simplified quickstart instructions Affected templates: council-events, license-verification, form-filling, polymarket-research Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
c21c334 to
7acc570
Compare
Summary
Migrate templates to V3
Testing
🤖 Generated with Claude Code