Skip to main content
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.

Overview

Integration details

Tool features

Setup

The integration lives in the langchain-brightdata package. pip install langchain-brightdata

Credentials

You’ll need a Bright Data API key to use this tool. You can set it as an environment variable:
Or pass it directly when initializing the tool:

Instantiation

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. The tool accepts various parameters during instantiation:
  • bright_data_api_key (required, str): Your Bright Data API key for authentication.
  • search_engine (optional, str): Search engine to use for queries. Default is “google”. Other options include “bing”, “yahoo”, “yandex”, “DuckDuckGo” etc.
  • country (optional, str): Two-letter country code for localized search results (e.g., “us”, “gb”, “de”, “jp”). Default is “us”.
  • language (optional, str): Two-letter language code for the search results (e.g., “en”, “es”, “fr”, “de”). Default is “en”.
  • results_count (optional, int): Number of search results to return. Default is 10. Maximum value is typically 100.
  • search_type (optional, str): Type of search to perform. Options include:
    • None (default): Regular web search
    • “isch”: Images search
    • “shop”: Shopping search
    • “nws”: News search
    • “jobs”: Jobs search
  • device_type (optional, str): Device type to simulate for the search. Options include:
    • None (default): Desktop device
    • “mobile”: Generic mobile device
    • “ios”: iOS device (iPhone)
    • “android”: Android device
  • parse_results (optional, bool): Whether to return parsed JSON results. Default is False, which returns raw HTML response.

Invocation

Basic Usage

Advanced Usage with Parameters

Customization Options

The BrightDataSERP tool accepts several parameters for customization:

Use within an agent

API reference