Skip to main content

Overview

Every ScrapeGraph v2 endpoint is one method on the official scrapegraph-py SDK. Wrap each one with LangChain’s built-in @tool decorator and you get a fully typed toolkit — no extra dependency, no third-party integration package, full control over arguments and return shapes.

LangChain tool docs

How LangChain’s @tool decorator works

scrapegraph-py on PyPI

The official Python SDK for ScrapeGraph v2

Installation

Set your keys:
Get your ScrapeGraph API key from the dashboard.

Build the toolkit

Save this once as sgai_tools.py — every example below imports from it.
sgai_tools.py

Endpoint → tool reference


Direct invocation

Call any tool by itself without an LLM — useful for scripts, tests, or as a building block inside chains.

Tool-calling agent

Give the LLM the whole toolkit and let it pick. LangChain v1’s create_agent works with any chat model that supports tool calling (ChatOpenAI, ChatAnthropic, etc.).
create_agent returns a compiled LangGraph under the hood — see the LangGraph page for advanced patterns (custom StateGraph, ToolNode, checkpointing).

Structured output with Pydantic

extract already returns structured JSON under the json_data key. Validate it into a Pydantic model for type safety downstream.

Chain pattern

Compose tools with LCEL when the sequence is fixed.

Support

Python SDK

Source and issues for scrapegraph-py

Discord

Get help from our community