Implementation:CrewAIInc CrewAI Oxylabs Google Search Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, Web_Scraping, Search |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
OxylabsGoogleSearchScraperTool scrapes Google search results using the Oxylabs web scraper API.
Description
The module follows the standard Oxylabs tool family pattern with three classes: OxylabsGoogleSearchScraperArgs (a Pydantic input schema accepting a search query string), OxylabsGoogleSearchScraperConfig (a configuration model with options including domain, start_page, pages, limit, geo_location, user_agent_type, render, callback_url, context, parse, and parsing_instructions -- notably including a limit field for controlling the number of results per page that is unique to this Google variant), and OxylabsGoogleSearchScraperTool (the main tool extending BaseTool). Initialization handles credential resolution from constructor parameters or OXYLABS_USERNAME/OXYLABS_PASSWORD environment variables and creates an Oxylabs RealtimeClient with the standard version metadata SDK type string. The _run method calls self.oxylabs_api.google.scrape_search(query, **config) and returns the first result's content as a string or JSON-serialized dict. Geo-targeting and device emulation capabilities enable location-specific and device-specific search result retrieval.
Usage
Use this tool when a CrewAI agent needs to perform Google searches programmatically for web research, competitor analysis, SEO monitoring, or general information gathering tasks.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/oxylabs_google_search_scraper_tool/oxylabs_google_search_scraper_tool.py
- Lines: 1-172
Signature
class OxylabsGoogleSearchScraperArgs(BaseModel):
query: str = Field(description="Search query")
class OxylabsGoogleSearchScraperConfig(BaseModel):
domain: str | None = None
start_page: int | None = None
pages: int | None = None
limit: 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 OxylabsGoogleSearchScraperTool(BaseTool):
name: str = "Oxylabs Google Search Scraper tool"
description: str = "Scrape Google Search results with Oxylabs Google Search Scraper"
args_schema: type[BaseModel] = OxylabsGoogleSearchScraperArgs
oxylabs_api: RealtimeClient
config: OxylabsGoogleSearchScraperConfig
def __init__(
self,
username: str | None = None,
password: str | None = None,
config: OxylabsGoogleSearchScraperConfig | dict | None = None,
**kwargs,
): ...
def _run(self, query: str, **kwargs) -> str: ...
Import
from crewai_tools import OxylabsGoogleSearchScraperTool
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 | OxylabsGoogleSearchScraperConfig or dict or None | No | Configuration options including pagination and result limits; defaults to empty config |
| query | str | Yes | Google search query to execute |
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 OxylabsGoogleSearchScraperTool
tool = OxylabsGoogleSearchScraperTool(
username="your_username",
password="your_password",
)
result = tool._run(query="CrewAI multi-agent framework")
With Geo-targeting and Pagination
from crewai_tools import OxylabsGoogleSearchScraperTool
from crewai_tools.tools.oxylabs_google_search_scraper_tool.oxylabs_google_search_scraper_tool import (
OxylabsGoogleSearchScraperConfig,
)
config = OxylabsGoogleSearchScraperConfig(
domain="co.uk",
geo_location="United Kingdom",
start_page=1,
pages=2,
limit=10,
parse=True,
)
tool = OxylabsGoogleSearchScraperTool(config=config)
result = tool._run(query="best AI frameworks 2025")