Bright Data provides a powerful SERP API that allows you to query search engines (Google,Bing.DuckDuckGo,Yandex) with geo-targeting and advanced customization options, particularly useful for AI agents requiring real-time web information.
The integration lives in the langchain-brightdata
package. pip install langchain-brightdata
You'll need a Bright Data API key to use this tool. You can set it as an environment variable:
Here we show how to instantiate an instance of the BrightDataSERP tool. This tool allows you to perform search engine queries with various customization options including geo-targeting, language preferences, device type simulation, and specific search types using Bright Data's SERP API.
from langchain_brightdata import BrightDataSERP
serp_tool = BrightDataSERP(
bright_data_api_key="your-api-key",
search_engine="google",
country="us",
language="en",
results_count=10,
parse_results=True,
)
results = serp_tool.invoke(
{
"query": "best electric vehicles",
"country": "de",
"language": "de",
"search_type": "shop",
"device_type": "mobile",
"results_count": 15,
}
)
print(results)
from langchain_brightdata import BrightDataSERP
from langchain_google_genai import ChatGoogleGenerativeAI
from langgraph.prebuilt import create_react_agent
llm = ChatGoogleGenerativeAI(model="gemini-2.5-flash", google_api_key="your-api-key")
serp_tool = BrightDataSERP(
bright_data_api_key="your-api-key",
search_engine="google",
country="us",
language="en",
results_count=10,
parse_results=True,
)
agent = create_react_agent(llm, [serp_tool])
user_input = "Search for 'best electric vehicles' shopping results in Germany in German using mobile."
for step in agent.stream(
{"messages": user_input},
stream_mode="values",
):
step["messages"][-1].pretty_print()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4