LlamaIndex Integration
Overview
The LlamaIndex Tools integration plugs ScraperAPI directly to LlamaIndex agents, so that LLM pipelines can execute scraping tasks. This integration lets your LlamaIndex agent scrape web pages and pull structured data from Amazon, Google, eBay, Walmart and Redfin.
Useful links:
PyPI package:
llama-index-tools-scraperapi
Installation
pip install llama-index-tools-scraperapiUsing the LlamaIndex ToolSpec
Prerequisites:
ScraperAPI Account
OpenAI Account (used in the example)
Python 3.10+ installed
import asyncio
import os
from llama_index.tools.scraperapi import ScraperAPIToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
async def main():
scraper_tool = ScraperAPIToolSpec(
api_key=os.environ["SCRAPERAPI_API_KEY"],
)
agent = FunctionAgent(
tools=scraper_tool.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
response = await agent.run(
"Scrape https://example.com and summarize the content"
)
print(response)
asyncio.run(main())Example Response
Available Tools
scrape
Return the raw HTML content of any URL.
"Scrape https://example.com"
amazon
Extract structured data from an Amazon product page (title, price, images, etc.).
"Look up the Amazon product page for ASIN B0FFMRH228"
google
Perform a Google Search and return organic results (title, link, snippet).
"Search Google for 'best web scraping tools 2026'"
ebay
Search eBay listings and extract product information.
"Find the top three eBay listings for 'vintage headphones'"
walmart
Extract product data from Walmart pages.
"Search Walmart for 'wireless headphones' and list the top 3 results"
redfin
Extract real‑estate data from Redfin listings.
"Get the details of 123 Main St from Redfin"
Each of these tools uses ScraperAPI on the backend. Requests count toward your ScraperAPI credit pool, and domains with anti-bot protection may consume more API credits.
MCP Server Integration
If you prefer not to install the tool package, you can access the same tools through our MCP server instead. The MCP server exposes these tools over a streamable HTTP API, allowing you to use them without installing an additional Python package.
Checkout the MCP Server section for more info on the MCP server itself.
Prerequisites:
Example
Example Respose
Last updated

