# BaiduSearch (/tools/toolkits/search/baidusearch)



**BaiduSearch** enables an Agent to search the web for information using the Baidu search engine.

## Prerequisites [#prerequisites]

The following example requires the `baidusearch`, `pycountry`, and `openai` libraries. To install them, run the following command:

```shell
uv pip install -U agno baidusearch pycountry openai
```

<include path="../../../../_snippets/set-openai-key.mdx" />

## Example [#example]

```python title="cookbook/91_tools/baidusearch_tools.py"
from agno.agent import Agent
from agno.tools.baidusearch import BaiduSearchTools

agent = Agent(
    tools=[BaiduSearchTools()],
    description="You are a search agent that helps users find the most relevant information using Baidu.",
    instructions=[
        "Given a topic by the user, respond with the 3 most relevant search results about that topic.",
        "Search for 5 results and select the top 3 unique items.",
        "Search in both English and Chinese.",
    ],
)

agent.print_response("What are the latest advancements in AI?", markdown=True)
```

## Toolkit Params [#toolkit-params]

| Parameter             | Type            | Default | Description                                                                                                  |
| --------------------- | --------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| `fixed_max_results`   | `Optional[int]` | `None`  | A fixed number of maximum results to return, overriding the `max_results` argument passed to `baidu_search`. |
| `fixed_language`      | `Optional[str]` | `None`  | Used for language normalization/logging; not forwarded to the search provider.                               |
| `headers`             | `Optional[Any]` | `None`  | Stored but not forwarded to the underlying search request.                                                   |
| `proxy`               | `Optional[str]` | `None`  | Stored but not forwarded to the underlying search request.                                                   |
| `timeout`             | `int`           | `10`    | Stored but not forwarded to the underlying search request.                                                   |
| `debug`               | `bool`          | `False` | Stored; does not configure the provider's debug mode.                                                        |
| `enable_baidu_search` | `bool`          | `True`  | Enable the baidu\_search functionality.                                                                      |
| `all`                 | `bool`          | `False` | Enable all functionality.                                                                                    |

## Toolkit Functions [#toolkit-functions]

| Function       | Description                                    |
| -------------- | ---------------------------------------------- |
| `baidu_search` | Use this function to search Baidu for a query. |

## Language and request options [#language-and-request-options]

The current adapter calls the provider with only `keyword` and `num_results`. It does not enforce the language, proxy, headers, timeout, or debug values in this table. Search with appropriately phrased queries; the cookbook's English/Chinese instruction is a model instruction rather than a provider language filter.

## Developer Resources [#developer-resources]

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