How tusharbecoding/multi-youtube-agent works
1. Overall shape
- This repo is a small, single-purpose AI workflow application built around CrewAI.
- The architecture is a two-stage sequential pipeline: first research, then writing.
2. Entry point and orchestration
- crew.py is the runtime entry point.
- It assembles the agents, tasks, and tools into a CrewAI execution plan and kicks off the workflow.
- This file is the main control boundary between configuration and execution.
3. Agent layer
- agents.py defines two specialized LLM agents:
- Blog Researcher: focuses on finding and analyzing YouTube content.
- Blog Writer: turns research into a polished blog post.
- The separation is important: one agent gathers facts, the other synthesizes narrative.
4. Task layer
- tasks.py defines the work each agent performs and the expected outputs.
- The tasks likely encode the handoff between stages: research output becomes the writer’s input.
- This is the main point where the pipeline enforces order and output structure.
5. Tooling boundary
- tools.py configures the external search capability, specifically a YouTube channel search tool.
- This is the repo’s only explicit non-LLM data source.
- The tool is bound to a channel handle, so the research scope is constrained to a chosen YouTube source.
6. External services
- The system depends on:
- OpenAI models for generation and reasoning
- CrewAI for orchestration
- crewai-tools for YouTube integration
- The OpenAI API key is provided through environment configuration, so model access is externalized from code.
7. Data flow
- Input begins as a topic configured in crew.py.
- The researcher agent queries the YouTube channel via the tool, extracts relevant information, and produces structured research.
- That research is passed to the writer agent, which generates the final blog post in Markdown.
- The output is written to blog_post.md.
8. Control flow
- The execution model is sequential, not parallel.
- The writer depends on the researcher’s output, so the system behaves like a simple two-step assembly line.
- The README also indicates memory and caching are enabled, which means repeated runs may retain context and reduce redundant calls.
9. Configuration boundaries
- There are three key customization points:
- topic selection in crew.py
- agent behavior in agents.py
- YouTube channel target in tools.py
- This keeps the repo modular even though it is small.
10. Runtime and packaging
- The project is a Python application managed through requirements.txt.
- Runtime dependencies are minimal and centered on AI orchestration rather than a web server, database, or job queue.
- There is no evidence of persistent backend state beyond the generated markdown file.
11. Output boundary
- The final artifact is a human-readable Markdown blog post.
- That means the system’s primary deliverable is content generation, not an API response or UI rendering.
12. How to diagram it
- A good architecture diagram would show:
- a topic/config input
- crew.py as the orchestrator
- agents.py split into researcher and writer
- tools.py connecting the researcher to YouTube
- OpenAI as the model backend
- tasks.py defining the handoff between stages
- blog_post.md as the final output
Main entry points: crew.py Crew entry · tasks.py Write task · agents.py Agents · tools.py YouTube search
Components 13
Core pipeline
Entry point, agents, tasks, and orchestration for the two-stage workflow.
- Crew entry · Runtime entry point that assembles the workflow and starts execution.
crew.py - Topic config · The topic or run-specific focus selected for the blog workflow.
crew.py - Agents · Defines the specialized researcher and writer agents.
agents.py - Researcher · Finds and analyzes YouTube content relevant to the topic.
agents.py - Writer · Synthesizes research into a polished blog post.
agents.py - Tasks · Defines the ordered work units and the handoff between stages.
tasks.py - Research task · Collects and structures research for the writer to consume.
tasks.py - Write task · Transforms research into the final Markdown article.
tasks.py - Tools · Configures the YouTube search capability used by the researcher.
tools.py
External services
Model and data-source boundaries used by the workflow.
- YouTube search · Channel-scoped search tool used to gather source material.
tools.py - CrewAI · Framework that executes the sequential agent task plan.
- OpenAI · LLM provider used by both agents for reasoning and generation.
Output
Generated artifact produced by the run.
- Blog post · Final Markdown output written by the workflow.
Connections 16
- Topic config → Crew entry: configure · Run topic feeds the orchestration entry point.
- Crew entry → CrewAI: execute · Entry point hands the assembled plan to CrewAI.
- Crew entry → Agents: load · Orchestrator loads the agent definitions.
- Crew entry → Tasks: load · Orchestrator loads the task definitions.
- Crew entry → Tools: load · Orchestrator loads the tool configuration.
- Agents → Researcher: defines · Agent module defines the research specialist.
- Agents → Writer: defines · Agent module defines the writing specialist.
- Tasks → Research task: defines · Task module defines the research step.
- Tasks → Write task: defines · Task module defines the writing step.
- Tools → YouTube search: binds · Tool module configures the YouTube source access.
- Researcher → OpenAI: uses · Research agent relies on the model backend.
- Writer → OpenAI: uses · Writer agent relies on the model backend.
- Researcher → YouTube search: queries · Research agent gathers source material through the YouTube tool.
- YouTube search → Write task: feeds · Research output becomes input to the writing stage.
- Research task → Write task: handoff · Tasks enforce the sequential flow from research to writing.
- Write task → Blog post: produces · Writing stage emits the final Markdown artifact.