Skip to content

End-to-end AI agent that turns a topic into a viral short video by researching trends, writing scripts, enabling human review, generating voiceovers, and producing polished vertical videos automatically.

License

Notifications You must be signed in to change notification settings

sailorworks/video-content-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 Viral AI Influencer Video Content Agent

An AI system that turns your idea into a ready-to-post viral short video. You give a topic, and the system automatically finds trending content across platforms, writes an engaging script (with a chance for you to review and edit it), generates a natural human-like voiceover, and produces a polished short-form videoβ€”all with minimal effort from you.

πŸ“Ί Demo

End-to-end run: topic β†’ research β†’ script approval β†’ voiceover β†’ final short video

Screen-studio-1KIjmh9oXS.mp4

✨ Features

  • πŸ” Multi-Platform Research: Automatically discovers trending content from YouTube Shorts, Twitter/X, and fresh news via Exa
  • πŸ“ AI-Powered Scriptwriting: Generates viral-optimized scripts using GPT-4o with strict style guidelines
  • πŸ‘€ Human Review Loop: Interactive approval system for script refinement with feedback integration
  • πŸŽ™οΈ Professional Voiceover: High-quality text-to-speech using ElevenLabs with multilingual support
  • πŸŽ₯ Automated Video Production: Creates polished vertical videos (9:16) using HeyGen avatars
  • πŸ”„ End-to-End Automation: Seamless pipeline from topic input to final video delivery

πŸ—οΈ Architecture

The system operates through four sequential stages:

graph LR
    A[Topic Input] --> B[Research Stage]
    B --> C[Scripting Stage]
    C --> D{Human Review}
    D -->|Approved| E[Audio Generation]
    D -->|Feedback| C
    E --> F[Video Generation]
    F --> G[Final Video]
Loading

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Composio Account (Sign up here)
  • API Keys for:
    • OpenAI (GPT-4o)
    • ElevenLabs
    • HeyGen
    • Exa

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/video-content-agent.git
    cd video-content-agent
  2. Install dependencies

    npm install
  3. Authenticate services via Composio

    You'll need to connect each service through Composio's authentication flow:

    • Log in to Composio Dashboard
    • Create a new project.
    • Go to settings for COMPOSIO_API_KEY
    • Navigate to "Auth configs".
    • Connect: YouTube, Twitter, Exa, ElevenLabs, and HeyGen(self explanatory).
    • Take auth config ids from the dashboard and paste it in the .env file.
  4. Set up environment variables

    Create a .env file in the root directory:

    # OpenAI
    OPENAI_API_KEY=your_openai_api_key
    
    # Composio
    COMPOSIO_API_KEY=your_composio_api_key
    COMPOSIO_USER_ID=your_user_id
    
    # Auth Config IDs (from Composio dashboard)
    YOUTUBE_AUTH_CONFIG_ID=your_youtube_config_id
    TWITTER_AUTH_CONFIG_ID=your_twitter_config_id
    EXA_AUTH_CONFIG_ID=your_exa_config_id
    ELEVENLABS_AUTH_CONFIG_ID=your_elevenlabs_config_id
    HEYGEN_AUTH_CONFIG_ID=your_heygen_config_id
  5. Build the project

    npm run build

Usage

Run the agent:

npm start

You'll be prompted to enter a topic:

? What topic would you like to generate video content for? β€Ί voice agents in 2025

The agent will then:

  1. Research the topic across platforms (~30-60 seconds)
  2. Generate a script and request your approval
  3. Generate audio from the approved script (~10-20 seconds)
  4. Create the final video (~2-5 minutes depending on HeyGen queue)

πŸ“ Project Structure

video-content-agent/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ research.ts          # Multi-platform content discovery
β”‚   β”‚   β”œβ”€β”€ scripting.ts         # AI script generation
β”‚   β”‚   β”œβ”€β”€ human_review.ts      # Interactive approval system
β”‚   β”‚   β”œβ”€β”€ audio.ts             # ElevenLabs voice synthesis
β”‚   β”‚   └── video_generation.ts  # HeyGen video production
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── client.ts            # Composio toolkit sessions
β”‚   └── state/
β”‚       └── state.ts             # TypeScript type definitions
β”œβ”€β”€ index.ts                      # Main pipeline orchestrator
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── .env                          # Environment variables (not committed)

πŸ”§ Configuration

Customizing Voice Settings

Edit src/agents/audio.ts:

// Change voice ID (find IDs in ElevenLabs dashboard)
const VOICE_ID = "EIsgvJT3rwoPvRFG6c4n"; // Default: Clara

// Change model
const MODEL_ID = "eleven_multilingual_v2";

Customizing Avatar

Edit src/agents/video_generation.ts:

// Change avatar ID (find IDs in HeyGen dashboard)
const AVATAR_ID = "109cdee34a164003b0e847ffce93828e"; // Default: Jasmine

// Change video dimensions
const dimension = { width: 720, height: 1280 }; // 9:16 vertical

Script Style Guidelines

Modify src/agents/scripting.ts to adjust:

  • Script length (default: 75-85 words)
  • Tone and reading level
  • Banned words/phrases
  • Structural requirements

πŸ› Troubleshooting

Authentication Errors

If you see authentication links in the output:

🚨 AUTHENTICATION REQUIRED: Please click here to authenticate...
  1. Click the provided link
  2. Complete the OAuth flow
  3. Restart the agent with npm start

Script Quality Issues

  • Provide detailed feedback during human review
  • Adjust style guidelines in scripting.ts
  • Ensure research data is comprehensive (check API quotas)

πŸ“ Development

Running in Development Mode

Use tsx for faster iteration without building:

npx tsx index.ts

Adding New Research Sources

  1. Create a new toolkit session in research.ts
  2. Define an agent with specific instructions
  3. Parse and integrate results into ResearchData

Extending the Pipeline

Add new stages by:

  1. Creating a new agent file in src/agents/
  2. Importing and calling it in index.ts
  3. Updating AgentState type in src/state/state.ts

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Composio for seamless API integrations and SDK.
  • OpenAI for GPT-4o and the Agents SDK
  • ElevenLabs for high-quality voice synthesis
  • HeyGen for AI avatar technology

License: MIT

Built with ❀️ using Composio

About

End-to-end AI agent that turns a topic into a viral short video by researching trends, writing scripts, enabling human review, generating voiceovers, and producing polished vertical videos automatically.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published