Description
The get_search_url method in BrightDataSearchTool uses ${query} (JavaScript template literal syntax) instead of {query} (Python f-string syntax) when building search URLs. This causes every search query to be prepended with a literal $ character.
For example, searching for "AI news" produces:
https://www.google.com/search?q=$AI%20news
instead of:
https://www.google.com/search?q=AI%20news
All three search engines (Google, Bing, Yandex) are affected.
Steps to Reproduce
- Set up
BRIGHT_DATA_API_KEY and BRIGHT_DATA_ZONE environment variables
- Create a
BrightDataSearchTool and call it with any query
- Inspect the URL being sent to the Bright Data API
Expected behavior
The search URL should contain the query string without any $ prefix. get_search_url("google", "test") should return https://www.google.com/search?q=test.
Screenshots/Code snippets
# Current code (brightdata_serp.py, lines 132-137)
def get_search_url(self, engine: str, query: str) -> str:
if engine == "yandex":
return f"https://yandex.com/search/?text=${query}" # <-- JS syntax
if engine == "bing":
return f"https://www.bing.com/search?q=${query}" # <-- JS syntax
return f"https://www.google.com/search?q=${query}" # <-- JS syntax
Operating System
Ubuntu 22.04
Python Version
3.12
crewAI Version
1.13.0
crewAI Tools Version
1.13.0
Virtual Environment
Venv
Evidence
In Python, f"...${query}" produces a literal $ followed by the interpolated value. Only {query} (without $) is correct f-string syntax. This can be verified in a Python shell:
>>> query = "test"
>>> f"https://www.google.com/search?q=${query}"
'https://www.google.com/search?q=$test'
>>> f"https://www.google.com/search?q={query}"
'https://www.google.com/search?q=test'
Possible Solution
Remove the $ prefix from all three f-strings in get_search_url. I have a fix ready and will open a PR shortly.
Additional context
Looks like the ${} syntax was carried over from a JavaScript codebase or written by someone used to JS template literals. The fix is straightforward — just removing the three $ characters.
Description
The
get_search_urlmethod inBrightDataSearchTooluses${query}(JavaScript template literal syntax) instead of{query}(Python f-string syntax) when building search URLs. This causes every search query to be prepended with a literal$character.For example, searching for "AI news" produces:
instead of:
All three search engines (Google, Bing, Yandex) are affected.
Steps to Reproduce
BRIGHT_DATA_API_KEYandBRIGHT_DATA_ZONEenvironment variablesBrightDataSearchTooland call it with any queryExpected behavior
The search URL should contain the query string without any
$prefix.get_search_url("google", "test")should returnhttps://www.google.com/search?q=test.Screenshots/Code snippets
Operating System
Ubuntu 22.04
Python Version
3.12
crewAI Version
1.13.0
crewAI Tools Version
1.13.0
Virtual Environment
Venv
Evidence
In Python,
f"...${query}"produces a literal$followed by the interpolated value. Only{query}(without$) is correct f-string syntax. This can be verified in a Python shell:Possible Solution
Remove the
$prefix from all three f-strings inget_search_url. I have a fix ready and will open a PR shortly.Additional context
Looks like the
${}syntax was carried over from a JavaScript codebase or written by someone used to JS template literals. The fix is straightforward — just removing the three$characters.