📊 SME Business Advisor

AI Agent (ADK) for E-Commerce Business Analytics

Python Google ADK Google Gemini 2.0 Flash FastAPI Docker Google Cloud Run

📋 Project Overview & Problem Statement

Challenge: SME owners sit on mountains of transaction data but have no dedicated analyst to make sense of it. Sales trends, profit margins, discount effectiveness, return patterns, and delivery performance all go unexamined — decisions are made on gut feel instead of evidence.

Solution: An AI agent built with Google ADK that analyses 34,500 e-commerce orders across 6 pre-built analytical tools. The agent receives a plain-English question, selects the right tool, runs the analysis, and returns a clear recommendation — no coding or dashboard setup required.

How It Works

🖥️ Application Features

📈 Sales Analysis

Analyses revenue trends over time, identifies top-performing products and categories, and highlights periods of sales growth or decline across 5 regions.

💰 Profit Analysis

Calculates profit margins by product, category, and region. Identifies which items generate the most profit versus the most revenue — they are not always the same.

🏷️ Discount Analysis

Evaluates the effectiveness of discount campaigns. Compares discounted vs non-discounted orders on revenue, margin, and volume to determine which promotions actually work.

🔃 Return Analysis

Identifies products, categories, and regions with the highest return rates. Surfaces patterns that help reduce returns and improve customer satisfaction.

👥 Customer Segments

Groups customers by purchasing behaviour — frequency, recency, and spend. Identifies high-value segments and those at risk of churning.

🚚 Delivery Analysis

Analyses delivery times by region and shipping method. Identifies delays and their impact on customer satisfaction and return rates.

🤖 AI Integration & Intelligence

🧠 Google ADK (Agent Development Kit)

The agent framework that orchestrates tool selection and execution. ADK manages the conversation flow, decides which analytical tool to invoke, and handles the full request-response cycle.

⚡ Gemini 2.0 Flash

The reasoning engine behind the agent. Gemini interprets user questions, maps them to the right analytical tool, and synthesises raw data outputs into clear, actionable business recommendations.

💻 Code-as-Action Pattern

The agent generates Python code (pandas operations) to answer each question. The server executes this code in a controlled environment and returns structured results — no hardcoded reports.

🗃️ In-Memory Dataset

The full 34,500-order dataset is loaded into memory at startup. Every query runs against live data with no database overhead — fast responses for interactive use.

🛠️ Technical Architecture & Implementation

Frontend Stack

FastAPI HTML / CSS / JavaScript

Backend Stack

Python Google ADK pandas

Deployment

Docker Google Cloud Run

System Architecture

📊 Key Metrics

6
Analytical Tools
34,500
E-Commerce Orders
17
Data Columns
5
Regions Covered