Overview

Agno is a development framework for building production-ready AI Assistants. This integration allows you to easily add ScrapeGraph’s web scraping capabilities to your Agno-powered AI agents, enabling them to extract data from websites, convert content to markdown, and perform intelligent web searches.

Official Agno Documentation

Learn more about building AI Assistants with Agno

Installation

Install the required packages:
pip install -U agno
pip install scrapegraph-py

Quick Start

Import the necessary modules and create your first ScrapeGraph-powered agent:
from agno.agent import Agent
from agno.tools.scrapegraph import ScrapeGraphTools

# Create a ScrapeGraph tools instance with default settings
scrapegraph = ScrapeGraphTools(smartscraper=True)

# Initialize your AI agent with ScrapeGraph tools
agent = Agent(
    tools=[scrapegraph], 
    show_tool_calls=True, 
    markdown=True, 
    stream=True
)

Usage Examples

Example 1: Smart Scraping (Default)

Extract structured data from websites using natural language:
from agno.agent import Agent
from agno.tools.scrapegraph import ScrapeGraphTools

# Default behavior - only smartscraper enabled
scrapegraph = ScrapeGraphTools(smartscraper=True)

agent = Agent(tools=[scrapegraph], show_tool_calls=True, markdown=True, stream=True)

# Use smartscraper to extract specific information
agent.print_response("""
Use smartscraper to extract the following from https://www.wired.com/category/science/:
- News articles
- Headlines
- Images
- Links
- Author
""")

Example 2: Markdown Conversion

Convert web pages to clean markdown format:
# Only markdownify enabled (by setting smartscraper=False)
scrapegraph_md = ScrapeGraphTools(smartscraper=False)

agent_md = Agent(tools=[scrapegraph_md], show_tool_calls=True, markdown=True)

# Use markdownify to convert webpage to markdown
agent_md.print_response(
    "Fetch and convert https://www.wired.com/category/science/ to markdown format"
)

Example 3: Search Scraping

Enable intelligent search capabilities:
# Enable searchscraper for finding specific information
scrapegraph_search = ScrapeGraphTools(searchscraper=True)

agent_search = Agent(tools=[scrapegraph_search], show_tool_calls=True, markdown=True)

# Use searchscraper to find specific information
agent_search.print_response(
    "Use searchscraper to find the CEO of company X and their contact details from https://example.com"
)

Example 4: Smart Crawling

Enable advanced crawling with custom schemas:
# Enable crawl for structured data extraction
scrapegraph_crawl = ScrapeGraphTools(crawl=True)

agent_crawl = Agent(tools=[scrapegraph_crawl], show_tool_calls=True, markdown=True)

# Use crawl with custom schema for structured extraction
agent_crawl.print_response(
    "Use crawl to extract what the company does and get text content from privacy and terms from https://scrapegraphai.com/ with a suitable schema."
)

Configuration Options

The ScrapeGraphTools class accepts several parameters to customize behavior:
ParameterTypeDefaultDescription
smartscraperboolTrueEnable smart scraping capabilities
searchscraperboolFalseEnable search scraping functionality
crawlboolFalseEnable smart crawling with schema support
markdownifyboolFalseEnable markdown conversion

Advanced Usage

Combining Multiple Tools

You can enable multiple ScrapeGraph tools simultaneously:
# Enable multiple tools at once
scrapegraph_multi = ScrapeGraphTools(
    smartscraper=True,
    searchscraper=True,
    crawl=True
)

agent_multi = Agent(tools=[scrapegraph_multi], show_tool_calls=True, markdown=True)

Custom Agent Configuration

Configure your agent with additional options:
agent = Agent(
    tools=[scrapegraph],
    show_tool_calls=True,  # Debug tool calls
    markdown=True,         # Enable markdown rendering
    stream=True,           # Enable streaming responses
    temperature=0.7        # Control response creativity
)

Features

Smart Scraping

Extract structured data using natural language queries

Markdown Conversion

Convert web pages to clean, readable markdown format

Search Scraping

Intelligent search and data extraction from websites

Smart Crawling

Advanced crawling with custom schema support

Streaming Support

Real-time responses with streaming capabilities

Tool Visibility

Debug and monitor tool calls for better development

Best Practices

  • Tool Selection: Only enable the tools you need to optimize performance
  • Error Handling: Implement proper error handling for web scraping operations
  • Rate Limiting: Be mindful of website rate limits when scraping
  • Schema Design: Design clear schemas for crawling operations
  • Testing: Test your agents locally before deployment

Support

Need help with the integration?