Skip to main content

Overview

The SEO Optimizer Agent is your YouTube search optimization expert. It analyzes your content and generates perfectly optimized titles, descriptions, tags, and metadata to maximize your video’s discoverability in YouTube search, suggested videos, and Google results.

What It Does

The SEO Optimizer Agent creates search-optimized metadata including titles, descriptions, tags, hashtags, chapters, and category selection. Every element is designed to improve your video’s ranking and click-through rate.

Key Features

Title Optimization

Generates titles with power words, optimal length, and keyword placement

Smart Descriptions

Creates comprehensive descriptions with timestamps and keyword density

Tag Generation

Produces optimized tag sets within YouTube’s 500-character limit

SEO Scoring

Calculates SEO score (0-100) for quality assurance

Core Methods

optimize()

Main method that orchestrates the entire SEO optimization process.
seo-optimizer-agent.js
async optimize(script, strategy) {
  this.logger.info(`Optimizing SEO for: ${script.title}`);
  
  // Generate optimized title
  const title = await this.optimizeTitle(script.title, strategy);
  
  // Generate description
  const description = await this.generateDescription(script, strategy);
  
  // Extract and optimize tags
  const tags = await this.generateTags(script, strategy);
  
  // Generate hashtags
  const hashtags = await this.generateHashtags(strategy);
  
  // Create chapters/timestamps
  const chapters = await this.generateChapters(script);
  
  // Generate end screen elements
  const endScreen = await this.generateEndScreenStrategy();
  
  // Calculate SEO score
  const seoScore = await this.calculateSEOScore(title, description, tags);
  
  const seoData = {
    title,
    description,
    tags,
    hashtags,
    chapters,
    endScreen,
    seoScore,
    metadata: {
      primaryKeyword: strategy.keywords[0],
      secondaryKeywords: strategy.keywords.slice(1, 5),
      targetLength: this.calculateOptimalLength(strategy.contentType),
      language: 'en',
      category: this.selectCategory(strategy)
    },
    createdAt: new Date().toISOString()
  };
  
  await this.db.saveSEOData(seoData);
  return seoData;
}

Title Optimization

Titles are optimized using proven techniques:

optimizeTitle()

seo-optimizer-agent.js
async optimizeTitle(originalTitle, strategy) {
  let optimizedTitle = originalTitle;
  
  // Add power words if not present
  const powerWords = ['Ultimate', 'Complete', 'Essential', 'Proven', 
                      'Secret', 'Amazing', 'Powerful'];
  const hasPowerWord = powerWords.some(word => 
    originalTitle.toLowerCase().includes(word.toLowerCase())
  );
  
  if (!hasPowerWord && originalTitle.length < 60) {
    const randomPowerWord = powerWords[Math.floor(Math.random() * powerWords.length)];
    optimizedTitle = `${randomPowerWord} ${originalTitle}`;
  }
  
  // Add year if relevant and not present
  const currentYear = new Date().getFullYear();
  if (!optimizedTitle.includes(currentYear.toString()) && optimizedTitle.length < 70) {
    optimizedTitle = `${optimizedTitle} (${currentYear})`;
  }
  
  // Ensure primary keyword is in title
  const primaryKeyword = strategy.keywords[0];
  if (primaryKeyword && !optimizedTitle.toLowerCase().includes(primaryKeyword.toLowerCase())) {
    optimizedTitle = `${optimizedTitle} - ${primaryKeyword}`;
  }
  
  // Truncate if too long (YouTube limit: 100 characters)
  if (optimizedTitle.length > 100) {
    optimizedTitle = optimizedTitle.substring(0, 97) + '...';
  }
  
  return this.titleCase(optimizedTitle);
}

Title Best Practices

This length displays fully in search results while leaving room for power words
if (title.length >= 60 && title.length <= 70) score += 10;
Words like “Ultimate”, “Complete”, “Secret” increase click-through rates by 15-20%
const powerWords = ['Ultimate', 'Complete', 'Essential', 'Proven', 'Secret'];
Titles with numbers perform 36% better in search results
if (/\d/.test(title)) score += 5;
Including the current year signals freshness and relevance
if (title.includes(new Date().getFullYear().toString())) score += 5;

Description Generation

Descriptions are comprehensive and SEO-optimized:

generateDescription()

