📋 Project Overview & Problem Statement
Challenge: A Malaysian fruit retailer running 21 SKUs and RM1.88 million in monthly revenue has no way to tell which products are leaking margin, where the portfolio concentration risk sits, or which strategic move to make first. Traditional SME consulting engagements take 4–6 weeks and cost RM30,000–RM100,000. Most operators never commission the analysis because cost and wait don't match their decision window.
Solution: The Data Consulting Business Analysis Agent runs the full market analysis as a 4-agent AI pipeline — research, competitive intelligence, opportunity scoring, and executive report generation. This showcase demonstrates the pipeline applied to the fruit retail case: 3,000 September 2024 transactions feed the pipeline, which outputs a 12-section executive report with pricing-discipline flags, SKU portfolio quadrants, and a 90-day action plan — in under 15 minutes.
🎯 What the Pipeline Delivered for the Fruit Retail Case
- Market snapshot: RM1.88M monthly revenue, 3,000 transactions, 21 SKUs, RM628.60 avg ticket
- Revenue leaders: Top 5 SKUs identified (Guavas, Durians, Peaches, Dragon Fruits, Mangosteens = 26% of revenue)
- Pricing-discipline finding: Every top SKU sold at both RM2 and RM10/kg — the single biggest margin-recovery lever
- Opportunity quadrant map: 3 SKUs in "Grow", 8 in "Fix", 10 in "Monitor / Exit"
- 90-day action plan: Phased deliverables targeting +12–18% revenue and +10–15% margin
Key Benefits
- 100× Faster: 10–15 minutes vs. 4–6 weeks of manual SME consulting
- Grounded in data: Every finding tied to real transaction records, not templated advice
- Covers four questions in one run: Market shape, competitor/SKU landscape, opportunity map, strategy
- Repeatable: Re-run monthly to track SKU shifts and pricing-discipline drift
- Actionable: Outputs a 90-day action plan, not a 200-page deck
📊 Strategic Visualizations
1. SKU Revenue & Volume Chart
Horizontal bar chart ranking all 21 SKUs by revenue. In the fruit retail case:
- 🟢 Top tier: Guavas (RM104K), Durians (RM99K), Peaches (RM98K) — scale candidates
- 🟡 Mid tier: 15 SKUs between RM85K–RM95K — flat long-tail body
- 🔴 Bottom tier: Starfruits (RM78K), Longans (RM79K), Honeydew (RM81K) — review candidates
2. Pricing Discipline Heatmap
Visualises price variance per SKU to surface revenue leakage. In the fruit retail case:
- Wide price gap (critical): Bananas, Lychees, Guavas, Ciku, Peaches all trade from RM2 to RM10 per kg on identical product
- Tight price band (healthy): Pineapples, Mangoes, Jackfruits hold consistent pricing
- Implication: The RM8 price gap on top SKUs is the single biggest margin-recovery lever
3. Opportunity Map (2×2 Matrix)
Scatter plot placing every SKU on revenue × pricing-stability axes. In the fruit retail case:
- GROW (Top-Left): High revenue + stable pricing — Papayas, Cempedak, Plums (safe to scale)
- FIX (Top-Right): High revenue + wide price variance — Guavas, Durians, Peaches, Dragon Fruits, Mangosteens, Ciku, Passion Fruits, Watermelons (pricing SOP urgent)
- MONITOR (Bottom-Right): Low revenue + wide variance — Rambutans, Oranges, Longans (watch 60 days)
- EXIT (Bottom-Left): Low revenue + stable pricing — Starfruits, Honeydew, Pineapples, Mangoes, Bananas, Jackfruits, Lychees (trim or seasonalise)
🛠️ Technical Architecture & Implementation
AI & Analytics Stack
Google Gemini 2.0 Flash
Tavily Search API
Python 3.9+
Pandas & NumPy
Matplotlib
Seaborn
NetworkX
Multi-Agent Framework
4 Specialized Agents
Web Search Integration
Competitive Intelligence
Strategic Synthesis
Auto Visualization
Deployment Options
Google Colab
Jupyter Notebook
Local Python
Streamlit (Optional)
System Architecture
Pipeline Flow:
1. Industry Research → Web search + LLM trend extraction
2. Competitor Intelligence → Capability mapping + white-space detection
3. Opportunity Analysis → 2x2 matrix scoring (attractiveness × competition)
4. Strategic Report → Markdown report + embedded visualizations
Output Package:
- 1 Markdown report (~10 pages)
- 3 PNG visualizations
- JSON data export (optional)
📖 Development Setup & Usage Guide
Quick Start
- Try the AI Assistant Demo: Click "Launch AI Assistant Demo" button above — zero-setup interactive walkthrough of the 4-agent pipeline
- Run the full pipeline locally: Clone the repo, add GEMINI_API_KEY and TAVILY_API_KEY to a
.env file
- Install dependencies:
pip install -r requirements.txt
- Run Pipeline:
python data_consulting_business_analyst.py
- Download Results: Get markdown report and 3 visualization charts
Example Usage — fruit retail case
# Run the full 4-agent pipeline on the fruit retail dataset
results = run_consulting_discovery_pipeline(
input_csv="fruit_sales_sept_2024.csv",
output_path="fruit_retail_market_report.md"
)
# The pipeline automatically:
# 1. Research Agent — market shape, top SKUs, daily variance
# 2. Competitor Intel Agent — SKU landscape, pricing discipline analysis
# 3. Opportunity Agent — 2×2 Grow / Fix / Monitor / Exit placement
# 4. Strategy Agent — executive summary + 3 priorities + 90-day plan
# Output Files:
# - fruit_retail_market_report.md
# - sku_revenue_chart.png
# - pricing_discipline_heatmap.png
# - opportunity_map_2x2.png
Customization Options
# Re-run the pipeline against a different SME vertical
queries = [
"Malaysian kopitiam F&B daily sales analysis",
"SME retail pricing discipline benchmarks",
"Bursa-listed consumer staples same-store-sales"
]
# Adjust quadrant thresholds (default: median revenue × median price variance)
rev_threshold = 90000 # RM per SKU per month
var_threshold = 2.30 # Price std dev per SKU
# Change visualization palette
sns.set_palette("YlOrBr") # Amber-gold theme
Required API Keys
- Google AI Studio API: Get from Google AI Studio (free tier available)
- Tavily Search API: Get from Tavily (free 1,000 searches/month)
📊 Performance Metrics & Business Impact
10-15 min
Full Analysis Time
Business Value Demonstration
- Speed: 100x faster than manual research (weeks → minutes)
- Comprehensive: Covers industry, competitors, and opportunities in one run
- Objective: Data-driven analysis removes confirmation bias
- Repeatable: Monthly tracking to monitor market evolution
- Actionable: Immediate recommendations with implementation timeline
Use Cases
- SME portfolio review: Rank SKUs by revenue, volume, and pricing stability in one pass
- Pricing discipline audit: Surface SKUs with wide price variance and estimate the margin recovery upside
- Channel strategy: Compare bulk/B2B vs retail performance to identify the higher-value channel
- Quarterly SKU review: Track Grow/Fix/Monitor/Exit quadrant shifts over time
- Pre-investment diligence: Rapid market shape assessment on any transaction dataset
- Board/owner reporting: Executive summary + top 3 priorities + 90-day plan, ready to present
Real-World Impact
Traditional Manual Approach:
- Time: 4-6 weeks
- Cost: RM30,000-RM100,000 (SME consulting engagement)
- Coverage: Limited by consultant hours and experience
- Freshness: Outdated by the time the deck is delivered
AI-Powered Approach:
- Time: 10-15 minutes
- Cost: ~RM1 per analysis (API calls only)
- Coverage: Every transaction in the dataset, no sampling
- Freshness: Re-runnable any time the data updates
📋 Sample Report Sections
Executive Summary Example — fruit retail case
The Malaysian fruit retail business clocks RM1.88 million in monthly
revenue across 3,000 transactions and 21 SKUs (Sept 2024). The market
is fragmented — no single SKU exceeds 5.5% of revenue, and the top 5
combined account for only 26.1%. Three structural opportunities identified:
1. Pricing Discipline (Impact: High, Effort: Low)
- Every top SKU sold at both RM2 and RM10 per kg (5× spread)
- Single biggest margin-recovery lever — no volume risk
- Estimated 8–15% gross margin lift from pricing SOP alone
2. Bulk / B2B Channel Playbook (Impact: High, Effort: Medium)
- Bulk orders are 27% of transactions but 44% of revenue
- Avg bulk ticket RM1,042 vs retail RM479 (2.2×)
- Formalising this channel could add RM150K–RM250K annually
3. Bottom-Quadrant SKU Cleanup (Impact: Medium, Effort: Low)
- 10 of 21 SKUs sit in Monitor or Exit quadrants
- 3 Exit SKUs (Starfruits, Honeydew, Pineapples) are clean delist
candidates — freeing shelf and capital for the top 5
Strategic Recommendations Example — fruit retail case
- Focus Area: Pricing SOP across 8 "Fix" quadrant SKUs (top revenue + broken pricing)
- Target Priority: Guavas, Durians, Peaches, Dragon Fruits, Mangosteens (top 5 by revenue)
- Differentiation: Daily variance dashboard + weekly price-band review
- Partnerships: Named key-account playbook for the 27% of transactions driving 44% of revenue
- Timeline: 30-day pricing audit → 60-day B2B playbook → 90-day portfolio cleanup
🎯 Advanced Features & Customization
Vertical-Specific Variations
The same 4-agent pipeline adapts to any transactional SME business:
- Fresh produce & grocery: SKU portfolio + pricing variance (fruit retail — the demo case)
- F&B outlets: Menu item performance + daily ticket analysis + bulk catering mix
- Retail apparel: Category rotation + markdown discipline + channel concentration
- Services businesses: Package utilisation + repeat-customer share + seasonal pattern
Add-On Agents (Future Enhancements)
- Supplier Intelligence Agent: Trace cost drivers back to supplier-level pricing
- Competitor Benchmark Agent: Compare your SKUs against nearby competitors in the same category
- Seasonality Agent: Detect day-of-week and month-over-month patterns in transactions
- Forecasting Agent: Project next-quarter revenue and SKU mix based on trend data
Integration Options
- CRM Integration: Feed insights into Salesforce/HubSpot
- Slack Notifications: Auto-post weekly market updates
- Dashboard Embedding: Display charts in internal strategy portals
- Scheduled Runs: Cron job for monthly market pulse checks