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

# BaiduSearch

**BaiduSearch** 使 Agent 能够使用百度搜索引擎在网上查找信息。

## 先决条件

以下示例需要 `baidusearch` 库。要安装 BaiduSearch，请运行以下命令：

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

## 示例

```python cookbook/tools/baidusearch_tools.py theme={null}
from agno.agent import Agent
from agno.tools.baidusearch import BaiduSearchTools

agent = Agent(
    tools=[BaiduSearchTools()],
    description="你是一个搜索代理，帮助用户使用百度查找最相关的信息。",
    instructions=[
        "根据用户提供的主题，回复关于该主题的 3 条最相关的搜索结果。",
        "搜索 5 条结果并选择前 3 条不重复的项。",
        "同时使用英语和中文搜索。",
    ],
    show_tool_calls=True,
)

agent.print_response("人工智能的最新进展是什么？", markdown=True)
```

## Toolkit 参数

| 参数                  | 类型    | 默认值  | 描述                               |
| ------------------- | ----- | ---- | -------------------------------- |
| `fixed_max_results` | `int` | -    | 设置要返回的最大结果固定数量。未提供默认值，如果使用则必须指定。 |
| `fixed_language`    | `str` | -    | 设置结果的固定语言。                       |
| `headers`           | `Any` | -    | 用于搜索请求的标头。                       |
| `proxy`             | `str` | -    | 指定要用于 HTTP 请求的单个代理地址作为字符串。       |
| `timeout`           | `int` | `10` | 设置 HTTP 请求的超时时间（以秒为单位）。          |

## Toolkit 函数

| 函数             | 描述             |
| -------------- | -------------- |
| `baidu_search` | 使用此函数在百度中搜索查询。 |

## 开发者资源

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