Integrating Bright Data with LangChain enhances LLM-powered agents with reliable, anonymous, and scalable web access for real-world applications.
You can do it either by using the langchain-brightdata Python package is the official LangChain integration for Bright Data, including support for:
BrightDataSERP - 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.
BrightDataUnlocker - Bright Data provides a powerful Web Unlocker API that allows you to access websites that might be protected by anti-bot measures, geo-restrictions, or other access limitations, making it particularly useful for AI agents requiring reliable web content extraction.
BrightDataWebScraperAPI - Bright Data provides a powerful Web Scraper API that allows you to extract structured data from 100+ ppular domains, including Amazon product details, LinkedIn profiles, and more, making it particularly useful for AI agents requiring reliable structured web data feeds.
Or by Bright Data’s MCP (Model Context Protocol) - a local server that exposes a wide range of scraping and automation tools. While not part of the langchain-brightdata package, it can be integrated manually using LangChain’s Tool or RequestsWrapper.
from langchain_brightdata import BrightDataSERP# Initialize the toolserp_tool = BrightDataSERP( bright_data_api_key="your-api-key" # Optional if set in environment variables)# Run a basic searchresults = serp_tool.invoke("latest AI research papers")print(results)
from langchain_brightdata import BrightDataSERP# Initialize the toolserp_tool = BrightDataSERP( bright_data_api_key="your-api-key" # Optional if set in environment variables)# Run a basic searchresults = serp_tool.invoke("latest AI research papers")print(results)
Access any public website, even if it’s bot-protected or geo-restricted.
Copy
from langchain_brightdata import BrightDataUnlocker# Initialize the toolunlocker_tool = BrightDataUnlocker( bright_data_api_key="your-api-key" # Optional if set in environment variables)# Access a webpageresult = unlocker_tool.invoke("https://example.com")print(result)