seo-optimizer-agent.js
async generateDescription(script, strategy) {
  let description = '';
  
  // First 125 characters - most important for SEO
  const hook = `${script.title} - In this video, you'll discover ${strategy.angle.toLowerCase()}.`;
  description += hook + '\n\n';
  
  // Video overview
  description += '📺 WHAT YOU\'LL LEARN:\n';
  if (script.mainContent && script.mainContent.sections) {
    script.mainContent.sections.slice(0, 5).forEach(section => {
      description += `• ${section.title}\n`;
    });
  }
  description += '\n';
  
  // Timestamps/Chapters
  description += '⏱️ TIMESTAMPS:\n';
  description += '00:00 Introduction\n';
  let timestamp = 20;
  script.mainContent.sections.forEach(section => {
    const minutes = Math.floor(timestamp / 60);
    const seconds = timestamp % 60;
    description += `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')} ${section.title}\n`;
    timestamp += section.duration || 60;
  });
  
  // ... additional sections
  
  return description;
}

Description Structure

1

Hook (First 125 Characters)

Most important for search rankings and preview text
2

What You'll Learn

Bulleted list of key takeaways for quick scanning
3

Timestamps

Improves user experience and enables YouTube chapters
4

About This Video

Keyword-rich paragraph for SEO (300-500 words)
5

Links & Resources

External links, social media, related videos
6

Tags & Hashtags

Additional keyword targeting
The first 125 characters appear in search results. The agent ensures this section contains your primary keyword and a compelling hook.

Tag Generation

Tags are generated using a sophisticated algorithm:

generateTags()

seo-optimizer-agent.js
async generateTags(script, strategy) {
  const tags = new Set();
  
  // Add primary keywords
  strategy.keywords.forEach(keyword => tags.add(keyword));
  
  // Add topic variations
  const topic = strategy.topic.toLowerCase();
  tags.add(topic);
  tags.add(topic.replace(/\s+/g, ''));
  tags.add(topic.replace(/\s+/g, '_'));
  
  // Add content type tags
  const contentTypeTags = {
    'Tutorial': ['how to', 'tutorial', 'guide', 'step by step', 'learn'],
    'Explainer': ['explained', 'what is', 'understanding', 'explanation'],
    'Review': ['review', 'comparison', 'vs', 'best', 'top'],
    'List': ['top 10', 'best', 'list', 'countdown'],
    'Story': ['story', 'journey', 'experience', 'case study']
  };
  
  const typeTags = contentTypeTags[strategy.contentType] || [];
  typeTags.forEach(tag => tags.add(tag));
  
  // Add long-tail keywords
  const longTailKeywords = this.generateLongTailKeywords(strategy);
  longTailKeywords.forEach(keyword => tags.add(keyword));
  
  // Ensure total doesn't exceed 500 characters
  const tagArray = Array.from(tags);
  const prioritizedTags = this.prioritizeTags(tagArray, strategy);
  
  let totalLength = 0;
  const finalTags = [];
  
  for (const tag of prioritizedTags) {
    if (totalLength + tag.length + 1 <= 500) {
      finalTags.push(tag);
      totalLength += tag.length + 1;
    }
  }
  
  return finalTags;
}

Tag Types

Main topics and themes (highest priority)
strategy.keywords.forEach(keyword => tags.add(keyword));

Chapter Generation

Automatic chapter/timestamp creation:
seo-optimizer-agent.js
async generateChapters(script) {
  const chapters = [];
  let currentTime = 0;
  
  // Introduction
  chapters.push({
    time: '00:00',
    title: 'Introduction',
    seconds: 0
  });
  
  currentTime = 20; // Intro duration
  
  // Main content chapters
  script.mainContent.sections.forEach(section => {
    const minutes = Math.floor(currentTime / 60);
    const seconds = currentTime % 60;
    const timeString = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
    
    chapters.push({
      time: timeString,
      title: section.title || 'Section',
      seconds: currentTime
    });
    
    currentTime += section.duration || 60;
  });
  
  return chapters;
}
YouTube chapters improve user experience and can boost watch time by allowing viewers to jump to relevant sections.

SEO Scoring System

