Skip to content

MT522/business_agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“Š Business Intelligence LangGraph Agent

This project implements a simple AI agent using LangGraph that analyzes basic business data (daily revenue, costs, customers) and generates automated insights and recommendations.

๐Ÿš€ Features

๐Ÿงฎ Calculates:

  • Profit/Loss
  • Customer Acquisition Cost (CAC)
  • Revenue per Customer
  • Day-over-day changes (revenue, cost, CAC)

๐Ÿ“ข Generates actionable recommendations:

  • Reduce costs if profit is negative
  • Alert if CAC increases by more than 20%
  • Suggest marketing adjustments based on trends
  • Identify shrinking customer base or falling revenue per customer
  • Highlight low margins or high cost ratios

๐Ÿง  Built using LangGraph for agent-based flow and state management

๐Ÿ“ฆ Installation

  1. Create and activate virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt

โ–ถ๏ธ Usage

Run the agent on sample input:

from agent_graph import graph

sample_input = {
    "data": {
        "today": {"revenue": 2000, "cost": 1200, "customers": 40},
        "yesterday": {"revenue": 1500, "cost": 1100, "customers": 35}
    }
}

result = graph.invoke(sample_input)
print(result["recommendations"])

Output Format:

{
  "recommendations": {
    "status": "Profit",
    "alerts": ["CAC increased by more than 20%."],
    "advice": [
      "Review marketing campaigns due to increased CAC.",
      "Consider increasing advertising budget due to growing sales."
    ]
  }
}

โœ… Testing

Run tests to validate various business scenarios:

python test_agent.py

Test cases include:

  • Profit and growth
  • Loss and rising CAC
  • Shrinking customer base
  • Low margin alerts
  • Falling revenue per customer
  • Stable scenario

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages