Back to .md Directory

Complete Marketing Team Automation Pipeline Guide

This project is an **AI-powered Instagram marketing automation pipeline** built with CrewAI framework that simulates a complete marketing team with 4 specialized AI agents:

May 2, 2026
0 downloads
0 views
ai agent prompt openai automation
View source

Complete Marketing Team Automation Pipeline Guide

📋 Overview

This project is an AI-powered Instagram marketing automation pipeline built with CrewAI framework that simulates a complete marketing team with 4 specialized AI agents:

  1. Market Researcher - Analyzes trends, competitors, and hashtags
  2. Content Strategist - Creates content calendars and strategies
  3. Visual Creator - Generates detailed image descriptions
  4. Copywriter - Crafts engaging captions and copy

🏗️ Project Structure

Automating-a-Marketing-Team-with-agents/
├── src/
│   └── instagram/
│       ├── __init__.py
│       ├── crew.py           # Main crew orchestration
│       ├── main.py           # Entry point
│       ├── config/
│       │   ├── agents.yaml   # AI agents configuration
│       │   └── tasks.yaml    # Tasks configuration
│       └── tools/
│           ├── __init__.py
│           └── search.py     # Search tools for research
├── .env                      # Environment variables
├── pyproject.toml           # Poetry dependencies
├── poetry.lock              # Locked dependencies
└── README.md

🚀 Step-by-Step Manual Setup and Execution

Step 1: Prerequisites

Required Software:

  • Python 3.10-3.13
  • Poetry (for dependency management)
  • OpenAI API key

Step 2: Environment Setup

2.1 Install Poetry

pip install poetry

2.2 Navigate to Project Directory

cd C:\Users\abhis\Automating-a-Marketing-Team-with-agents

2.3 Lock and Install Dependencies

python -m poetry lock
python -m poetry install

Step 3: Configuration

3.1 Environment Variables Setup

Create/Edit .env file in project root:

OPENAI_API_KEY=your_actual_openai_api_key_here
# Optional: Add Serper API key for enhanced search
SERPER_API_KEY=your_serper_api_key_here

3.2 Agents Configuration (src/instagram/config/agents.yaml)

  • Market Researcher: Analyzes Instagram trends and competitors
  • Content Strategist: Develops content calendars
  • Visual Creator: Creates image descriptions
  • Copywriter: Writes engaging captions with SEO optimization

3.3 Tasks Configuration (src/instagram/config/tasks.yaml)

  • market_research: Research trends and hashtags
  • content_strategy: Create weekly content calendar
  • visual_content_creation: Generate image descriptions
  • copywriting: Write post captions and copy

Step 4: Pipeline Execution

4.1 Manual Execution Command

python -m poetry run instagram

4.2 Interactive Inputs Required

When you run the pipeline, you'll be prompted for:

  1. Instagram Account Description:

    • Example: "A fitness coaching page focused on home workouts and healthy lifestyle tips"
  2. Topic of the Week:

    • Example: "New Year fitness resolutions and motivation"

Step 5: Pipeline Flow

Phase 1: Market Research

  • Agent: Market Researcher
  • Action: Analyzes current trends, hashtags, competitor activities
  • Output: Research report with trending hashtags and insights

Phase 2: Content Strategy

  • Agent: Content Strategist
  • Action: Creates 3-5 day content calendar based on research
  • Output: Structured markdown calendar with themes and keywords

Phase 3: Visual Content Creation

  • Agent: Visual Creator
  • Action: Generates detailed image descriptions for each post
  • Output: Detailed visual prompts for AI image generation

Phase 4: Copywriting

  • Agent: Copywriter
  • Action: Writes engaging captions with hashtags and CTAs
  • Output: Ready-to-post Instagram captions

Step 6: Expected Outputs

The pipeline generates several files:

  • Market Research Report (market_research.md)
  • Content Calendar (integrated in final output)
  • Visual Content Descriptions (visual-content.md)
  • Instagram Copy (captions with hashtags)

🔧 Manual Customization Options

Modify Agents (agents.yaml)

market_researcher:
  role: "Your custom role"
  goal: "Your specific goal"
  backstory: "Agent personality and expertise"

Adjust Tasks (tasks.yaml)

market_research:
  description: "Custom task description with {variables}"
  expected_output: "Specific output format requirements"

Add Custom Tools (tools/search.py)

  • Extend search capabilities
  • Add new data sources
  • Integrate APIs

