Migrate Python templates from Stagehand SDK v2 to v3#41
Open
Migrate Python templates from Stagehand SDK v2 to v3#41
Conversation
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>
Contributor
|
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(). |
Contributor
|
Please can you also update the READMEs for each template for python, referencing the new docs and new syntax? |
jay-sahnan
reviewed
Jan 28, 2026
| print("4. Verify Browserbase account has sufficient credits") | ||
| print("5. Check if the calendar page structure has changed") | ||
|
|
||
| client.sessions.end(id=session_id) |
Contributor
There was a problem hiding this comment.
There are double session end calls here, could this be put in a Finally block?
jay-sahnan
reviewed
Jan 28, 2026
jay-sahnan
requested changes
Jan 28, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate templates to V3
Testing
🤖 Generated with Claude Code