先决条件
以下示例需要spider-client 库。
示例
以下代理将运行一个搜索查询以获取美国最新新闻,并抓取第一个搜索结果。该代理将以 markdown 格式返回抓取的数据。cookbook/tools/spider_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
spider-client 库。
pip install -U spider-client
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)
| 参数 (Parameter) | 类型 (Type) | 默认值 (Default) | 描述 (Description) |
|---|---|---|---|
max_results | int | - | 要返回的最大搜索结果数 |
url | str | - | 要抓取或爬取的 URL |
| 函数 (Function) | 描述 (Description) |
|---|---|
search | 为给定查询搜索网络。 |
scrape | 抓取给定的 URL。 |
crawl | 爬取给定的 URL。 |