WebsiteTools enable an Agent to parse a website and add its contents to the knowledge base.

Prerequisites

The following example requires the beautifulsoup4 library.

pip install -U beautifulsoup4

Example

The following agent will read the contents of a website and add it to the knowledge base.

cookbook/tools/website_tools.py
from phi.agent import Agent
from phi.tools.website import WebsiteTools

agent = Agent(tools=[WebsiteTools()], show_tool_calls=True)
agent.print_response("Search web page: 'https://docs.phidata.com/introduction'", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
knowledge_baseWebsiteKnowledgeBase-The knowledge base associated with the website, containing various data and resources linked to the website’s content.

Toolkit Functions

FunctionDescription
add_website_to_knowledge_baseThis function adds a website’s content to the knowledge base. NOTE: The website must start with https:// and should be a valid website. Use this function to get information about products from the internet.
read_urlThis function reads a URL and returns the contents.

Information