Implementation:CrewAIInc CrewAI YouTube Channel Search Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, RAG, YouTube |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
YoutubeChannelSearchTool performs RAG-based semantic search across a YouTube channel's video content using vector embeddings.
Description
The YoutubeChannelSearchTool extends RagTool and uses the dual-schema pattern: YoutubeChannelSearchToolSchema requires both search_query and youtube_channel_handle, while FixedYoutubeChannelSearchToolSchema requires only search_query (used when a channel is pre-configured). During initialization, if a youtube_channel_handle is provided, it is added to the RAG index and the schema switches to the fixed variant. The add method ensures the channel handle is prefixed with @ if not already present, then delegates to RagTool.add with DataType.YOUTUBE_CHANNEL, signaling the RAG infrastructure to process YouTube channel content accordingly. The _run method optionally adds a new channel at runtime before delegating semantic search to the parent with configurable similarity_threshold and limit.
Usage
Use this tool when a CrewAI agent needs to semantically search through YouTube channel content, extracting information from video transcripts for research, competitive analysis, or content discovery workflows.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/youtube_channel_search_tool/youtube_channel_search_tool.py
- Lines: 1-56
Signature
class FixedYoutubeChannelSearchToolSchema(BaseModel):
search_query: str = Field(..., description="Mandatory search query ...")
class YoutubeChannelSearchToolSchema(FixedYoutubeChannelSearchToolSchema):
youtube_channel_handle: str = Field(..., description="Mandatory youtube_channel_handle path you want to search")
class YoutubeChannelSearchTool(RagTool):
name: str = "Search a Youtube Channels content"
description: str = "A tool that can be used to semantic search a query from a Youtube Channels content."
args_schema: type[BaseModel] = YoutubeChannelSearchToolSchema
def __init__(self, youtube_channel_handle: str | None = None, **kwargs):
...
def add(self, youtube_channel_handle: str) -> None:
...
def _run(self, search_query: str, youtube_channel_handle: str | None = None,
similarity_threshold: float | None = None, limit: int | None = None) -> str:
...
Import
from crewai_tools import YoutubeChannelSearchTool
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| search_query | str | Yes | The semantic search query to run against the YouTube channel content |
| youtube_channel_handle | str | No | YouTube channel handle (with or without @ prefix; 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 channel's video transcripts |
Usage Examples
Basic Usage
from crewai_tools import YoutubeChannelSearchTool
tool = YoutubeChannelSearchTool(youtube_channel_handle="@crewaboratory")
result = tool._run(search_query="how to build agents")
Dynamic Channel
from crewai_tools import YoutubeChannelSearchTool
tool = YoutubeChannelSearchTool()
result = tool._run(search_query="tutorials", youtube_channel_handle="crewaboratory")