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

# Spider

**SpiderTools** 是一个开源的 Web 抓取器和爬虫，可返回 LLM 就绪数据。要开始使用 Spider，您需要从 [Spider 控制面板](https://spider.cloud) 获取 API 密钥。

## 先决条件

以下示例需要 `spider-client` 库。

```shell theme={null}
pip install -U spider-client
```

## 示例

以下代理将运行一个搜索查询以获取美国最新新闻，并抓取第一个搜索结果。该代理将以 markdown 格式返回抓取的数据。

```python cookbook/tools/spider_tools.py theme={null}
from agno.agent import Agent
from agno.tools.spider import SpiderTools

agent = Agent(tools=[SpiderTools()])
agent.print_response('Can you scrape the first search result from a search on "news in USA"?', markdown=True)
```

## Toolkit 参数

| 参数 (Parameter) | 类型 (Type) | 默认值 (Default) | 描述 (Description) |
| -------------- | --------- | ------------- | ---------------- |
| `max_results`  | `int`     | -             | 要返回的最大搜索结果数      |
| `url`          | `str`     | -             | 要抓取或爬取的 URL      |

## Toolkit 函数

| 函数 (Function) | 描述 (Description) |
| ------------- | ---------------- |
| `search`      | 为给定查询搜索网络。       |
| `scrape`      | 抓取给定的 URL。       |
| `crawl`       | 爬取给定的 URL。       |

## 开发者资源

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