Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CrewAIInc CrewAI Serply Web Search Tool

From Leeroopedia
Revision as of 11:09, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/CrewAIInc_CrewAI_Serply_Web_Search_Tool.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Tools, Web_Search
Last Updated 2026-02-11 00:00 GMT

Overview

SerplyWebSearchTool performs Google web searches using the Serply.io search API with configurable language, result limits, device type, and regional proxy settings.

Description

The SerplyWebSearchTool extends BaseTool and queries the Serply.io search endpoint at https://api.serply.io/v1/search/. It accepts hl (host language, default "us"), limit (10-100 results), device_type ("desktop" or "mobile"), and proxy_location (country code) during initialization. It pre-builds a query payload with num, gl, and hl parameters and sets up HTTP headers with the SERPLY_API_KEY, device type, User-Agent, and proxy location. The _run method appends the search query to the payload, constructs a GET request, parses the JSON response for a "results" array, and formats each result with title, link, and description.

Usage

Use this tool when a CrewAI agent needs to perform general-purpose Google web searches with geographic and device targeting for broad information retrieval tasks.

Code Reference

Source Location

  • Repository: CrewAI
  • File: lib/crewai-tools/src/crewai_tools/tools/serply_api_tool/serply_web_search_tool.py
  • Lines: 1-113

Signature

class SerplyWebSearchToolSchema(BaseModel):
    search_query: str = Field(..., description="Mandatory search query you want to use to Google search")

class SerplyWebSearchTool(BaseTool):
    name: str = "Google Search"
    description: str = "A tool to perform Google search with a search_query."
    args_schema: type[BaseModel] = SerplyWebSearchToolSchema
    search_url: str = "https://api.serply.io/v1/search/"
    hl: str | None = "us"
    limit: int | None = 10
    device_type: str | None = "desktop"
    proxy_location: str | None = "US"
    env_vars: list[EnvVar]  # SERPLY_API_KEY

    def _run(self, **kwargs: Any) -> Any:
        ...

Import

from crewai_tools import SerplyWebSearchTool

I/O Contract

Inputs

Name Type Required Description
search_query str Yes The search query to use for Google search
hl str No Host language code for results display (default "us")
limit int No Maximum number of results to return, 10-100 (default 10)
device_type str No Device type for results: "desktop" or "mobile" (default "desktop")
proxy_location str No Country code for regional results (default "US")

Outputs

Name Type Description
_run() returns str Formatted search results with title, link, and description for each result

Usage Examples

Basic Usage

from crewai_tools import SerplyWebSearchTool

tool = SerplyWebSearchTool(limit=5, device_type="desktop", proxy_location="US")
result = tool._run(search_query="CrewAI multi-agent framework")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment