Prerequisites
The following example requires theddgs library. To install it, run the following command:
Example
Toolkit Params
Toolkit Functions
Supported Backends
Thebackend parameter supports the following options:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
ddgs library. To install it, run the following command:
pip install -U ddgs
from agno.agent import Agent
from agno.tools.websearch import WebSearchTools
# Basic usage with auto backend selection
agent = Agent(tools=[WebSearchTools()])
agent.print_response("What's happening in France?", markdown=True)
# Use a specific backend (e.g., google, bing, brave, yandex)
agent_google = Agent(
tools=[WebSearchTools(backend="google")]
)
agent_google.print_response("Latest AI news", markdown=True)
| Parameter | Type | Default | Description |
|---|---|---|---|
enable_search | bool | True | Enable web search function. |
enable_news | bool | True | Enable news search function. |
backend | str | "auto" | The backend to use for searching. Options: "auto", "duckduckgo", "google", "bing", "brave", "yandex", "yahoo", etc. |
modifier | Optional[str] | None | A modifier to be prepended to search queries. |
fixed_max_results | Optional[int] | None | A fixed number of maximum results. |
proxy | Optional[str] | None | Proxy to be used for requests. |
timeout | Optional[int] | 10 | The maximum number of seconds to wait for a response. |
verify_ssl | bool | True | Whether to verify SSL certificates. |
| Function | Description |
|---|---|
web_search | Search the web for a query. Parameters include query (str) for the search query and max_results (int, default=5) for maximum results. Returns JSON formatted search results. |
search_news | Get the latest news from the web. Parameters include query (str) for the search query and max_results (int, default=5) for maximum results. Returns JSON formatted news results. |
backend parameter supports the following options:
| Backend | Description |
|---|---|
auto | Automatically selects an available backend |
duckduckgo | DuckDuckGo search engine |
google | Google search engine |
bing | Microsoft Bing search engine |
brave | Brave Search |
yandex | Yandex search engine |
yahoo | Yahoo search engine |
Was this page helpful?