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

# 百度搜索工具

## 代码

```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)
```

## 用法

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="设置您的 API 密钥">
    ```bash theme={null}
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="安装库">
    ```bash theme={null}
    pip install -U openai agno
    ```
  </Step>

  <Step title="运行 Agent">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/tools/baidusearch_tools.py
      ```

      ```bash Windows theme={null}
      python cookbook/tools/baidusearch_tools.py
      ```
    </CodeGroup>
  </Step>
</Steps>
