Implementation:CrewAIInc CrewAI Oxylabs Amazon Product Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, Web_Scraping, E_Commerce |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
OxylabsAmazonProductScraperTool scrapes Amazon product pages by ASIN using the Oxylabs web scraper API.
Description
The module defines three classes: OxylabsAmazonProductScraperArgs (a Pydantic input schema expecting an Amazon ASIN string), OxylabsAmazonProductScraperConfig (a configuration model with options including domain, geo_location, user_agent_type, render, callback_url, context, parse, and parsing_instructions), and OxylabsAmazonProductScraperTool (the main tool extending BaseTool). During __init__, the tool resolves credentials from constructor parameters or OXYLABS_USERNAME/OXYLABS_PASSWORD environment variables, constructs an SDK type string with version metadata (crewai version, Python version, architecture), and initializes an Oxylabs RealtimeClient. If the oxylabs package is not installed, it interactively prompts via click.confirm to install it using uv add oxylabs. The _run method calls self.oxylabs_api.amazon.scrape_product(query, **config) and returns the first result's content, serializing dict content as JSON.
Usage
Use this tool when a CrewAI agent needs to retrieve Amazon product data (pricing, descriptions, reviews, specifications) by ASIN for e-commerce research, competitive analysis, or market intelligence workflows.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_product_scraper_tool/oxylabs_amazon_product_scraper_tool.py
- Lines: 1-167
Signature
class OxylabsAmazonProductScraperArgs(BaseModel):
query: str = Field(description="Amazon product ASIN")
class OxylabsAmazonProductScraperConfig(BaseModel):
domain: str | 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 OxylabsAmazonProductScraperTool(BaseTool):
name: str = "Oxylabs Amazon Product Scraper tool"
description: str = "Scrape Amazon product pages with Oxylabs Amazon Product Scraper"
args_schema: type[BaseModel] = OxylabsAmazonProductScraperArgs
oxylabs_api: RealtimeClient
config: OxylabsAmazonProductScraperConfig
def __init__(
self,
username: str | None = None,
password: str | None = None,
config: OxylabsAmazonProductScraperConfig | dict | None = None,
**kwargs,
) -> None: ...
def _run(self, query: str) -> str: ...
Import
from crewai_tools import OxylabsAmazonProductScraperTool
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 | OxylabsAmazonProductScraperConfig or dict or None | No | Configuration options for the scraper; defaults to empty config |
| query | str | Yes | Amazon product ASIN to scrape |
Outputs
| Name | Type | Description |
|---|---|---|
| _run() returns | str | Product page content as string or JSON-serialized dict if structured parsing is enabled |
Usage Examples
Basic Usage
from crewai_tools import OxylabsAmazonProductScraperTool
tool = OxylabsAmazonProductScraperTool(
username="your_username",
password="your_password",
)
result = tool._run(query="B0CHX3QBCH")
With Configuration
from crewai_tools import OxylabsAmazonProductScraperTool
from crewai_tools.tools.oxylabs_amazon_product_scraper_tool.oxylabs_amazon_product_scraper_tool import (
OxylabsAmazonProductScraperConfig,
)
config = OxylabsAmazonProductScraperConfig(
domain="com",
geo_location="United States",
parse=True,
)
tool = OxylabsAmazonProductScraperTool(config=config)
result = tool._run(query="B0CHX3QBCH")