Documentation Index Fetch the complete documentation index at: https://mintlify.com/darkzOGx/youtube-automation-agent/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The ProductionManagementAgent orchestrates the complete video production pipeline, from script processing to final video assembly. It manages assets, generates AI video content, creates audio narration, generates captions, and assembles the final video.
Constructor
Database instance for production data
Credentials manager with API access
const { ProductionManagementAgent } = require ( './agents/production-management-agent' );
const agent = new ProductionManagementAgent ( db , credentials );
Properties
Production pipeline with all content in various stages
Asset management map for tracking production files
AI video generation service
Logger instance for tracking production
Methods
initialize()
Initializes the agent, creates directories, and loads pipeline.
Returns true when initialization is complete
await agent . initialize ();
// Creates: data/production, data/assets, data/videos,
// data/audio, data/scripts, temp/processing
processContent(contentData)
Processes complete content through production pipeline.
Content package with strategy, script, thumbnail, and SEO data
Content strategy from ContentStrategyAgent
Video script from ScriptWriterAgent
Thumbnail from ThumbnailDesignerAgent
SEO data from SEOOptimizerAgent
Production data with all generated assets
Production status: processing or ready
All generated assets (script, thumbnail, audio, video, captions, finalVideo)
Timestamps for each production milestone
production.scheduledPublishTime
Calculated publish time
Production priority (0-100)
const contentData = {
strategy: { /* from ContentStrategyAgent */ },
script: { /* from ScriptWriterAgent */ },
thumbnail: { /* from ThumbnailDesignerAgent */ },
seo: { /* from SEOOptimizerAgent */ }
};
const production = await agent . processContent ( contentData );
console . log ( production );
// {
// id: 'prod_1234567890_abc123_xyz789',
// status: 'ready',
// assets: {
// script: { originalPath: '...', ttsPath: '...', duration: '8:30', sections: 5 },
// thumbnail: { path: '...', dimensions: { width: 1280, height: 720 }, fileSize: 156789 },
// audio: { path: '...', duration: '8:30', format: 'mp3', generatedWith: 'AI' },
// video: { visualAssets: [...], duration: '8:30', format: 'mp4', generatedWith: 'AI' },
// captions: { path: '...', format: 'srt', language: 'en' },
// finalVideo: { path: '...', fileSize: 45678901, duration: '8:30', resolution: '1920x1080' }
// },
// timeline: {
// created: '2026-03-05T10:00:00.000Z',
// scriptReady: '2026-03-05T10:00:01.000Z',
// thumbnailReady: '2026-03-05T10:00:02.000Z',
// audioGenerated: '2026-03-05T10:01:30.000Z',
// videoGenerated: '2026-03-05T10:03:00.000Z',
// captionsGenerated: '2026-03-05T10:03:15.000Z',
// readyForUpload: '2026-03-05T10:05:00.000Z'
// },
// scheduledPublishTime: '2026-03-10T14:00:00.000Z',
// priority: 75,
// estimatedDuration: '8:30'
// }
generateVideoContent(productionData)
Generates AI video content using visual prompts from script.
Array of generated visual assets
const visualAssets = await agent . generateVideoContent ( productionData );
// Generates 3-5 AI images based on script content
// Uses DALL-E or similar service via AIVideoGenerator
generateAudioNarration(productionData)
Generates AI audio narration from script.
Production data with script assets
Path to generated audio file
const audioPath = await agent . generateAudioNarration ( productionData );
// Generates MP3 audio using AI TTS service
// Reads from productionData.assets.script.ttsPath
generateCaptions(productionData)
Generates SRT captions with timestamps.
Production data with script
const captionsPath = await agent . generateCaptions ( productionData );
// Creates properly formatted SRT file with:
// - 8 words per caption for readability
// - Timestamps synced to script sections
// - Formatted for YouTube upload
assembleVideo(productionData)
Assembles final video from all assets.
Production data with all assets
const finalVideo = await agent . assembleVideo ( productionData );
// Combines:
// - AI-generated visual assets
// - Audio narration
// - Text overlays and transitions
// Outputs: 1920x1080 MP4 at 30fps
processScript(script)
Processes and formats script for production.
Script from ScriptWriterAgent
Processed script assets with paths
const scriptAsset = await agent . processScript ( script );
// {
// originalPath: 'data/scripts/1234567890_script.json',
// ttsPath: 'data/scripts/1234567890_script_tts.txt',
// duration: '8:30',
// sections: 5
// }
Formats script into TTS-friendly text.
Plain text formatted for text-to-speech
const ttsText = agent . formatScriptForTTS ( script );
// Extracts spoken content:
// - Hook text
// - Introduction narration
// - Main content (filtering visual cues)
// - Conclusion
// - Call to action
// Removes: section markers, timestamps, visual notes
processThumbnail(thumbnail)
Processes thumbnail for production and generates AI variant.
Thumbnail from ThumbnailDesignerAgent
Processed thumbnail asset
const thumbAsset = await agent . processThumbnail ( thumbnail );
// Attempts AI thumbnail generation first, falls back to original
createSRTCaptions(productionData)
Creates properly formatted SRT caption file.
Production data with script
SRT formatted caption string
const srt = await agent . createSRTCaptions ( productionData );
// 1
// 00:00:00,000 --> 00:00:03,500
// Have you ever wondered how JavaScript Promises
//
// 2
// 00:00:03,500 --> 00:00:07,000
// actually works? Let me show you exactly
calculatePublishTime(strategy)
Calculates optimal publish time from strategy.
ISO timestamp for publishing
const publishTime = agent . calculatePublishTime ( strategy );
// Uses strategy.bestPublishTime or defaults to tomorrow 2 PM
calculatePriority(strategy)
Calculates production priority.
const priority = agent . calculatePriority ( strategy );
// Factors:
// - Estimated views (up to +30)
// - Competitor analysis (+10 if available)
// - Time until publish (+20 if <24h, +10 if <48h)
// - Base priority: 50
getPipelineStatus()
Gets status of all items in production pipeline.
Array of pipeline item summaries
const status = await agent . getPipelineStatus ();
// [
// {
// id: 'prod_123...',
// title: 'JavaScript Tutorial',
// status: 'ready',
// priority: 75,
// scheduledPublishTime: '2026-03-10T14:00:00.000Z',
// progress: 100
// },
// {
// id: 'prod_456...',
// title: 'Python Guide',
// status: 'processing',
// priority: 60,
// scheduledPublishTime: '2026-03-12T14:00:00.000Z',
// progress: 60
// }
// ]
calculateProgress(productionData)
Calculates production completion percentage.
Production data with timeline
Progress percentage (0-100)
const progress = agent . calculateProgress ( productionData );
// Based on milestones:
// - scriptReady
// - thumbnailReady
// - audioGenerated
// - videoGenerated
// - captionsGenerated
// - readyForUpload
getNextReadyContent()
Gets highest priority content ready for publishing.
Next production item or null
const next = await agent . getNextReadyContent ();
if ( next ) {
console . log ( 'Ready to publish:' , next . script . title );
console . log ( 'Priority:' , next . priority );
}
Production Pipeline Stages
Stage 1: Script Processing
Stage 2: Thumbnail Processing
Stage 3: Audio Generation
Stage 4: Video Generation
Stage 5: Caption Generation
Stage 6: Final Assembly
{
milestone : 'scriptReady' ,
tasks : [
'Save original script JSON' ,
'Format script for TTS' ,
'Save TTS-formatted text'
]
}
Usage Example
const { ProductionManagementAgent } = require ( './agents/production-management-agent' );
const agent = new ProductionManagementAgent ( db , credentials );
await agent . initialize ();
// Process complete content package
const contentData = {
strategy: await strategyAgent . generateContentStrategy (),
script: await scriptAgent . generateScript ( strategy ),
thumbnail: await thumbnailAgent . generateThumbnail ( script ),
seo: await seoAgent . optimize ( script , strategy )
};
const production = await agent . processContent ( contentData );
console . log ( 'Production ID:' , production . id );
console . log ( 'Status:' , production . status );
console . log ( 'Priority:' , production . priority );
console . log ( 'Scheduled:' , production . scheduledPublishTime );
// Check pipeline status
const pipeline = await agent . getPipelineStatus ();
console . log ( 'Items in pipeline:' , pipeline . length );
// Get next content ready for publishing
const next = await agent . getNextReadyContent ();
if ( next ) {
console . log ( 'Ready to publish:' , next . script . title );
}
Asset Management
The agent manages assets in organized directories:
Production metadata and state files
Processed thumbnails and visual assets
Final rendered video files
Generated audio narration files
Original scripts and TTS-formatted versions
Temporary files during processing
Best Practices
Monitor Pipeline Regularly
Check pipeline status to identify bottlenecks and ensure smooth production flow.
Prioritize Time-Sensitive Content
Content with higher estimated views and closer publish times gets higher priority automatically.
Verify AI Generated Assets
While AI generation is automatic, review visual assets and audio narration for quality.
Archive or clean up old production files periodically to manage disk space.
Handle Failures Gracefully
The agent includes fallback methods for AI service failures. Monitor logs for simulation vs. actual generation.