crewAI
crewAI copied to clipboard
[Bug]: BrightDataSERPTool search URLs carry a stray $ from ${query} f-string interpolation
Bug Description
BrightDataSERPTool.get_search_url() builds its search URLs with ${query} inside f-strings:
def get_search_url(self, engine: str, query: str) -> str:
if engine == "yandex":
return f"https://yandex.com/search/?text=${query}"
if engine == "bing":
return f"https://www.bing.com/search?q=${query}"
return f"https://www.google.com/search?q=${query}"
In an f-string, $ is a literal character, so the interpolation yields ...?q=$test — a stray $ before the query. The URL is passed directly to the SERP request in _run (no later template substitution), so every search through the tool carries the malformed query string.
Steps to Reproduce
from crewai_tools.tools.brightdata_tool.brightdata_serp import BrightDataSERPTool
tool = BrightDataSERPTool()
print(tool.get_search_url("bing", "test"))
# https://www.bing.com/search?q=$test <- literal '$' prepended to the query
Expected Behavior
https://www.bing.com/search?q=test — plain {query} interpolation.