Skip to content

Stagehand agent to extract screenshots of Linkedin banner images#62

Open
aq17 wants to merge 5 commits intodevfrom
aq17/agent-screenshot
Open

Stagehand agent to extract screenshots of Linkedin banner images#62
aq17 wants to merge 5 commits intodevfrom
aq17/agent-screenshot

Conversation

@aq17
Copy link
Contributor

@aq17 aq17 commented Feb 20, 2026

Somewhat niche, somewhat interesting use case built for another customer demo.

Imagining this as an example of how to leverage Stagehand to download random media assets on websites where a user would typically "right-click and press save image" (OS-level commands) that Stagehand can't mimic with acts, but can instead extract the image links, navigate to the link, and ultimately take a screenshot of it instead


Note

Low Risk
Low risk because this PR only adds new standalone Python/TypeScript example projects and supporting docs/config, without modifying existing application logic. Main risk is minor dependency/lockfile churn and potential confusion around required env vars/API keys.

Overview
Adds new python/agent-screenshot and typescript/agent-screenshot examples that use a Stagehand CUA agent (via Browserbase with proxies/advanced stealth) to Google-search a company’s LinkedIn page, extract the banner image URL, and save a cropped screenshot to images/.

Includes project scaffolding and setup docs (README.md, .env.example, .gitignore), plus Python packaging (pyproject.toml, uv.lock) and runnable entrypoints (main.py, index.ts).

Written by Cursor Bugbot for commit 0922b56. This will update automatically on new commits. Configure here.

Copy link
Member

@Kylejeong2 Kylejeong2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TS version lgtm other than the fact that you can't use advanced stealth/proxies on a non-paid plan.

Also all of our templates are in both python/TS

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Wrong env var name breaks Stagehand client API key
    • Updated AsyncStagehand initialization to read model_api_key from GOOGLE_API_KEY so extract uses the configured key.
  • ✅ Fixed: Missing prominent Scale plan requirement note per reviewer
    • Added a prominent note at the top of README stating the example is for Browserbase Scale customers due to advanced_stealth.

Create PR

Or push these changes by commenting:

@cursor push bc5bd877a3
Preview (bc5bd877a3)
diff --git a/python/agent-screenshot/README.md b/python/agent-screenshot/README.md
--- a/python/agent-screenshot/README.md
+++ b/python/agent-screenshot/README.md
@@ -1,5 +1,7 @@
 # Stagehand + Browserbase: LinkedIn Banner Screenshot
 
+> **Note:** This example is for Browserbase Scale customers only because it requires `advanced_stealth`.
+
 ## AT A GLANCE
 
 - Goal: Given a company name, find its LinkedIn page via Google and extract a screenshot of its banner image.

diff --git a/python/agent-screenshot/main.py b/python/agent-screenshot/main.py
--- a/python/agent-screenshot/main.py
+++ b/python/agent-screenshot/main.py
@@ -85,7 +85,7 @@
     client = AsyncStagehand(
         browserbase_api_key=os.environ.get("BROWSERBASE_API_KEY"),
         browserbase_project_id=os.environ.get("BROWSERBASE_PROJECT_ID"),
-        model_api_key=os.environ.get("GOOGLE_GENERATIVE_AI_API_KEY"),
+        model_api_key=os.environ.get("GOOGLE_API_KEY"),
     )
 
     # ---------------------------------------------------------------------------

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

client = AsyncStagehand(
browserbase_api_key=os.environ.get("BROWSERBASE_API_KEY"),
browserbase_project_id=os.environ.get("BROWSERBASE_PROJECT_ID"),
model_api_key=os.environ.get("GOOGLE_GENERATIVE_AI_API_KEY"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong env var name breaks Stagehand client API key

High Severity

The AsyncStagehand client reads model_api_key from GOOGLE_GENERATIVE_AI_API_KEY, but the .env.example, README, error messages, and even the comment on line 83–84 all reference GOOGLE_API_KEY. The agent config on line 169 also correctly uses GOOGLE_API_KEY. This mismatch means the client-level API key will always be None, causing the extract() call to fail since it depends on the client's model_api_key for the google/gemini-2.5-flash model.

Additional Locations (1)
Fix in Cursor Fix in Web

@aq17 aq17 force-pushed the aq17/agent-screenshot branch 2 times, most recently from 3c489d7 to d680219 Compare March 13, 2026 18:25
@aq17 aq17 force-pushed the aq17/agent-screenshot branch from d680219 to d1befb6 Compare March 13, 2026 18:27
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 4 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants