This project is a simple AI agent that analyzes basic business data (e.g., daily revenue, costs, and customers) using the LangGraph framework.
The agent can:
- 📈 Calculates daily profit
- 📉 Detects changes in revenue, cost, and CAC (Customer Acquisition Cost)
- 🤖 Provides actionable recommendations to improve business decisions
Built using:
- 🧠 LangGraph for graph-based workflow
- 🔁 Multi-step agent structure
- ✅ UV for fast package management and reproducible environments
- Understand how to use LangGraph to build modular AI agents
- Apply basic business metrics and logic (profit, CAC, trends)
- Generate practical, interpretable output
- Write test cases to ensure correctness
- 🔢 Profit Calculation: Computes daily profit using revenue and cost
- 📊 Trend Detection: Compares today’s vs yesterday’s data
- 💰 CAC Alerting: Warns if customer acquisition cost increases
- 💡 Smart Recommendations: Offers suggestions like reducing costs or boosting marketing
- 🧪 Test Coverage: Pytest used to validate outputs
Easily test and visualize your AI agent using LangGraph Studio — a web interface for debugging and observing LangGraph-based workflows.
-
Add
langgraph.jsonto your repo:json { "dependencies" : [ "ipykernel>=6.29.5", "langchain-groq>=0.3.6", "langgraph>=0.5.2", "langgraph-cli[inmem]>=0.3.4", "pytest>=8.4.1", "python-dotenv>=1.1.1" ], "graphs": { "my_agent": "./agent.py:app"}, "env": "./.venv" } -
Provide any required environment variables like your API key.
-
Trigger your agent with sample data and view node-by-node execution.
-
Open Run a local server on LangGraph Studio website
- 🧭 Visual debugging — See exactly how data flows between nodes
- 🚀 Rapid iteration — Run and test inputs live, no CLI needed
- 🔒 Secure — Use environment variables without hardcoding secrets
.
├── src/
│ ├── main.py # LangGraph agent logic
│ └── test_agent.py # Pytest test cases
├── .gitignore
├── .env.example # Safe env config example
├── pyproject.toml # UV + dependencies
└── README.mdRun tests with:
uv pip install pytest
pytest src/
