> ## 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.

# Crawl4AI

**Crawl4aiTools** 使 Agent 能够使用 Crawl4ai 库执行网络爬虫和抓取任务。

## 先决条件

以下示例需要 `crawl4ai` 库。

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

## 示例

下面的 Agent 将抓取 [https://github.com/agno-agi/agno](https://github.com/agno-agi/agno) 页面的内容：

```python cookbook/tools/crawl4ai_tools.py theme={null}
from agno.agent import Agent
from agno.tools.crawl4ai import Crawl4aiTools

agent = Agent(tools=[Crawl4aiTools(max_length=None)], show_tool_calls=True)
agent.print_response("告诉我关于 https://github.com/agno-agi/agno 的信息。")
```

## Toolkit 参数

| 参数           | 类型    | 默认值    | 描述               |
| ------------ | ----- | ------ | ---------------- |
| `max_length` | `int` | `1000` | 指定要返回的网页文本的最大长度。 |

## Toolkit 函数

| 函数            | 描述                                                                                                         |
| ------------- | ---------------------------------------------------------------------------------------------------------- |
| `web_crawler` | 使用 crawl4ai 的 WebCrawler 抓取网站。参数包括用于抓取的 URL 的 'url' 和用于限制提取内容长度的可选 'max\_length'。'max\_length' 的默认值为 1000。 |

## 开发者资源

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