> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-service-account.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Brightdata Tools

> Scrape a webpage as Markdown with BrightDataTools, using include and exclude tool filters.

```python brightdata_tools.py theme={null}
"""
Brightdata Tools
=============================

Demonstrates brightdata tools.
"""

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.brightdata import BrightDataTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------


# Example 1: Include specific BrightData functions for web scraping
scraping_agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[
        BrightDataTools(include_tools=["web_scraper", "serp_google", "serp_amazon"])
    ],
    markdown=True,
)

# Example 2: Exclude screenshot functions for performance
no_screenshot_agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[BrightDataTools(exclude_tools=["screenshot_generator"])],
    markdown=True,
)

# Example 3: Full BrightData functionality (default)
agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[BrightDataTools()],
    markdown=True,
)

# Example 1: Scrape a webpage as Markdown

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response(
        "Scrape this webpage as markdown: https://docs.agno.com/introduction",
    )

    # Example 2: Take a screenshot of a webpage
    # agent.print_response(
    #     "Take a screenshot of this webpage: https://docs.agno.com/introduction",
    # )

    # response = agent.run_response
    # if response.images:
    #     save_base64_data(response.images[0].content, "tmp/agno_screenshot.png")

    # Add a new SERP API zone: https://brightdata.com/cp/zones/new
    # Example 3: Search using Google
    # agent.print_response(
    #     "Search Google for 'Python web scraping best practices' and give me the top 5 results",
    # )

    # Example 4: Get structured data from Amazon product
    # agent.print_response(
    #     "Get detailed product information from this Amazon product: https://www.amazon.com/dp/B0D2Q9397Y?th=1&psc=1",
    # )

    # Example 5: Get LinkedIn profile data
    # agent.print_response(
    #     "Search for Satya Nadella on LinkedIn and give me a summary of his profile"
    # )
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai requests
    ```
  </Step>

  <Step title="Export your API keys">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export BRIGHT_DATA_API_KEY="your_bright_data_api_key_here"
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:BRIGHT_DATA_API_KEY="your_bright_data_api_key_here"
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `brightdata_tools.py`, then run:

    ```bash theme={null}
    python brightdata_tools.py
    ```
  </Step>
</Steps>

Full source: [cookbook/91\_tools/brightdata\_tools.py](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/brightdata_tools.py)
