Skip to content

Feat/youtube search tool - #8491

Open
Malaika zahid (malaika75) wants to merge 22 commits into
crewAIInc:mainfrom
malaika75:feat/youtube-search-tool
Open

Malaika zahid (malaika75) wants to merge 22 commits into
crewAIInc:mainfrom
malaika75:feat/youtube-search-tool

Conversation

@malaika75

@malaika75 Malaika zahid (malaika75) commented Oct 24, 2026 •

Copy link
Copy Markdown

Related issue

Fixes #8391

Summary

This PR introduces the YouTubeSearchTool to the crewai-tools library. It allows CrewAI agents to search for YouTube videos using the official YouTube Data API v3.

The tool accepts a search query and max results, returning structured data including title, video ID, URL, description, and publish date. It uses google-api-python-client and handles authentication securely via the YOUTUBE_API_KEY environment variable.

Verification

  • Tests added or updated for the changed behavior
  • Relevant tests and quality checks pass locally
  • Tested locally with a valid YouTube API key. Verified that it handles missing API keys and invalid queries gracefully.
  • All automated checks (Cursor Bugbot, CodeRabbit) have passed.

Additional context

None. The tool is fully self-contained and follows the existing tool structure in crewai-tools.


Note

Low Risk
Additive optional tool and dependency extra; no changes to core auth or existing tool behavior beyond new exports.

Overview
Adds YouTubeSearchTool, a new optional CrewAI tool that searches YouTube by keyword through YouTube Data API v3 (distinct from the existing RAG-based channel/video search tools).

Agents pass search_query and optional max_results (1–50); the tool returns structured hits (title, video_id, URL, description, published_at). Auth is via YOUTUBE_API_KEY; Google client libraries load lazily and are gated behind a new crewai-tools[youtube] extra in pyproject.toml.

The tool is exported from the package public API, documented in a tool README, and accompanied by a manual local test script (test_youtube_search_tool.py) that exercises live API calls and missing-key handling.

Reviewed by Cursor Bugbot for commit 4d2beec. Bugbot is set up for automated code reviews on this repo. Configure here.

@strix-security

strix-security Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Strix Security Review

Warning

This pull request has 229 commits after the last Strix review (7dc18ef). Strix has not reviewed these changes.
Automatic review on push is off for this repository. To review the latest changes, tag @strix-security in a comment, or turn on re-review on push.

To fix before merging (1)

PR summary: Adds a new `YouTubeSearchTool` to `crewai-tools` that searches the YouTube Data API v3 using a `YOUTUBE_API_KEY` environment variable and returns structured video results, together with a new `youtube` install extra, package exports, documentation, and a manual test script.

Review summary

Reviewed all seven changed files: the new YouTubeSearchTool implementation, its package exports, the youtube dependency extra, the README, and the added manual test script.

The implementation is otherwise sound: the outbound host is fixed by the discovery document and tool arguments cannot influence it, the search term is passed only as the URL-encoded q parameter, max_results is constrained by both the schema and an explicit clamp, and returned third-party metadata does not reach any privileged sink. The one confirmed issue is that the error handlers re-raise with the Google client exception still attached as their cause; because that exception's text contains the request URL — including the key parameter holding YOUTUBE_API_KEY — any traceback rendering or tracing export reproduces the operator's API key in plaintext. The tool's own log statements and the RuntimeError message are clean, so the exposure is confined to the retained chain, and the fix is to suppress it at that boundary.

Ruled out (3)
  • Can the agent-supplied search query interpolated into the INFO log line be used to forge log entries or leak sensitive values?
    The interpolation is unescaped, but the value only reaches a plain logging stream handler in the operator's own log output, no component parses line boundaries or interprets escape sequences, and logging request detail at INFO matches existing practice in sibling tools.
  • Can the tool's arguments be used for SSRF or injection into the outbound YouTube API request?
    The host is fixed by the Google discovery document, the search term is passed only as the client library's URL-encoded `q` parameter, and `max_results` is bounded by both the Pydantic schema and an explicit clamp.
  • Does returning third-party YouTube titles and descriptions to the agent create a prompt-injection path introduced by this PR?
    The strings are returned as inert data with no follow-on fetch, evaluation, or privileged action, identical to the existing search tools already shipped in this package.

Fixed the findings? re-run the review, or tag @strix-security in a PR comment to run a fresh review.

Review 1 on this PR · 7dc18ef · requested Oct 24 05:53 UTC when the PR was opened


Reviewed by Strix
Re-run review · Configure security review settings

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7dc18ef. Configure here.

@strix-security strix-security Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strix flagged a new security finding below. See the pinned summary comment for the full PR status.

@malaika75

Copy link
Copy Markdown
Author

Hi @crewAIInc/maintainers, all automated checks (Cursor, Strix Security) have passed, and this PR is properly linked to the open issue #8391. The code is ready for your final review. Thank you!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Implementation of YouTubeSearchTool using YouTube Data API v3

1 participant