BaiduSearch
Search the web with BaiduSearchTools using the Baidu search engine, with a configurable result count.
BaiduSearch enables an Agent to search the web for information using the Baidu search engine.
Prerequisites
The following example requires the baidusearch, pycountry, and openai libraries. To install them, run the following command:
uv pip install -U agno baidusearch pycountry openaiExample
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
| 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
| Function | Description |
|---|---|
baidu_search | Use this function to search Baidu for a query. |
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.