Appearance
LangChain, LlamaIndex and CrewAI
Three Python packages put ScrapeIt into the AI frameworks you build agents and RAG pipelines with: load web pages and whole sites as documents, and give agents tools that scrape a page or search Google. They are built on the official Python SDK, so every call runs the same engine as the REST API: the same proxies, JavaScript rendering, anti-bot handling, concurrency limits and billing rules. For an assistant that speaks MCP (Claude, Cursor, VS Code), connect the MCP server instead - no code at all.
| Framework | Package | What you get |
|---|---|---|
| LangChain | langchain-scrapeit | ScrapeitLoader (document loader, scrape or crawl), tools ScrapeitScrapeTool and ScrapeitGoogleSearchTool |
| LlamaIndex | llama-index-readers-scrapeit | ScrapeitWebReader (reader, scrape or crawl) |
| CrewAI | crewai-scrapeit | Tools ScrapeitScrapeTool and ScrapeitSearchTool |
All three need Python 3.11 or newer.
API key
Create a key in Workspace → API Keys (Authentication & API keys) with the scopes the integration uses: scrape:web for scraping and Google search, plus scrapers:run and scrapers:read for crawl mode. Export it as SCRAPEIT_API_KEY, or pass api_key="..." to any class:
bash
export SCRAPEIT_API_KEY="YOUR_SCRAPEIT_API_KEY"The key is sent only in the x-api-key header to https://api.scrapeit.io. It is not part of a tool's or reader's printed or serialized form, and error messages never contain it.
LangChain
bash
pip install -U langchain-scrapeitScrapeitLoader turns URLs into LangChain Documents. Each page is scraped with the Web Scraping API and becomes one document with the page as markdown (or text, html) and source, request_id, status_code and credits in its metadata:
python
from langchain_scrapeit import ScrapeitLoader
loader = ScrapeitLoader(urls=["https://example.com"])
docs = loader.load()
print(docs[0].page_content) # "Example Domain ..."
print(docs[0].metadata["source"], docs[0].metadata["credits"])params takes any Web Scraping API parameter, for example {"jsRendering": True, "proxyType": "residential", "proxyCountry": "us"}. lazy_load(), aload() and alazy_load() work as in any LangChain loader.
mode="crawl" runs one Website Crawler job from the URLs, waits until it finishes (crawl_timeout, 600 seconds by default) and returns a document per crawled page; params then takes the crawler options. Pages that failed, were skipped or were blocked are left out:
python
loader = ScrapeitLoader(
urls="https://example.com/blog/",
mode="crawl",
params={"maxDepth": 2, "limit": 50, "includePaths": ["/blog/*"]},
)
docs = loader.load()The two tools are for agents:
| Tool | Name | Input | Returns |
|---|---|---|---|
ScrapeitScrapeTool | scrapeit_scrape | url | The page as markdown (output_format="text" for plain text; params for Web Scraping API options). |
ScrapeitGoogleSearchTool | scrapeit_google_search | query, optional country, language, page | The parsed Google results page: organic results, AI overview, people also ask. |
python
from langchain.agents import create_agent
from langchain_scrapeit import ScrapeitGoogleSearchTool, ScrapeitScrapeTool
tools = [ScrapeitGoogleSearchTool(), ScrapeitScrapeTool()]
print(tools[1].invoke({"url": "https://example.com"})) # a direct call, no model needed
# Any tool-calling chat model; needs `pip install langchain` and the model's own package and key.
agent = create_agent("openai:gpt-4.1-mini", tools=tools)
agent.invoke({"messages": [{"role": "user", "content": "Find the official Python docs and summarize the tutorial page."}]})Both tools have async versions (ainvoke), and a failed call raises ToolException with the error code; build a tool with handle_tool_error=True to give that text to the agent instead.
LlamaIndex
bash
pip install llama-index-readers-scrapeitScrapeitWebReader loads pages into LlamaIndex Documents, with url, request_id, status_code and credits in the metadata, ready for an index:
python
from llama_index.core import VectorStoreIndex
from llama_index.readers.scrapeit import ScrapeitWebReader
reader = ScrapeitWebReader()
documents = reader.load_data(urls=["https://example.com"])
print(documents[0].text) # "Example Domain ..."
# Needs an embedding model and an LLM configured for LlamaIndex (OpenAI by default).
index = VectorStoreIndex.from_documents(documents)
print(index.as_query_engine().query("What is this domain for?"))output_format picks markdown (the default), text or html, params takes Web Scraping API parameters, and await reader.aload_data(urls=[...]) runs on the async client. ScrapeitWebReader(mode="crawl", params={"maxDepth": 2, "limit": 50}) crawls the site from the URLs instead, like the LangChain loader.
CrewAI
bash
pip install crewai-scrapeit| Tool | Name | Input | Returns |
|---|---|---|---|
ScrapeitScrapeTool | scrapeit_scrape | url | The page as markdown (output_format, params as in LangChain). |
ScrapeitSearchTool | scrapeit_google_search | query, optional country, language, page | The parsed Google results page as JSON. |
python
from crewai import Agent, Crew, Task
from crewai_scrapeit import ScrapeitScrapeTool, ScrapeitSearchTool
researcher = Agent(
role="Web researcher",
goal="Answer questions with facts from current web pages",
backstory="You search Google first, then read the most relevant pages.",
tools=[ScrapeitSearchTool(), ScrapeitScrapeTool()],
)
task = Task(
description="What is example.com used for? Read the page itself.",
expected_output="Two sentences and the URL you read.",
agent=researcher,
)
# The agent's LLM comes from CrewAI's own settings (OPENAI_API_KEY by default).
print(Crew(agents=[researcher], tasks=[task]).kickoff())A tool can also be called directly: ScrapeitScrapeTool().run(url="https://example.com"). A failed call raises an error with the ScrapeIt error code, and CrewAI hands that text to the agent.
Errors
Loaders and readers raise scrapeit.ScrapeitError, tools raise their framework's tool error. All of them carry the stable error code, for example INSUFFICIENT_CREDITS, CONCURRENCY_LIMIT_EXCEEDED, TARGET_BLOCKED or SCRAPE_TIMEOUT, and the correlation_id to quote to support. Retries of 429, 500 and 503 happen inside the SDK. A missing API key fails when a tool or reader is created, with MISSING_API_KEY.
A page is never replaced by an empty or a challenge text: a scrape that failed raises SCRAPE_FAILED (nothing charged, the reason in details["non_billable_failure_category"]), a site that answered with its anti-bot page raises TARGET_BLOCKED (charged: retry with jsRendering or residential proxies), and a crawl that ended failed raises CRAWL_FAILED with details["job_id"]. Loaders and readers leave out a page whose answer was empty.
Credits
Every scraped page, crawled page and Google search spends credits from your plan, exactly as the same REST call would: a scrape costs what a Web Scraping API request costs, a Google search what the Google SERP API charges. Failures on our side are free. Agents can call tools many times in one run, so give the integration its own API key and watch the Usage page. Details: billing and credits.
Related pages
- Python SDK - the client these packages are built on.
- MCP server - ScrapeIt tools for MCP clients without code.
- Web Scraping API - every parameter
paramsaccepts. - Website Crawler - crawl options for crawl mode.
- n8n, Make and Zapier - no-code automation tools.