fix(WebSearchTool): add configurable timeout parameter#2198
Open
fuleinist wants to merge 1 commit intohuggingface:mainfrom
Open
fix(WebSearchTool): add configurable timeout parameter#2198fuleinist wants to merge 1 commit intohuggingface:mainfrom
fuleinist wants to merge 1 commit intohuggingface:mainfrom
Conversation
Adds a timeout parameter to WebSearchTool.__init__() with a default of 30 seconds. Both search_duckduckgo() and search_bing() now pass this timeout to requests.get(), making the tool more configurable for both slow corporate proxy environments and latency-sensitive applications. This is a non-breaking change: the default behavior is unchanged.
VANDRANKI
reviewed
Apr 19, 2026
VANDRANKI
left a comment
There was a problem hiding this comment.
Good addition - having a configurable timeout is better than leaving it to the library default (which is often unlimited).
One gap: the timeout parameter is wired to search_duckduckgo and search_bing, but search_exa (added in #2139) hardcodes timeout=30 in its requests.post call and ignores self.timeout. Should pass timeout=self.timeout there too for consistency.
10ishq
added a commit
to 10ishq/smolagents
that referenced
this pull request
Apr 23, 2026
Use getattr(self, 'timeout', 30) instead of hardcoded timeout=30 so search_exa respects self.timeout when the configurable timeout parameter is added to WebSearchTool (see huggingface#2198). Co-Authored-By: Tanishq Jaiswal <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Both
search_duckduckgo()andsearch_bing()inWebSearchToolcallrequests.get()without a timeout argument. This causes requests to hang indefinitely in slow/corporate proxy environments, and provides no way for users to adjust the wait time.Solution
Adds an optional
timeoutparameter toWebSearchTool.__init__()with a default of30seconds. Allrequests.getcalls inside the search methods now passtimeout=self.timeout.This is a non-breaking change: the default behavior is unchanged.
Usage example
Notes