Implementation:CrewAIInc CrewAI YouTube Video Search Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, RAG, YouTube |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
YoutubeVideoSearchTool performs RAG-based semantic search over individual YouTube video transcripts using vector embeddings.
Description
The YoutubeVideoSearchTool extends RagTool and uses the dual-schema pattern: YoutubeVideoSearchToolSchema requires both search_query and youtube_video_url, while FixedYoutubeVideoSearchToolSchema requires only search_query (used when a specific video URL is pre-configured). During initialization, if a youtube_video_url is provided, it is added to the RAG index via the add method (which delegates to RagTool.add with DataType.YOUTUBE_VIDEO), the description is updated, and the schema switches to the fixed variant. The _run method optionally adds a new video URL at runtime before delegating semantic search to the parent RagTool._run with configurable similarity_threshold and limit parameters.
Usage
Use this tool when a CrewAI agent needs to semantically search through YouTube video transcripts, enabling intelligent extraction of specific information from video content for video-based research and analysis workflows.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/youtube_video_search_tool/youtube_video_search_tool.py
- Lines: 1-51
Signature
class FixedYoutubeVideoSearchToolSchema(BaseModel):
search_query: str = Field(..., description="Mandatory search query ...")
class YoutubeVideoSearchToolSchema(FixedYoutubeVideoSearchToolSchema):
youtube_video_url: str = Field(..., description="Mandatory youtube_video_url path you want to search")
class YoutubeVideoSearchTool(RagTool):
name: str = "Search a Youtube Video content"
description: str = "A tool that can be used to semantic search a query from a Youtube Video content."
args_schema: type[BaseModel] = YoutubeVideoSearchToolSchema
def __init__(self, youtube_video_url: str | None = None, **kwargs):
...
def add(self, youtube_video_url: str) -> None:
...
def _run(self, search_query: str, youtube_video_url: str | None = None,
similarity_threshold: float | None = None, limit: int | None = None) -> str:
...
Import
from crewai_tools import YoutubeVideoSearchTool
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| search_query | str | Yes | The semantic search query to run against the YouTube video content |
| youtube_video_url | str | No | YouTube video URL 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 YouTube video transcript |
Usage Examples
Basic Usage
from crewai_tools import YoutubeVideoSearchTool
tool = YoutubeVideoSearchTool(youtube_video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
result = tool._run(search_query="main topic discussed")
Dynamic Video
from crewai_tools import YoutubeVideoSearchTool
tool = YoutubeVideoSearchTool()
result = tool._run(
search_query="key takeaways",
youtube_video_url="https://www.youtube.com/watch?v=example123"
)