The agent calculates a comprehensive SEO score:
seo-optimizer-agent.js
async calculateSEOScore(title, description, tags) {
  let score = 0;
  
  // Title scoring (30 points max)
  if (title.length >= 60 && title.length <= 70) score += 10;
  else if (title.length >= 50 && title.length <= 100) score += 5;
  
  if (/\d/.test(title)) score += 5; // Contains number
  if (/[A-Z]/.test(title)) score += 5; // Proper capitalization
  if (title.includes(new Date().getFullYear().toString())) score += 5;
  if (['how', 'what', 'why', 'best', 'top'].some(word => 
      title.toLowerCase().includes(word))) score += 5;
  
  // Description scoring (40 points max)
  if (description.length >= 200) score += 10;
  if (description.length >= 500) score += 10;
  if (description.includes('TIMESTAMPS')) score += 5;
  if (description.includes('http')) score += 5;
  if (description.split('\n').length > 10) score += 5;
  if (description.substring(0, 125).includes(tags[0])) score += 5;
  
  // Tags scoring (30 points max)
  if (tags.length >= 10) score += 10;
  if (tags.length >= 15) score += 5;
  if (tags.some(tag => tag.split(' ').length > 2)) score += 5;
  if (tags.join('').length <= 500) score += 5;
  if (new Set(tags).size === tags.length) score += 5;
  
  return Math.min(100, score);
}

Score Breakdown

Title

Up to 30 points

Description

Up to 40 points

Tags

Up to 30 points

Category Selection

Automatic YouTube category assignment:
seo-optimizer-agent.js
selectCategory(strategy) {
  const categories = {
    'technology': 28,  // Science & Technology
    'gaming': 20,      // Gaming
    'education': 27,   // Education
    'business': 27,    // Education (closest match)
    'lifestyle': 22,   // People & Blogs
    'health': 26,      // Howto & Style
    'entertainment': 24 // Entertainment
  };
  
  const niche = this.identifyNiche(strategy);
  return categories[niche] || 22; // Default to People & Blogs
}

Hashtag Generation

Strategic hashtag selection:
seo-optimizer-agent.js
async generateHashtags(strategy) {
  const hashtags = [];
  
  // Primary hashtag
  hashtags.push(`#${strategy.topic.replace(/\s+/g, '')}`);
  
  // Content type hashtag
  hashtags.push(`#${strategy.contentType.toLowerCase()}`);
  
  // Niche-specific hashtags
  const niche = this.identifyNiche(strategy);
  const nicheHashtags = {
    'technology': ['#tech', '#technology', '#innovation'],
    'gaming': ['#gaming', '#gamer', '#games'],
    'education': ['#education', '#learning', '#study']
  };
  
  hashtags.push(...(nicheHashtags[niche] || []).slice(0, 2));
  
  // General engagement hashtags
  hashtags.push('#youtube', '#viral', '#trending');
  
  // Limit to 15 hashtags (YouTube recommendation)
  return hashtags.slice(0, 15);
}
YouTube recommends using no more than 15 hashtags. Using more can result in all hashtags being ignored.

Example SEO Output

{
  "title": "Ultimate AI Technology Trends (2026) - Complete Guide",
  "description": "Ultimate AI Technology Trends (2026) - Complete Guide - In this video, you'll discover ai technology trends: what nobody is telling you.\n\n📺 WHAT YOU'LL LEARN:\n• Deep Dive\n• Real-World Examples\n\n⏱️ TIMESTAMPS:\n00:00 Introduction\n00:20 Deep Dive\n01:50 Real-World Examples\n...",
  "tags": [
    "technology",
    "trends",
    "ai technology",
    "how to ai technology",
    "ai technology for beginners",
    "tutorial",
    "guide",
    "2026"
  ],
  "hashtags": [
    "#aitechnology",
    "#explainer",
    "#tech",
    "#technology",
    "#youtube",
    "#trending"
  ],
  "seoScore": 87,
  "metadata": {
    "primaryKeyword": "technology",
    "secondaryKeywords": ["trends", "artificial", "intelligence"],
    "targetLength": "5-10 minutes",
    "language": "en",
    "category": 28
  }
}

Best Practices

Place your primary keyword in the first 60 characters of your title and first 125 characters of description
Maximize your tag character limit (500 chars) and description length (up to 5000 chars)
Always add timestamps - they enable YouTube chapters and improve user experience
Aim for scores above 80. Lower scores indicate optimization opportunities

Performance Metrics

Optimization Time

1-3 seconds

Average SEO Score

85-95/100

Tag Count

15-25 tags

Next Steps

Publishing Agent

See how optimized metadata is published

Analytics Agent

Track SEO performance and rankings

Script Writer

Learn how scripts influence SEO optimization

API Reference

View complete API documentation