Prerequisites
The following examples require thescrapegraph-py library.
SGAI_API_KEY environment variable:
Example
The following agent usesScrapeGraphTools to extract specific information from a webpage using the smartscraper functionality.
Toolkit Functions
| Function | Description | 
|---|---|
| smartscraper | Extracts structured data from a webpage using an LLM and a natural language prompt. Returns a JSON string of the result or an error. | 
| markdownify | Converts a webpage to markdown format. Returns the markdown string or an error. | 
Toolkit Parameters
These parameters are passed to theScrapeGraphTools constructor.
| Parameter | Type | Default | Description | 
|---|---|---|---|
| api_key | Optional[str] | None | API key for ScrapeGraph services. If not provided, it defaults to the SGAI_API_KEYenvironment variable. | 
| smartscraper | bool | True | Enable the smartscrapertool. | 
| markdownify | bool | False | Enable the markdownifytool. | 
Developer Resources
- View Tools Source
- View Cookbook Example