> ## Documentation Index
> Fetch the complete documentation index at: https://ikun.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 网站工具

**WebsiteTools** 使 Agent 能够解析网站并将其内容添加到知识库。

## 前提条件

以下示例需要 `beautifulsoup4` 库。

```shell theme={null}
pip install -U beautifulsoup4
```

## 示例

以下 Agent 将读取网站内容并将其添加到知识库。

```python cookbook/tools/website_tools.py theme={null}
from agno.agent import Agent
from agno.tools.website import WebsiteTools

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

## Toolkit 参数

| 参数               | 类型                     | 默认值 | 描述                             |
| ---------------- | ---------------------- | --- | ------------------------------ |
| `knowledge_base` | `WebsiteKnowledgeBase` | -   | 与网站关联的知识库，其中包含与网站内容相关的各种数据和资源。 |

## Toolkit 函数

| 函数                              | 描述                                                                      |
| ------------------------------- | ----------------------------------------------------------------------- |
| `add_website_to_knowledge_base` | 此函数将网站内容添加到知识库。**注意：** 网站必须以 `https://` 开头，并且必须是有效的网站。使用此函数可从互联网获取产品信息。 |
| `read_url`                      | 此函数将读取一个 URL 并返回其内容。                                                    |

## 开发者资源

* 查看 [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/website.py)
* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/tools/website_tools.py)
