Skip to main content

📺 AzureAICommunity - Agent - YouTube Search

YouTube video search tools for AI agent applications built on the Agent Framework.

PyPI Version Python Versions PyPI Downloads License PyPI Status GitHub Follow YouTube Channel YouTube Subscribers LinkedIn

Getting Started · Configuration · Usage · Contributing


Overview

azureaicommunity-agent-youtube-search provides a YouTubeTools class that registers a search_youtube_videos @tool function directly into any agent-framework agent. The agent can search YouTube using natural language — with optional channel scoping, result count, and paged offset support.


✨ Features

Feature
🔍 Natural language search — find YouTube videos from any query string
📺 Rich results — title, description, and watch URL for every result
📡 YouTube Data API v3 — fast, accurate, production-grade results
📋 Channel scoping — restrict results to a specific YouTube channel
🔢 Paged results — built-in count and offset for paginated search
🔌 Agent-ready — @tool-decorated function drops into any agent-framework agent
📦 Provider-agnostic — works with Ollama, Azure OpenAI, or any compatible client

📦 Installation

pip install azureaicommunity-agent-youtube-search

🚀 Quick Start

import asyncio
import os
from agent_framework.ollama import OllamaChatClient
from youtube_search_module import YouTubeConfig, YouTubeTools

config = YouTubeConfig(
    api_key=os.environ["YOUTUBE_API_KEY"],
    default_count=5,
)
tools = YouTubeTools.create(config)

agent = OllamaChatClient(model="llama3.2").as_agent(
    name="YouTubeAgent",
    instructions="You are a helpful YouTube search assistant. Use search_youtube_videos to find videos.",
    tools=tools,
)

async def main():
    session = agent.create_session()
    response = await agent.run("Find Python tutorial videos for beginners.", session=session)
    print(response.text)

asyncio.run(main())

🧑‍💻 Usage

Basic search

from youtube_search_module import YouTubeConfig, YouTubeTools

config = YouTubeConfig(api_key="YOUR_KEY")
tools = YouTubeTools.create(config)
# Pass tools to your agent

Restrict to a channel

config = YouTubeConfig(
    api_key="YOUR_KEY",
    channel_id="UCQf_yRJpsfyEiWWpt1MZ6vA",  # restrict to this channel
    default_count=5,
)
tools = YouTubeTools.create(config)

Access search directly (without agent)

import asyncio
from youtube_search_module import YouTubeConfig, YouTubeSearch

async def main():
    config = YouTubeConfig(api_key="YOUR_KEY")
    searcher = YouTubeSearch(config)
    results = await searcher.search_async("AI agent framework", count=3)
    for r in results:
        print(r)

asyncio.run(main())

⚙️ Configuration

YouTubeConfig fields

Parameter Type Default Description
api_key str (required) YouTube Data API v3 key
channel_id str "" Optional channel ID to scope results
max_results int 25 Upper bound on results the API may return per request
default_count int 10 Default number of videos returned when count is not specified
logger Logger | None None Optional logger; falls back to logging.getLogger(__name__)

🤝 Contributing

Contributions are welcome! Please open an issue to discuss what you'd like to change before submitting a pull request.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m 'Add my feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request

👤 Author

Built and maintained by Vinoth Rajendran.


📄 License

MIT — see LICENSE for details.

Metadata

Release files for azureaicommunity-agent-youtube-search 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azureaicommunity-agent-youtube-search 1.0.0
File Size Uploaded Provenance Actions
azureaicommunity_agent_youtube_search-1.0.0.tar.gz 7.1 kB Without provenance Details for azureaicommunity_agent_youtube_search-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for azureaicommunity-agent-youtube-search 1.0.0
File Interpreter ABI Platform Actions
azureaicommunity_agent_youtube_search-1.0.0-py3-none-any.whl Python 3 none any Details for azureaicommunity_agent_youtube_search-1.0.0-py3-none-any.whl

Total release size: 15.7 kB

Release files / azureaicommunity_agent_youtube_search-1.0.0.tar.gz

Download URL azureaicommunity_agent_youtube_search-1.0.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
055143814c907f3ec32ef10c6a5101a02c4c26f35e8499926a59c76ba9ed8a68
BLAKE2b-256 checksum
How to use checksums
8bd47cf4f8fee0fb17502df6f2b4b3f4225177f8bf8731c7bb296d567b4da4dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / azureaicommunity_agent_youtube_search-1.0.0-py3-none-any.whl

Download URL azureaicommunity_agent_youtube_search-1.0.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35c512f408d35e8d1d6dabd4334c71e61849b061e808e10e23952de915597356
BLAKE2b-256 checksum
How to use checksums
947196830de0a2eab328b9054afd26326ec921d78e380a9923bd0a0230e6636a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for azureaicommunity-agent-youtube-search 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page