Skip to content
Changelog

WebSearchTools and DuckDuckGoTools return rate-limit errors to the model

Community contributorAnderson Gomes de Oliveira

November 17, 20261 min read

Agno WebSearchTools and DuckDuckGoTools now hand the model a JSON error when DuckDuckGo rate-limits a search, so the agent can read what went wrong and decide what to do next. Before, both tools raised the ddgs exception straight out of web_search and search_news.

Two settings also behave as written now.

  • max_results=0 and fixed_max_results=0 return an empty list without calling ddgs.
  • search_news puts the modifier in front of the query, the same way web_search does.
from agno.tools.duckduckgo import DuckDuckGoTools
 
news = DuckDuckGoTools(modifier="site:arxiv.org", fixed_max_results=3)

We replaced the DDGS client inside agno.tools.websearch with a stand-in that records each call, and made it raise the ddgs RatelimitException for the error case.

# Before
web_search("agent memory") -> raised RatelimitException: https://duckduckgo.com 202 Ratelimit
# Now
web_search("agent memory") -> {"error": "RatelimitException", "message": "https://duckduckgo.com 202 Ratelimit", "query": "agent memory", "results": []}

See the cookbook, and learn more about WebSearchTools and DuckDuckGoTools in the documentation.

Frequently asked questions

It gets a JSON string with the exception name, its message, the query and an empty list, for example {"error": "RatelimitException", "message": "https://duckduckgo.com 202 Ratelimit", "query": "agent memory", "results": []}. The toolkit catches the ddgs RatelimitException, TimeoutException and DDGSException, plus any other exception.

Earlier releases passed max_results=0 to ddgs, and ddgs treats 0 as no limit. A fixed_max_results=0 was dropped altogether, so the search ran with the requested count of 5. Both now return [] and skip the search.

Yes. With modifier="site:arxiv.org", search_news("agent memory") now sends the query site:arxiv.org agent memory to ddgs, where earlier releases sent agent memory.

Shipped around the same time