mcpField
S
scraperapi-research-agent

scraperapi-research-agent

github.com/scraperapiProductivity10105 installsUpdated 12w ago
Repository

About scraperapi-research-agent

ScraperAPI Research Agent is a skill for end-to-end web research, aimed at tasks that need reports with source citations. It finds and fetches pages with ScraperAPI, then uses Anthropic Files API and Messages API to have Claude synthesize the material.

Key features

  1. 01Turn a research question into search queries
  2. 02Find sources through the Google Search structured endpoint
  3. 03Deduplicate and limit the source count
  4. 04Upload scraped content for Claude to synthesize
  5. 05Create Markdown reports with inline citations

Use cases

  1. 01Prepare factual summaries on a specific topic
  2. 02Compare options with citations to sources
  3. 03Create research reports from recent web material

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/scraperapi/scraperapi-skills --skill scraperapi-research-agent

After installing, type/scraperapi-research-agentin Claude Code to confirm it loaded.

Bundled filesassets/report_template.mdscripts/research_agent.py

Details

From the project README

ScraperAPI Research Agent

End-to-end autonomous research: ScraperAPI finds and fetches sources → Anthropic Files API ingests them as cited documents → Claude synthesizes a report.

Run it:

# Install dependencies
pip install requests anthropic

# Set env vars
export SCRAPERAPI_API_KEY=your-key
export ANTHROPIC_API_KEY=your-key

# Run
python skills/scraperapi-research-agent/scripts/research_agent.py \
  --question "What are the best practices for rate limiting in web APIs?" \
  --max-sources 5 \
  --output report.md

See scripts/research_agent.py for the full implementation.


Planning Checklist

Before starting a research run, establish:

  • Question clarity — Is the question specific enough to produce useful search queries? Vague questions like "tell me about AI" produce noise. Better: "What are the tradeoffs between RAG and fine-tuning for domain-specific LLMs?"
  • Source count — How many sources are needed? 3–5 is usually sufficient for a factual summary; 8–10 for a comparative analysis. More sources = more ScraperAPI credits.
  • Recency — Does the answer depend on recent events? Search queries will use recent date filters.
  • Credit budget — Each source costs ~1 credit to scrape (more with JS rendering). 5 sources = ~5–10 credits total.
  • Stop condition — Define when to stop. The default stop is --max-sources (5). Do not loop indefinitely.

Research Loop

1. PLAN
   ↓ Claude decomposes the question into 2–3 targeted search queries

2. DISCOVER
   ↓ ScraperAPI google/search structured endpoint → list of (url, title, snippet)

3. DEDUPLICATE
   ↓ Filter to top N unique URLs (default: 5), skipping PDFs and low-quality domains

4. FETCH
   ↓ ScraperAPI scrape each URL as markdown (output_format=markdown)
   ↓ Skip pages returning < 200 characters (blocked, error pages)

5. UPLOAD
   ↓ Upload each scraped page to Anthropic Files API as a text/plain artifact
   ↓ Store file_id for each source

6. SYNTHESIZE
   ↓ Claude (claude-opus-4-8, adaptive thinking) reads all document artifacts
   ↓ Returns structured report with inline citations [1], [2]...

7. CLEAN UP
   ↓ Delete uploaded file artifacts from Anthropic
   ↓ Write or print the final report

STOP when: max_sources reached, or all queries exhausted (whichever comes first).

Stop Conditions

The agent stops when any of the following is true:

  1. --max-sources reached (default: 5) — limits credit spend
  2. All search queries exhausted — no more URLs to explore
  3. --max-credits exceeded — hard cap on ScraperAPI credit use (optional)

Without stop conditions, a research loop will keep fetching until credits are gone.


Key Parameters

FlagDefaultDescription
--question(required)Research question
--max-sources5Max pages to scrape (credit budget)
--outputstdoutWrite report to file
--countryusScraperAPI country code for geo-targeted results
--modelclaude-opus-4-8Anthropic model for synthesis

Output Format

See assets/report_template.md for the report structure.

The report is a markdown document with:

  • Title derived from the research question
  • Summary — 2–3 sentence executive summary
  • Findings — structured sections with inline [N] citations
  • Sources — numbered bibliography with URLs and titles

Credit Cost Estimate

SourcesScraping creditsAnthropic tokensTotal estimate
3~3~15K in / ~2K outLow
5~5~25K in / ~3K outMedium
10~10~50K in / ~5K outHigher

Prompt caching applies to the scraped content on repeated runs for the same question.


ScraperAPI Endpoints Used

  • Google Search — GET https://api.scraperapi.com/structured/google/search — finds source URLs
  • Scrape — GET https://api.scraperapi.com/?output_format=markdown — fetches page content

See ScraperAPI docs for rate limits and credit costs.

Anthropic APIs Used

  • Files API (beta) — uploads scraped pages as document artifacts
  • Messages API — Claude synthesizes the report with citations

Requires ANTHROPIC_API_KEY with access to claude-opus-4-8 and the Files API beta.

Comments

Markdown supported