🎯 Manual Execution Examples

Example 1: Fitness Coach Account

python -m poetry run instagram
# Inputs:
# Page description: "Personal trainer specializing in strength training for beginners"
# Topic: "January fitness motivation and goal setting"

Example 2: Food Blog

python -m poetry run instagram
# Inputs:
# Page description: "Healthy recipe blog with quick meal ideas for busy professionals"
# Topic: "Meal prep Sunday inspiration"

📊 Pipeline Performance Metrics

  • Processing Time: 5-10 minutes depending on complexity
  • API Calls: ~10-15 OpenAI API calls per run
  • Output Quality: Professional-grade marketing content
  • Customization Level: Highly configurable through YAML files

🛠️ Troubleshooting

Common Issues:

  1. Poetry not recognized:

    python -m poetry [command]
    
  2. API Key errors:

    • Verify .env file location and format
    • Check API key validity
  3. Dependency conflicts:

    python -m poetry lock --no-update
    python -m poetry install
    

🔄 Alternative Execution Methods

Method 1: Direct Python Execution

python src/instagram/main.py

Method 2: Poetry Shell

poetry shell
python -m instagram

Method 3: Custom Script

Create run_pipeline.py:

from src.instagram.crew import InstagramCrew
import datetime

inputs = {
    'current_date': datetime.datetime.now().strftime("%Y-%m-%d"),
    'instagram_description': 'Your page description',
    'topic_of_the_week': 'Your weekly topic',
}
InstagramCrew().crew().kickoff(inputs=inputs)

🏃‍♂️ Quick Start Commands

For Windows PowerShell:

# 1. Install Poetry
pip install poetry

# 2. Navigate to project
cd C:\Users\abhis\Automating-a-Marketing-Team-with-agents

# 3. Install dependencies
python -m poetry lock
python -m poetry install

# 4. Run pipeline
python -m poetry run instagram

📁 File Locations and Purposes

Configuration Files:

  • .env - Environment variables (API keys)
  • pyproject.toml - Project dependencies and metadata
  • src/instagram/config/agents.yaml - AI agent definitions
  • src/instagram/config/tasks.yaml - Task descriptions and workflows

Core Code Files:

  • src/instagram/main.py - Entry point and user interaction
  • src/instagram/crew.py - CrewAI orchestration logic
  • src/instagram/tools/search.py - Search and research tools

Output Files (Generated):

  • market_research.md - Research findings and trends
  • visual-content.md - Image descriptions for posts
  • Various markdown files with content strategies and copy

🔐 Security Notes

  • Never commit your .env file with real API keys
  • Use environment variables for sensitive data
  • Consider using .env.example for template sharing

🚀 Advanced Usage

Batch Processing:

Create multiple input configurations and run them sequentially:

# batch_run.py
from src.instagram.crew import InstagramCrew
import datetime

campaigns = [
    {
        'current_date': datetime.datetime.now().strftime("%Y-%m-%d"),
        'instagram_description': 'Fitness coaching page',
        'topic_of_the_week': 'New Year resolutions',
    },
    {
        'current_date': datetime.datetime.now().strftime("%Y-%m-%d"),
        'instagram_description': 'Travel photography blog',
        'topic_of_the_week': 'Winter destinations',
    }
]

for campaign in campaigns:
    print(f"Running campaign: {campaign['topic_of_the_week']}")
    InstagramCrew().crew().kickoff(inputs=campaign)

📈 Monitoring and Analytics

Track Pipeline Performance:

  • Monitor API usage and costs
  • Log execution times and success rates
  • Analyze output quality and engagement metrics

Integration Possibilities:

  • Connect to Instagram Business API
  • Integrate with scheduling tools (Buffer, Hootsuite)
  • Add analytics dashboards
  • Implement A/B testing for content variations

This comprehensive pipeline automates the entire content creation process from research to final copy, simulating a full marketing team's workflow in minutes rather than hours!

🎯 Next Steps After Pipeline Execution

  1. Review Generated Content: Check all output files for quality and relevance
  2. Customize as Needed: Edit any generated content to match your specific brand voice
  3. Schedule Posts: Use the content calendar to plan your posting schedule
  4. Generate Images: Use the visual descriptions with AI image generators (DALL-E, Midjourney, etc.)
  5. Track Performance: Monitor engagement metrics and adjust future inputs based on results

Related Documents