Web Search Reader

WebSearchReader uses DDGS to search the web and reads result pages into documents.

WebSearchReader reads data from web search results.

Parameters

ParameterTypeDefaultDescription
chunkboolTrueWhether to chunk the documents
chunk_sizeint5000Size of each chunk when chunking is enabled
encodingOptional[str]NoneText encoding used when reading content
search_timeoutint10Timeout for search operations in seconds
request_timeoutint30Timeout for HTTP requests in seconds
delay_between_requestsfloat2.0Delay between requests in seconds
max_retriesint3Maximum total attempts per result-page fetch in read(); async_read() fetches each page once
user_agentstr"Mozilla/5.0..."User agent string for HTTP requests
search_engineLiteral["duckduckgo"]"duckduckgo"Only accepted dispatch value. Agno calls DDGS without a backend argument, so the installed DDGS package chooses its default search backend
search_delayfloat3.0Delay between search requests in seconds
max_search_retriesint2Maximum total search attempts, including the first, in both read methods
rate_limit_delayfloat5.0Delay when rate limited in seconds
exponential_backoffboolTrueWhether to use exponential backoff for retries
chunking_strategyOptional[ChunkingStrategy]NoneStrategy for chunking content. When None, uses SemanticChunking with the reader's chunk_size
allowed_hostsOptional[List[str]]NoneHostnames the reader is allowed to fetch from. See Restricting URL Fetches.

WebSearchReader also accepts the base Reader constructor parameters, including max_results for the number of search results to read.

Methods

read()

Searches the web for the query (up to max_results search results), reads each result page, and returns a list of documents.

ParameterTypeDefaultDescription
querystrRequiredSearch query to run

async_read()

Async variant of read(). Accepts the same parameters.

Setup

Install the reader and chunking dependencies:

uv pip install -U agno ddgs beautifulsoup4 chonkie openai

The default semantic chunker uses OpenAI embeddings and requires OPENAI_API_KEY when chunking. Set an explicit non-semantic chunking_strategy or chunk=False to avoid embedding calls; Chonkie is still required when importing the reader.

async_read() performs its search stage synchronously, which can block the event loop. Its result-page fetches are asynchronous but each has one attempt; max_retries applies only to synchronous page fetching.