Implementation:CrewAIInc CrewAI Oxylabs Amazon Search Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, Web_Scraping, E_Commerce |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
OxylabsAmazonSearchScraperTool scrapes Amazon search results by keyword using the Oxylabs web scraper API.
Description
The module follows the standard Oxylabs tool family pattern with three classes: OxylabsAmazonSearchScraperArgs (a Pydantic input schema accepting an Amazon search term string), OxylabsAmazonSearchScraperConfig (a configuration model with options including domain, start_page, pages, geo_location, user_agent_type, render, callback_url, context, parse, and parsing_instructions), and OxylabsAmazonSearchScraperTool (the main tool extending BaseTool). Initialization resolves credentials from constructor parameters or OXYLABS_USERNAME/OXYLABS_PASSWORD environment variables, creates an Oxylabs RealtimeClient with version metadata, and handles missing package installation interactively. The _run method calls self.oxylabs_api.amazon.scrape_search(query, **config) and returns the first result's content as a string or JSON-serialized dict. The pagination support via start_page and pages configuration makes it suitable for large-scale market research tasks.
Usage
Use this tool when a CrewAI agent needs to search Amazon's catalog and retrieve search result listings for product discovery, market research, or competitive analysis workflows.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_search_scraper_tool/oxylabs_amazon_search_scraper_tool.py
- Lines: 1-169
Signature
class OxylabsAmazonSearchScraperArgs(BaseModel):
query: str = Field(description="Amazon search term")
class OxylabsAmazonSearchScraperConfig(BaseModel):
domain: str | None = None
start_page: int | None = None
pages: int | None = None
geo_location: str | None = None
user_agent_type: str | None = None
render: str | None = None
callback_url: str | None = None
context: list | None = None
parse: bool | None = None
parsing_instructions: dict | None = None
class OxylabsAmazonSearchScraperTool(BaseTool):
name: str = "Oxylabs Amazon Search Scraper tool"
description: str = "Scrape Amazon search results with Oxylabs Amazon Search Scraper"
args_schema: type[BaseModel] = OxylabsAmazonSearchScraperArgs
oxylabs_api: RealtimeClient
config: OxylabsAmazonSearchScraperConfig
def __init__(
self,
username: str | None = None,
password: str | None = None,
config: OxylabsAmazonSearchScraperConfig | dict | None = None,
**kwargs,
): ...
def _run(self, query: str) -> str: ...
Import
from crewai_tools import OxylabsAmazonSearchScraperTool
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| username | str or None | No | Oxylabs username; falls back to OXYLABS_USERNAME environment variable |
| password | str or None | No | Oxylabs password; falls back to OXYLABS_PASSWORD environment variable |
| config | OxylabsAmazonSearchScraperConfig or dict or None | No | Configuration options including pagination; defaults to empty config |
| query | str | Yes | Amazon search term to scrape results for |
Outputs
| Name | Type | Description |
|---|---|---|
| _run() returns | str | Search results content as string or JSON-serialized dict if structured parsing is enabled |
Usage Examples
Basic Usage
from crewai_tools import OxylabsAmazonSearchScraperTool
tool = OxylabsAmazonSearchScraperTool(
username="your_username",
password="your_password",
)
result = tool._run(query="wireless headphones")
With Pagination
from crewai_tools import OxylabsAmazonSearchScraperTool
from crewai_tools.tools.oxylabs_amazon_search_scraper_tool.oxylabs_amazon_search_scraper_tool import (
OxylabsAmazonSearchScraperConfig,
)
config = OxylabsAmazonSearchScraperConfig(
domain="com",
start_page=1,
pages=3,
parse=True,
)
tool = OxylabsAmazonSearchScraperTool(config=config)
result = tool._run(query="bluetooth speakers")