Skip to content

Use Fetch API for retrieval-only templates - #107

Open
shrey150 wants to merge 3 commits into
devfrom
agent/fetch-first-templates
Open

Use Fetch API for retrieval-only templates#107
shrey150 wants to merge 3 commits into
devfrom
agent/fetch-first-templates

Conversation

@shrey150

@shrey150 shrey150 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • use Browserbase Fetch API for five retrieval-only workflows in both TypeScript and Python
  • remove browser sessions, Stagehand, and outer-agent/model dependencies where no page interaction is required
  • keep each shipped template focused on the product workflow; correctness checks remain out-of-band
  • update setup, environment examples, dependencies, and the root template index

Scope

Template Why Fetch is the right primitive
website-link-tester Fetch the homepage, parse links locally, and check destinations without one browser session per URL
business-lookup Query the official SF Open Data JSON endpoint and select the exact DBA match deterministically
company-value-prop-generator Use Fetch API's structured JSON response for landing-page extraction
council-events Fetch the year-filtered, server-rendered Legistar calendar as schema-constrained JSON
sec-filing-research Resolve and retrieve filings from the SEC's official JSON datasets

This intentionally does not rewrite interactive or rendered-content workflows. cerebras-docs-checker still demonstrates rendered accessibility content, company-address-finder is a Search API candidate for a separate change, and interactive templates remain browser/Stagehand based.

The link tester includes bounded retries for transport errors and 5xx responses after a real Fetch request transiently returned 503 during verification.

Before/after semantic comparison

The exact pre-Fetch parent commit and this branch were both rerun with live credentials. All ten pre-Fetch language entrypoints completed successfully. The new implementations preserve the workflow outputs with these deliberate differences:

Template Fresh comparison
website-link-tester Still discovers and health-checks links; removes the probabilistic content-relevance judgment and reports deterministic HTTP metadata instead
business-lookup Returns the same exact official DBA record and normalized business fields, now directly validated against the source schema
company-value-prop-generator Returns the same value-proposition and short personalized-opener content
council-events Both old and new TypeScript/Python runs returned all 91 current-year events; Fetch uses ?Mode=2026 to request the full-year HTML
sec-filing-research Returns the same company/CIK and five-recent-filing metadata contract from the more direct official SEC datasets

E2E Test Matrix

All results below were produced from the latest branch with a real BROWSERBASE_API_KEY; no historical runs were reused.

Command / flow Observed output Confidence / sufficiency
TypeScript website-link-tester: MAX_LINKS=5 pnpm start 60 unique links discovered; 5/5 returned HTTP 200; 0 failures Proves homepage parsing, bounded concurrent Fetch calls, and report generation on a public target
Python website-link-tester: MAX_LINKS=5 uv run python main.py 60 unique links discovered; 5/5 returned HTTP 200; 0 failures Proves Python parity for the same public target and limit
TypeScript business-lookup: pnpm start Exact Jalebi Street record with ownership, account, location, address, and classification fields Proves direct schema validation and deterministic exact-match mapping
Python business-lookup: uv run python main.py Same exact official record and normalized fields as TypeScript Proves Python SDK and Pydantic parity
TypeScript company-value-prop-generator: pnpm start Schema-valid Browserbase value proposition and Your... opener Proves structured Fetch extraction; wording remains model-dependent
Python company-value-prop-generator: uv run python main.py Schema-valid Browserbase value proposition and Your... opener Proves Python structured-extraction parity; wording remains model-dependent
TypeScript council-events: pnpm start 91 events for 2026 from Calendar.aspx?Mode=2026 Proves the full-year filter and restores the fresh pre-Fetch event count
Python council-events: uv run python main.py 91 events for 2026 from Calendar.aspx?Mode=2026 Proves Python full-year parity and restores the fresh pre-Fetch event count
TypeScript sec-filing-research: pnpm start Apple resolved to CIK 0000320193; 5 official recent filings returned Proves company resolution and submissions retrieval against live SEC data
Python sec-filing-research: uv run python main.py Apple resolved to CIK 0000320193; 5 official recent filings returned Proves Python SDK parity against the same live SEC datasets

Static verification

  • pnpm check
  • TypeScript tsc --noEmit for the changed TypeScript entrypoints
  • Python compileall for the changed Python entrypoints
  • git diff --check

Policy audit

  • no interactive Stagehand primitive was swapped for a page method; these workflows no longer require a browser at all
  • no provider model name or provider API key is required
  • no verification, judging, or eval harness is embedded in shipped template code
  • no custom Browserbase API URL is required
  • TypeScript and Python use their first-class Browserbase SDK Fetch surfaces

Note

Low Risk
Changes are limited to example templates and documentation, with simpler deterministic code paths and no auth or production service logic.

Overview
This PR replaces browser automation and outer-agent stacks with Browserbase Fetch API across five paired TypeScript/Python templates: business-lookup, company-value-prop-generator, council-events, sec-filing-research, and website-link-tester.

Setup and docs now only require BROWSERBASE_API_KEY (plus optional env like BUSINESS_NAME, TARGET_URL, SEARCH_QUERY). Stagehand, Vercel AI SDK / Deep Agents, and AI_GATEWAY_API_KEY are removed where they were only used for HTTP retrieval. Dependencies shift to @browserbasehq/sdk / browserbase, with cheerio or BeautifulSoup for HTML link parsing in the link tester.

Behavior changes by template: SF business lookup fetches the Open Data JSON endpoint and picks an exact DBA match in code; SEC research resolves CIK via company_tickers.json and reads submissions/CIK*.json instead of EDGAR UI navigation; council events and value-prop flows use schema-constrained Fetch JSON instead of act/extract; the link tester reports HTTP status, content type, and titles (with retries on 5xx) and drops AI “content matches link text” checks. The root README table descriptions are updated to match.

Interactive Stagehand-based templates are unchanged by design.

Reviewed by Cursor Bugbot for commit 34194a2. Bugbot is set up for automated code reviews on this repo. Configure here.

@socket-security

socket-security Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​cheerio@​1.2.09910010083100

View full report

Comment thread python/website-link-tester/README.md Outdated
Comment thread typescript/business-lookup/index.ts Outdated
Addresses feedback from shrey150

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using default effort and found 1 potential issue.

Fix All in Cursor

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

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 27a1001. Configure here.

Comment thread python/business-lookup/main.py Outdated
Addresses feedback from cursor[bot]
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.

1 participant