Overview
The Content Strategy Agent is your AI-powered trend analyst and content strategist. It continuously monitors YouTube trends, analyzes competitor channels, and generates data-driven content strategies optimized for maximum views and engagement.
What It Does The Content Strategy Agent identifies viral topics, analyzes what works for competitors, and generates complete content strategies including topic selection, target audience, content type, and optimal publishing times.
Key Features
Trend Analysis Monitors YouTube’s trending videos and extracts popular topics
Competitor Research Analyzes top-performing content from competitor channels
Topic Scoring Uses advanced algorithms to score and rank potential topics
Audience Targeting Identifies optimal target audience for each content piece
How It Works
Trend Collection
Fetches trending videos from YouTube API across multiple categories and regions
Competitor Analysis
Analyzes configured competitor channels to identify successful content patterns
Topic Extraction
Extracts keywords and topics from trending content using NLP techniques
Scoring & Ranking
Applies scoring algorithm considering trends, competition, and seasonality
Strategy Generation
Creates complete content strategy with angle, audience, and timing recommendations
Core Methods
initialize()
Initializes the agent and loads historical data.
content-strategy-agent.js
async initialize () {
this . logger . info ( 'Initializing Content Strategy Agent...' );
await this . loadHistoricalData ();
await this . analyzeTrends ();
return true ;
}
fetchYouTubeTrends()
Retrieves trending videos from YouTube API.
content-strategy-agent.js
async fetchYouTubeTrends () {
const youtube = this . credentials . getYouTubeClient ();
const response = await youtube . videos . list ({
part: 'snippet,statistics' ,
chart: 'mostPopular' ,
maxResults: 50 ,
regionCode: process . env . YOUTUBE_REGION || 'US'
});
return response . data . items . map ( video => ({
title: video . snippet . title ,
tags: video . snippet . tags || [],
viewCount: parseInt ( video . statistics . viewCount ),
category: video . snippet . categoryId ,
publishedAt: video . snippet . publishedAt
}));
}
The agent can be configured to analyze trends from any region by setting the YOUTUBE_REGION environment variable.
analyzeCompetitors()
Analyzes competitor channels to identify successful topics.
content-strategy-agent.js
async analyzeCompetitors () {
const competitorChannels = ( process . env . COMPETITOR_CHANNELS || '' ). split ( ',' );
const competitorData = [];
for ( const channelId of competitorChannels ) {
if ( ! channelId ) continue ;
const videos = await this . getChannelVideos ( channelId );
const analysis = this . analyzeVideoPerformance ( videos );
competitorData . push ({
channelId ,
topPerformingTopics: analysis . topTopics ,
averageViews: analysis . avgViews ,
uploadFrequency: analysis . frequency
});
}
return competitorData ;
}
generateContentStrategy()
Generates a complete content strategy based on trend and competitor analysis.
content-strategy-agent.js
async generateContentStrategy ( requestedTopic = null ) {
let topic , angle , targetAudience , contentType ;
if ( requestedTopic ) {
topic = requestedTopic ;
angle = await this . generateAngle ( topic );
} else {
// Select from trending topics
const selectedTopic = this . selectOptimalTopic ();
topic = selectedTopic . topic ;
angle = await this . generateAngle ( topic );
}
// Determine target audience
targetAudience = await this . identifyTargetAudience ( topic );
// Select content type
contentType = this . selectContentType ( topic );
const strategy = {
topic ,
angle ,
targetAudience ,
contentType ,
keywords: this . extractKeywords ( topic ),
estimatedViews: this . predictViews ( topic ),
bestPublishTime: this . calculateBestPublishTime (),
competitorAnalysis: this . getCompetitorInsights ( topic ),
createdAt: new Date (). toISOString ()
};
await this . db . saveContentStrategy ( strategy );
return strategy ;
}
Topic Scoring Algorithm
The agent uses a sophisticated scoring algorithm to rank potential topics:
Based on current view counts and momentum of trending videos topic . score += trend . viewCount / 1000000 ; // Normalize by millions
Weight from competitor channel performance topicData . score += avgViews / 100000 ; // Normalize
Adjusts for seasonal relevance (1.0 - 1.5x) finalScore = topic . score * this . getSeasonalMultiplier ( topic . topic )
Adjusts based on target audience size (1.0 - 1.3x) finalScore *= this . getAudienceMultiplier ( topic . topic )
Content Type Selection
The agent intelligently selects the optimal content format:
content-strategy-agent.js
selectContentType ( topic ) {
const types = [
{ type: 'Tutorial' , suitableFor: [ 'how to' , 'guide' , 'learn' ] },
{ type: 'List' , suitableFor: [ 'best' , 'top' , 'worst' ] },
{ type: 'Review' , suitableFor: [ 'review' , 'vs' , 'comparison' ] },
{ type: 'Explainer' , suitableFor: [ 'what is' , 'why' , 'explained' ] },
{ type: 'News' , suitableFor: [ 'breaking' , 'latest' , 'new' ] },
{ type: 'Story' , suitableFor: [ 'story' , 'journey' , 'experience' ] }
];
const topicLower = topic . toLowerCase ();
for ( const contentType of types ) {
if ( contentType . suitableFor . some ( keyword => topicLower . includes ( keyword ))) {
return contentType . type ;
}
}
return 'Explainer' ;
}
Optimal Publishing Times
The agent calculates the best time to publish based on channel analytics:
content-strategy-agent.js
calculateBestPublishTime () {
// Analyze best publishing times
const bestTimes = [
{ day: 'Tuesday' , hour: 14 },
{ day: 'Wednesday' , hour: 14 },
{ day: 'Thursday' , hour: 14 },
{ day: 'Friday' , hour: 15 },
{ day: 'Saturday' , hour: 10 },
{ day: 'Sunday' , hour: 10 }
];
const selected = bestTimes [ Math . floor ( Math . random () * bestTimes . length )];
const nextDate = this . getNextWeekday ( selected . day );
nextDate . setHours ( selected . hour , 0 , 0 , 0 );
return nextDate . toISOString ();
}
These times are optimized based on general YouTube traffic patterns. The Publishing Scheduler Agent further refines timing based on your channel’s specific analytics.
Configuration
Configure the Content Strategy Agent through environment variables:
# YouTube Region for trend analysis
YOUTUBE_REGION = US
# Competitor channels to analyze (comma-separated)
COMPETITOR_CHANNELS = UCxxxxxx,UCyyyyyy,UCzzzzzz
# Minimum topic score threshold
MIN_TOPIC_SCORE = 5.0
# Content refresh interval (hours)
STRATEGY_REFRESH_HOURS = 24
Strategy Output
Here’s an example of a generated content strategy:
{
"topic" : "AI Technology Trends" ,
"angle" : "AI Technology Trends: What Nobody Is Telling You" ,
"targetAudience" : "Tech enthusiasts, developers, early adopters" ,
"contentType" : "Explainer" ,
"keywords" : [
"technology" ,
"trends" ,
"artificial" ,
"intelligence"
],
"estimatedViews" : 45000 ,
"bestPublishTime" : "2026-03-07T14:00:00.000Z" ,
"competitorAnalysis" : [
{
"channelId" : "UCxxxxxx" ,
"averageViews" : 125000 ,
"relevantVideos" : [
{ "topic" : "technology" , "avgViews" : 150000 }
]
}
],
"createdAt" : "2026-03-05T10:30:00.000Z"
}
Trend Updates Every 6 hours
Topics Analyzed 50+ per refresh
Competitor Channels Up to 10 tracked
Best Practices
Configure Multiple Competitors
Track 5-10 competitor channels in your niche for comprehensive insights
Review Strategies Regularly
While the agent runs automatically, periodically review generated strategies to ensure alignment with your brand
Set YOUTUBE_REGION to match your primary audience geography
The agent automatically filters out recently used topics to maintain content variety
Next Steps
Script Writer Agent See how strategies become engaging video scripts
Analytics Agent Learn how performance data feeds back into strategy
API Reference View complete API documentation
Configuration Set up competitor tracking and regions