Skip to content

giolaq/ad-genius-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AdGenius - AI Video Advertisement Generation System

A multi-agent AI system that creates personalized video advertisements by analyzing viewer behavior, recommending content, and generating video prompts.

πŸš€ Quick Start

# 1. Run the start script
./START_HERE.sh

# 2. Open your browser to http://localhost:5000

# 3. Enter viewing history and click "Generate Ads"

πŸ“‹ Prerequisites

  • Python 3.10+ with uv package manager
  • AWS Account with Bedrock access (for Claude 3.5 Sonnet)
  • AWS CLI configured (aws configure)
  • Wavespeed API Key (optional, for video generation)

πŸ”§ Installation

# Clone the repository
git clone <your-repo-url>
cd ad-genius-system

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install dependencies
uv sync --extra web

# Configure AWS credentials (if not already done)
aws configure

πŸ—οΈ Project Structure

ad-genius-system/
β”œβ”€β”€ agents/                 # AI Agent definitions
β”‚   β”œβ”€β”€ viewer_analytics_agent.py
β”‚   β”œβ”€β”€ content_recommender_agent.py
β”‚   β”œβ”€β”€ ad_strategist_agent.py
β”‚   β”œβ”€β”€ prompt_generator_agent.py
β”‚   └── video_generator_agent.py
β”‚
β”œβ”€β”€ orchestration/          # Agent coordination
β”‚   β”œβ”€β”€ ad_swarm.py        # Swarm mode (autonomous handoffs)
β”‚   └── production_graph.py # Graph mode (structured pipeline)
β”‚
β”œβ”€β”€ tools/                  # Agent tools & utilities
β”‚   β”œβ”€β”€ catalog_tools.py    # Content catalog access
β”‚   β”œβ”€β”€ persona_builder.py  # Viewer profiling
β”‚   β”œβ”€β”€ prompt_templates.py # Prompt engineering
β”‚   └── nova_reel_tools.py  # Video generation (Wavespeed API)
β”‚
β”œβ”€β”€ config/                 # Configuration
β”‚   └── bedrock_config.py   # AWS Bedrock & model config
β”‚
β”œβ”€β”€ templates/              # Frontend HTML
β”‚   └── index.html          # Main web interface
β”‚
β”œβ”€β”€ generated_videos/       # Output directory for videos
β”œβ”€β”€ examples/               # Example code & usage
β”œβ”€β”€ docs/                   # Additional documentation
β”‚
β”œβ”€β”€ main.py                 # CLI entry point
β”œβ”€β”€ web_app.py              # Web application
β”œβ”€β”€ streaming_hook.py       # Real-time progress updates
└── START_HERE.sh           # Quick start script

🎯 How It Works

1. Viewer Analytics Agent

  • Analyzes viewing history patterns
  • Builds psychological viewer persona
  • Identifies viewing archetypes (Trend Chaser, Quality Connoisseur, etc.)

2. Content Recommender Agent

  • Uses persona to find matching content
  • Calculates affinity scores
  • Returns top 3 recommendations with rationale

3. Ad Strategist Agent

  • Designs creative ad concepts
  • Defines visual approach, messaging, emotional hooks
  • Creates A/B test variants

4. Prompt Generator Agent

  • Converts ad concepts to video generation prompts
  • Adds technical specifications (duration, resolution, style)
  • Optimizes for video generation models

5. Video Generator Agent (Optional)

  • Generates actual video files using Wavespeed AI
  • Downloads videos locally
  • Provides video URLs and metadata

🌐 Usage Modes

Web Interface (Recommended)

./START_HERE.sh
# Opens on http://localhost:5000

Features:

  • Real-time agent progress updates
  • 2x2 agent results grid
  • Streaming console logs
  • Video generation toggle
  • Graph/Swarm mode selector

Command Line Interface

# Swarm mode (autonomous agent collaboration)
uv run python3 main.py --mode swarm --user-id user_001 --viewing-history "Title 1" "Title 2"

# Graph mode (structured pipeline)
uv run python3 main.py --mode graph --user-id user_001 --viewing-history "Title 1" "Title 2"

🎬 Video Generation Setup

To enable video generation:

  1. Get Wavespeed API Key:

  2. Set Environment Variable:

    export WAVESPEED_API_KEY="your-api-key-here"
  3. Enable in Web UI:

    • Toggle "Generate Video" in the web interface
    • Generated videos appear in generated_videos/

βš™οΈ Configuration

AWS Bedrock

Edit config/bedrock_config.py:

AWS_REGION = "us-east-1"  # Your AWS region
MODEL_ID = "anthropic.claude-3-5-sonnet-20241022-v2:0"

Catalog URL

The system fetches content from a remote catalog API. Configure in config/bedrock_config.py:

CATALOG_URL = "https://your-catalog-api.com/items"

πŸ” Orchestration Modes

Swarm Mode

  • Autonomous: Agents decide next steps
  • Dynamic: Non-deterministic flow
  • Streaming: Real-time UI updates
  • Use Case: Interactive development, debugging

Graph Mode

  • Structured: Fixed execution pipeline
  • Deterministic: Same input = same flow
  • Reliable: Better for production
  • Use Case: Batch processing, consistent results

πŸ“Š API Endpoints

POST   /api/generate           # Start ad generation job
GET    /api/job/{job_id}       # Get job status
GET    /api/job/{job_id}/stream # Server-sent events stream
GET    /generated_videos/{file} # Download generated video

πŸ§ͺ Testing

# Run with mock backend (no AWS required)
cp archive/old_tests/demo_mock.py .
uv run python3 demo_mock.py

πŸ“ Environment Variables

# AWS Credentials (or use aws configure)
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_REGION="us-east-1"

# Optional: Video generation
export WAVESPEED_API_KEY="your-wavespeed-key"

πŸ› Troubleshooting

"AWS credentials not found"

# Configure AWS CLI
aws configure

# Or set environment variables
export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."

"Port 5000 already in use"

# Kill existing process
killall -9 python3

# Or change port in web_app.py
app.run(port=5001)

Video generation fails

# Check API key is set
echo $WAVESPEED_API_KEY

# Check debug log
tail -f video_gen_debug.log

πŸ“š Additional Documentation

  • docs/CLAUDE.md - Claude Code integration guide

🀝 Contributing

This is an internal project. For questions or contributions, contact the team.

πŸ“„ License

Proprietary - All Rights Reserved

πŸ”— Dependencies

  • Strands - Multi-agent orchestration framework
  • Flask - Web framework
  • AWS Bedrock - Claude 3.5 Sonnet access
  • Wavespeed AI - Video generation (optional)

πŸ“ž Support

For issues or questions:

  1. Check the troubleshooting section
  2. Review logs in video_gen_debug.log
  3. Contact the development team

Version: 1.0.0 Last Updated: 2025-11-29 Status: Production Ready

About

Multi-agent AI system for generating personalized video advertisements using AWS Bedrock and Strands framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors