Skip to main content

Documentation Index

Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The Website Reader crawls and processes entire websites, following links to create comprehensive knowledge bases from web content.

Code

examples/concepts/knowledge/readers/web_reader.py
from agno.knowledge.reader.website_reader import WebsiteReader

reader = WebsiteReader(max_depth=3, max_links=10)

try:
    print("Starting read...")
    documents = reader.read("https://docs.agno.com/introduction")
    if documents:
        for doc in documents:
            print(doc.name)
            print(doc.content)
            print(f"Content length: {len(doc.content)}")
            print("-" * 80)
    else:
        print("No documents were returned")

except Exception as e:
    print(f"Error type: {type(e)}")
    print(f"Error occurred: {str(e)}")

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Install libraries

pip install -U requests beautifulsoup4 agno openai
3

Set environment variables

export OPENAI_API_KEY=xxx
4

Run Agent

python examples/concepts/knowledge/readers/web_reader.py

Params

ParameterTypeDefaultDescription
urlstrRequiredURL of the website to crawl and read
max_depthint3Maximum depth level for crawling links
max_linksint10Maximum number of links to crawl