An advanced Utility-Based AI Agent built using Python.
This project demonstrates how intelligent systems:
- compare multiple options
- calculate utility scores
- optimize decisions
- recommend the best outcome
A Utility-Based Agent does not simply react.
Instead, it:
- Evaluates multiple choices
- Calculates a utility score
- Chooses the BEST possible option
Utility-Based Agents are used in:
- 🎬 Netflix recommendations
- 🛒 Amazon product suggestions
- 🚗 Self-driving car decisions
- 📍 Google Maps route optimization
- 📈 Trading systems
- 🎵 Spotify recommendations
+----------------------+
| User Input |
+----------+-----------+
|
v
+----------------------+
| Input Processing |
| (Preference Parse) |
+----------+-----------+
|
v
+----------------------+
| Utility Function |
| (Score Calculation) |
+----------+-----------+
|
v
+----------------------+
| Decision Engine |
| (Best Selection) |
+----------+-----------+
|
v
+----------------------+
| Recommended Movie |
+----------------------+
User Preferences
↓
Extract Genres
↓
Score All Movies
↓
Compare Utility Scores
↓
Select Best Movie
↓
Return Recommendation
utility-based-agent/
│
├── agent/
│ ├── movies.py
│ ├── utility.py
│ ├── processor.py
│ ├── memory.py
│ └── agent.py
│
├── data/
│ └── preferences.json
│
├── main.py
├── README.md
└── .gitignore
| File | Responsibility |
|---|---|
movies.py |
Stores movie database |
processor.py |
Extracts user preferences |
utility.py |
Calculates utility scores |
memory.py |
Saves user preferences |
agent.py |
Main recommendation engine |
preferences.json |
Persistent preference storage |
The utility score is calculated using:
Utility Score =
Genre Match Score
+ Movie Rating Score
+ Popularity Score
Movie:
Avengers
User Preferences:
action + sci-fi
Scoring:
Genre Match:
+10 (action)
+10 (sci-fi)
Movie Rating:
9 × 2 = 18
Popularity:
+10
TOTAL = 48
✅ Multi-factor recommendation system ✅ Genre preference extraction ✅ Utility score optimization ✅ Persistent user preferences ✅ Weighted scoring system ✅ Recommendation explanations ✅ Modular architecture
I like action and sci-fi movies
🎬 Recommended Movie: Avengers
⭐ Score: 48
🎯 Matched Genres: ['action', 'sci-fi']
🔥 Rating: 9
📈 Popularity: 10
python -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepython main.pyThis project teaches:
- Utility-Based Decision Making
- Optimization Systems
- Recommendation Engines
- Multi-factor Scoring
- Persistent Memory
- Modular AI Architecture
- Preference Extraction
| Concept | Description |
|---|---|
| Utility Function | Measures usefulness of choices |
| Optimization | Choosing best option |
| Decision Engine | Selects highest-scoring item |
| Preference Extraction | Understands user interests |
| Persistent Storage | Saves data across sessions |
- Uses predefined movie dataset
- No machine learning yet
- No dynamic internet data
- Basic preference understanding
Planned upgrades:
- 🤖 LLM-based reasoning
- 📊 Machine learning recommendations
- 🌐 API integration
- 🧠 User behavior learning
- 🎯 Personalized recommendation engine
- 📈 Dynamic scoring systems
By building this project, you understand how modern AI systems:
- evaluate options
- optimize decisions
- rank recommendations
- balance multiple factors
This is the foundation of real-world recommendation systems used by major technology companies.
Built as part of a deep learning journey into AI Agent Architectures.