Skip to main content

Overview

The SEOOptimizerAgent optimizes video metadata for maximum YouTube discoverability. It generates optimized titles, descriptions, tags, hashtags, chapters, and calculates comprehensive SEO scores.

Constructor

Database
required
Database instance for keyword history and SEO data
Credentials
required
Credentials manager for external services

Properties

Map
Historical keyword performance data
Logger
Logger instance for tracking optimization

Methods

initialize()

Initializes the agent and loads keyword history.
Promise<boolean>
Returns true when initialization is complete

optimize(script, strategy)

Generates complete SEO optimization for a video.
Object
required
Video script object
Object
required
Content strategy object
Promise<Object>
Complete SEO data object
string
Optimized title (60-100 characters)
string
Comprehensive description (up to 5000 characters, first 125 optimized)
Array<string>
Prioritized tags (max 500 characters total)
Array<string>
15 relevant hashtags
Array<Object>
Video chapters with timestamps
Object
End screen strategy
number
Overall SEO score (0-100)
Object
Additional metadata (keywords, category, language)

optimizeTitle(originalTitle, strategy)

Optimizes video title for searchability and CTR.
string
required
Original title from script
Object
required
Content strategy
Promise<string>
Optimized title (max 100 characters)

generateDescription(script, strategy)

Generates comprehensive, SEO-optimized video description.
Object
required
Video script object
Object
required
Content strategy
Promise<string>
Full description (up to 5000 characters)

generateTags(script, strategy)

Generates and prioritizes video tags.
Object
required
Video script
Object
required
Content strategy
Promise<Array<string>>
Prioritized tags (max 500 characters total)

generateHashtags(strategy)

Generates relevant hashtags for video.
Object
required
Content strategy
Promise<Array<string>>
15 relevant hashtags

generateChapters(script)

Generates video chapters with timestamps.
Object
required
Video script with sections
Promise<Array<Object>>
Chapter objects with time, title, and seconds

generateEndScreenStrategy()

Generates end screen element configuration.
Promise<Object>
End screen strategy with elements and timing

calculateSEOScore(title, description, tags)

Calculates comprehensive SEO score.
string
required
Video title
string
required
Video description
Array<string>
required
Video tags
Promise<number>
SEO score (0-100)

identifyNiche(strategy)

Identifies content niche from strategy.
Object
required
Content strategy
string
Niche category: technology, gaming, education, business, lifestyle, health, entertainment, or general

selectCategory(strategy)

Selects YouTube category ID.
Object
required
Content strategy
number
YouTube category ID

calculateOptimalLength(contentType)

Calculates optimal video length for content type.
string
required
Content type (Tutorial, Explainer, Review, List, Story)
string
Recommended duration range

Usage Example

Tag Categories

The agent generates tags from multiple sources:
Direct keywords from content strategy (highest priority)
Topic with spaces, without spaces, with underscores
Tutorial: how to, tutorial, guide, step by step, learn Explainer: explained, what is, understanding Review: review, comparison, vs, best, top List: top 10, best, list, countdown
Multi-word phrases (e.g., “how to javascript”, “javascript for beginners”)
Technology: tech, innovation, future tech Gaming: gaming, gameplay, walkthrough Education: educational, learning, study tips
Current year and “topic year” combinations

Best Practices

The first 125 characters of the description appear in search results. Include primary keywords and a compelling hook.
The agent prioritizes tags to use the full 500-character limit. Mix broad and long-tail keywords.
Chapters improve user experience and SEO. The agent automatically generates them from script sections.
Scores above 80 indicate well-optimized content. Below 60 needs improvement in title, description, or tags.
Store performance data for keywords to improve future optimization recommendations.

Environment Variables

string
Your website URL for description links
Social media links for description
string
Business inquiry email for description
string
Channel name for branding tags