YouTube video search tools for AI agent pipelines
Project description
📺 AzureAICommunity - Agent - YouTube Search
YouTube video search tools for AI agent applications built on the Agent Framework.
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.
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
👤 Author
Built and maintained by Vinoth Rajendran.
- 🐙 GitHub: github.com/rvinothrajendran — follow for more projects!
- 📺 YouTube: youtube.com/@VinothRajendran — subscribe for tutorials and demos!
- 💼 LinkedIn: linkedin.com/in/rvinothrajendran — let's connect!
📄 License
MIT — see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file azureaicommunity_agent_youtube_search-1.0.0.tar.gz.
File metadata
- Download URL: azureaicommunity_agent_youtube_search-1.0.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
055143814c907f3ec32ef10c6a5101a02c4c26f35e8499926a59c76ba9ed8a68
|
|
| MD5 |
9ad455c1d3bda85871e70af3de98f282
|
|
| BLAKE2b-256 |
8bd47cf4f8fee0fb17502df6f2b4b3f4225177f8bf8731c7bb296d567b4da4dc
|
File details
Details for the file azureaicommunity_agent_youtube_search-1.0.0-py3-none-any.whl.
File metadata
- Download URL: azureaicommunity_agent_youtube_search-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35c512f408d35e8d1d6dabd4334c71e61849b061e808e10e23952de915597356
|
|
| MD5 |
ce18b929b6c22ba97a71add33b2724e7
|
|
| BLAKE2b-256 |
947196830de0a2eab328b9054afd26326ec921d78e380a9923bd0a0230e6636a
|