Overview

Phidata is a development framework for building production-ready AI Assistants. This integration allows you to easily add ScrapeGraph’s web scraping capabilities to your Phidata-powered AI agents.

Official Phidata Documentation

Learn more about building AI Assistants with Phidata

Installation

Install the required packages:

pip install -U phidata

pip install scrapegraph-py

Usage

Basic Example

Create an AI Assistant with ScrapeGraph tools:

from phi.agent import Agent
from phi.tools.scrapegraph_tools import ScrapeGraphTools

# Initialize with smartscraper enabled
scrapegraph = ScrapeGraphTools(smartscraper=True)

# Create an agent with the tools
agent = Agent(
    tools=[scrapegraph],
    show_tool_calls=True,
    markdown=True,
    stream=True
)

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

Markdown Conversion

You can also use ScrapeGraph to convert web pages to markdown:

from phi.agent import Agent
from phi.tools.scrapegraph_tools import ScrapeGraphTools

# Initialize with only markdownify enabled
scrapegraph_md = ScrapeGraphTools(smartscraper=False)

# Create an agent for markdown conversion
agent_md = Agent(
    tools=[scrapegraph_md],
    show_tool_calls=True,
    markdown=True
)

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

Features

Smart Scraping

Extract structured data using natural language

Markdown Conversion

Convert web pages to clean markdown

Streaming Support

Real-time responses with streaming

Tool Visibility

Debug with visible tool calls

Support

Need help with the integration?