๐Ÿ“Š Social Media Marketer

Multi-agent simulation that reveals which marketing channel delivers the best ROI โ€” and which one to cut

Claude AI Python Streamlit Plotly Multi-Agent Anthropic SDK

๐Ÿ“‹ Project Overview & Problem Statement

Challenge: Social media managers and digital marketers routinely allocate budget across multiple channels โ€” Email, Social, Paid Search, Display, and Affiliate โ€” based on intuition, industry benchmarks, or whatever worked last quarter. This approach makes it hard to know with confidence which channel is generating real ROI and which is silently draining budget.

Solution: Social Media Marketer runs a competitive multi-agent simulation where five AI agents โ€” each managing one marketing channel โ€” compete with the same starting budget over four rounds. Using a real campaign dataset, each agent picks campaigns, allocates spend, and gets scored against an ROI benchmark. The result is a ranked leaderboard plus clear recommendations: which channel to scale, which to hold, and which to cut.

Key Benefits

๐Ÿ–ฅ๏ธ Application Features

๐Ÿ“ˆ Channel Baseline Table

Before the simulation starts, a baseline table shows each channel's historical average uplift from the dataset โ€” colour-coded green or red against the benchmark. Gives context before any agent runs.

๐Ÿค– 5 Competing Agents

Emma (Email), Sam (Social), Parker (Paid Search), Diana (Display), and Alex (Affiliate) each receive campaign options from their channel, decide which to run, and allocate budget. Each has a distinct strategic persona.

โšก Live Round-by-Round Updates

A progress bar advances as each agent completes their round. Agent decision cards appear one by one showing campaign picked, uplift achieved, budget change, and one-sentence reasoning from the AI.

๐Ÿ† Final Leaderboard

After all rounds, agents are ranked by final budget. The table shows total ROI, average uplift, how many rounds hit the benchmark, and a status flag โ€” OK or FLAGGED โ€” for agents that missed benchmark twice consecutively.

๐Ÿ“Š ROI Bar Chart

A horizontal bar chart visualises each channel's total ROI โ€” green for profit, red for loss โ€” making the performance spread immediately visible without reading the table.

๐Ÿ’ก CMO Recommendations

Three recommendation cards โ€” Scale Up, Hold, Cut / Review โ€” assign every channel to an action category based on ROI and flagging status. One-click download exports the full report as Markdown.

๐Ÿค– AI Integration & Intelligence

๐Ÿง  One Model, Five Personas

All five agents use the same Claude Haiku model. Each gets a unique system prompt defining their channel focus, decision style, and strategic strength. This isolates the effect of persona on campaign selection โ€” not model capability.

๐Ÿ“‹ Structured JSON Decisions

Each agent responds in strict JSON: campaign choice (1โ€“3), budget allocation percentage (15โ€“25%), and one-sentence reasoning. Structured output ensures reliable parsing and consistent simulation mechanics.

โš–๏ธ Economic Scoring

Decisions are scored against the expected uplift from the campaign dataset. Above benchmark: the agent earns back more than it spent. Below benchmark: partial loss. Two consecutive losses trigger a FLAGGED status โ€” mirroring real-world performance review logic.

๐Ÿ›ก๏ธ Fault-Tolerant Fallback

If the API returns malformed JSON, the agent falls back to a safe default choice without crashing the simulation. Ensures a complete run even under network or rate-limit conditions.

๐Ÿ› ๏ธ Technical Architecture & Implementation

Frontend Stack

Streamlit Plotly Pandas Rich (CLI fallback)

Backend Stack

Python 3 Anthropic SDK Claude Haiku python-dotenv

Data

campaigns.csv 50 real campaigns 5 channels 4 objectives 5 segments

System Architecture

๐Ÿ“– Development Setup & Installation Guide

Prerequisites

Quick Start

# Clone the repository git clone https://github.com/lyven81/ai-project.git cd ai-project/projects/social-media-marketer # Install dependencies pip install -r requirements.txt # Add your API key # Open .env and replace "your-api-key-here" with your Anthropic API key # Launch the web UI streamlit run app.py # Or double-click run.bat (Windows)

Environment Configuration

ANTHROPIC_API_KEY=your-api-key-here

Adjustable Settings (config.py)

๐Ÿš€ Running the Simulation

# Web UI (recommended) streamlit run app.py # CLI fallback python main.py

Output Files

๐Ÿ“Š Key Metrics

5
Competing AI Agents
50
Real Campaigns in Dataset
1
LLM Model Used
4
Simulation Rounds

The 5 Agents

๐Ÿ“ง EmmaEmail ยท Retention-focused
๐Ÿ“ฑ SamSocial ยท Acquisition-focused
๐Ÿ” ParkerPaid Search ยท ROI-obsessed
๐Ÿ–ผ๏ธ DianaDisplay ยท Retargeting expert
๐Ÿค AlexAffiliate ยท Performance-driven

Business Value