Website Tools - Web Scraping and Content Analysis
Scrape and summarize a web page with WebsiteTools, which registers its read_url function when no knowledge base is attached.
Use WebsiteTools to let an agent fetch and summarize a page. With no knowledge base attached, the toolkit registers one read_url function.
"""
Website Tools - Web Scraping and Content Analysis
This example demonstrates how to use WebsiteTools for web scraping and analysis.
Shows enable_ flag patterns for selective function access.
WebsiteTools is a small tool (<6 functions) so it uses enable_ flags.
"""
from agno.agent import Agent
from agno.tools.website import WebsiteTools
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
tools=[WebsiteTools()], # All functions enabled by default
description="You are a comprehensive web scraping specialist with all website analysis capabilities.",
instructions=[
"Help users scrape and analyze website content",
"Provide detailed summaries and insights from web pages",
"Handle various website formats and structures",
"Ensure respectful scraping practices",
],
markdown=True,
)
# Example usage
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
print("=== Basic Web Content Search Example ===")
agent.print_response(
"Search web page: 'https://docs.agno.com/introduction' and summarize the key concepts",
markdown=True,
)The default WebsiteReader can follow links up to depth 3 and collect content from up to 10 pages. It extracts text from fetched HTML and does not run a browser. This toolkit has no enable_* constructor flags; use the shared include_tools or exclude_tools options if filtering its registered function.
Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno beautifulsoup4 openaiExport your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"Run the example
Save the code above as website_tools.py, then run:
python website_tools.pyFull source: cookbook/91_tools/website_tools.py