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 Website Search Tool

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

Overview

WebsiteSearchTool performs RAG-based semantic search over website content by URL using vector embeddings.

Description

The WebsiteSearchTool extends RagTool and uses the dual-schema pattern: WebsiteSearchToolSchema requires both search_query and website URL, while FixedWebsiteSearchToolSchema requires only search_query (used when a website is pre-configured). During initialization, if a website URL is provided, it is added to the RAG index via self.add(website) with DataType.WEBSITE, the description is updated, and the schema switches to the fixed variant. The add method overrides the parent to pass DataType.WEBSITE, signaling the RAG infrastructure to handle website content appropriately. The _run method optionally adds a new website at runtime and delegates semantic search to RagTool._run with configurable similarity_threshold and limit parameters.

Usage

Use this tool when a CrewAI agent needs to semantically search through website content using vector embeddings for intelligent information retrieval that goes beyond simple text matching.

Code Reference

Source Location

  • Repository: CrewAI
  • File: lib/crewai-tools/src/crewai_tools/tools/website_search/website_search_tool.py
  • Lines: 1-51

Signature

class FixedWebsiteSearchToolSchema(BaseModel):
    search_query: str = Field(..., description="Mandatory search query ...")

class WebsiteSearchToolSchema(FixedWebsiteSearchToolSchema):
    website: str = Field(..., description="Mandatory valid website URL you want to search on")

class WebsiteSearchTool(RagTool):
    name: str = "Search in a specific website"
    description: str = "A tool that can be used to semantic search a query from a specific URL content."
    args_schema: type[BaseModel] = WebsiteSearchToolSchema

    def __init__(self, website: str | None = None, **kwargs):
        ...
    def _run(self, search_query: str, website: str | None = None,
             similarity_threshold: float | None = None, limit: int | None = None) -> str:
        ...

Import

from crewai_tools import WebsiteSearchTool

I/O Contract

Inputs

Name Type Required Description
search_query str Yes The semantic search query to run against the website content
website str No URL of the website to search (can be set at init or runtime)
similarity_threshold float No Minimum similarity score for results
limit int No Maximum number of results to return

Outputs

Name Type Description
_run() returns str Semantically relevant text passages from the website content

Usage Examples

Basic Usage

from crewai_tools import WebsiteSearchTool

tool = WebsiteSearchTool(website="https://example.com")
result = tool._run(search_query="product features")

Dynamic Website

from crewai_tools import WebsiteSearchTool

tool = WebsiteSearchTool()
result = tool._run(search_query="pricing", website="https://example.com/pricing")

Related Pages

Page Connections

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