Skip to main content

LlamaIndex Tools Integration: Bright Data

This tool connects to Bright Data to enable your agent to crawl websites, search the web, and access structured data from platforms like LinkedIn, Amazon, and social media.

Bright Data's tools provide robust web scraping capabilities with built-in CAPTCHA solving and bot detection avoidance, allowing you to reliably extract data from the web.

Installation

pip install llama-index llama-index-core llama-index-tools-brightdata

Authentication

Sign up at Bright Data and retrieve your API key from your account settings. Replace "your-api-key" with your actual API key in the examples below:

Usage

Here's an example of how to use the BrightDataToolSpec with LlamaIndex:

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.brightdata import BrightDataToolSpec

brightdata_tool = BrightDataToolSpec(api_key="your-api-key", zone="unlocker")

tool_list = brightdata_tool.to_tool_list()

for tool in tool_list:
    tool.original_description = tool.metadata.description
    tool.metadata.description = "Bright Data web scraping tool"

agent = FunctionAgent(
    tools=tool_list,
    llm=OpenAI(model="gpt-4.1"),
)

query = (
    "Find and summarize the latest news about AI from major tech news sites"
)
tool_descriptions = "\n\n".join(
    [
        f"Tool Name: {tool.metadata.name}\nTool Description: {tool.original_description}"
        for tool in tool_list
    ]
)

query_with_descriptions = f"{tool_descriptions}\n\nQuery: {query}"

response = await agent.run(query_with_descriptions)
print(response)

Features

The Bright Data tool provides the following capabilities:

Web Scraping

  • scrape_as_markdown: Scrape a webpage and convert the content to Markdown format. This tool can bypass CAPTCHA and bot detection.
result = brightdata_tool.scrape_as_markdown("https://example.com")
print(result.text)

Visual Capture

  • get_screenshot: Take a screenshot of a webpage and save it to a file.
screenshot_path = brightdata_tool.get_screenshot(
    "https://example.com", output_path="example_screenshot.png"
)

Search Engine Access

  • search_engine: Search Google, Bing, or Yandex and get structured search results as JSON or Markdown. Supports advanced parameters for more specific searches.
search_results = brightdata_tool.search_engine(
    query="climate change solutions",
    engine="google",
    language="en",
    country_code="us",
    num_results=20,
)
print(search_results.text)

Structured Web Data Extraction

  • web_data_feed: Retrieve structured data from various platforms including LinkedIn, Amazon, Instagram, Facebook, X (Twitter), Zillow, and more.
linkedin_profile = brightdata_tool.web_data_feed(
    source_type="linkedin_person_profile",
    url="https://www.linkedin.com/in/username/",
)
print(linkedin_profile)

amazon_product = brightdata_tool.web_data_feed(
    source_type="amazon_product", url="https://www.amazon.com/dp/B08N5KWB9H"
)
print(amazon_product)

Advanced Configuration

The Bright Data tool offers various configuration options for specialized use cases:

Search Engine Parameters

The search_engine function supports advanced parameters like:

  • Language targeting (language parameter)
  • Country-specific search (country_code parameter)
  • Different search types (images, shopping, news, etc.)
  • Pagination controls
  • Mobile device emulation
  • Geolocation targeting
  • Hotel search parameters
results = brightdata_tool.search_engine(
    query="best hotels in paris",
    engine="google",
    language="fr",
    country_code="fr",
    search_type="shopping",
    device="mobile",
    hotel_dates="2025-06-01,2025-06-05",
    hotel_occupancy=2,
)

Supported Web Data Sources

The web_data_feed function supports retrieving structured data from:

  • LinkedIn (profiles and companies)
  • Amazon (products and reviews)
  • Instagram (profiles, posts, reels, comments)
  • Facebook (posts, marketplace listings, company reviews)
  • X/Twitter (posts)
  • Zillow (property listings)
  • Booking.com (hotel listings)
  • YouTube (videos)
  • ZoomInfo (company profiles)

For more information, visit the Bright Data documentation.

Metadata

Release files for llama-index-tools-brightdata 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-tools-brightdata 0.4.0
File Size Uploaded Provenance
llama_index_tools_brightdata-0.4.0.tar.gz 6.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-brightdata 0.4.0
File Interpreter ABI Platform
llama_index_tools_brightdata-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / llama_index_tools_brightdata-0.4.0.tar.gz

Download URL llama_index_tools_brightdata-0.4.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7aa9a8f87bdd46d92674767c2301fdbeb9a2c6d13ec8244dfafc877a8e55a22b
BLAKE2b-256 checksum
How to use checksums
a7039d66114f1af5c18d9687896fd47418168c6ab9f979d0dbb16d1d798de39d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_tools_brightdata-0.4.0-py3-none-any.whl

Download URL llama_index_tools_brightdata-0.4.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b38245653e0bf61651fd7ab74c19ad5fc09d3e130eaf29d4fde77b2f0cabf14e
BLAKE2b-256 checksum
How to use checksums
c103789a58f5b32056bd193f58ab3a18a75f5893ef8e9c44c8fba5d9d3e14207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-tools-brightdata 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page