Skip to content

Mtrobreaker/utility-based-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Advanced Utility-Based AI Agent

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

🧠 What is a Utility-Based Agent?

A Utility-Based Agent does not simply react.

Instead, it:

  1. Evaluates multiple choices
  2. Calculates a utility score
  3. Chooses the BEST possible option

🚀 Real-World Applications

Utility-Based Agents are used in:

  • 🎬 Netflix recommendations
  • 🛒 Amazon product suggestions
  • 🚗 Self-driving car decisions
  • 📍 Google Maps route optimization
  • 📈 Trading systems
  • 🎵 Spotify recommendations

🏗️ Architecture

                 +----------------------+
                 |     User Input       |
                 +----------+-----------+
                            |
                            v
                 +----------------------+
                 |   Input Processing   |
                 |  (Preference Parse)  |
                 +----------+-----------+
                            |
                            v
                 +----------------------+
                 |   Utility Function   |
                 |  (Score Calculation) |
                 +----------+-----------+
                            |
                            v
                 +----------------------+
                 |   Decision Engine    |
                 |  (Best Selection)    |
                 +----------+-----------+
                            |
                            v
                 +----------------------+
                 | Recommended Movie    |
                 +----------------------+

🧠 Agent Workflow

User Preferences
      ↓
Extract Genres
      ↓
Score All Movies
      ↓
Compare Utility Scores
      ↓
Select Best Movie
      ↓
Return Recommendation

📂 Project Structure

utility-based-agent/
│
├── agent/
│   ├── movies.py
│   ├── utility.py
│   ├── processor.py
│   ├── memory.py
│   └── agent.py
│
├── data/
│   └── preferences.json
│
├── main.py
├── README.md
└── .gitignore

📁 File Responsibilities

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

🔥 Utility Function

The utility score is calculated using:

Utility Score =
Genre Match Score
+ Movie Rating Score
+ Popularity Score

🧠 Example Utility Calculation

Movie:

Avengers

User Preferences:

action + sci-fi

Scoring:

Genre Match:
+10 (action)
+10 (sci-fi)

Movie Rating:
9 × 2 = 18

Popularity:
+10

TOTAL = 48

⚙️ Features

✅ Multi-factor recommendation system ✅ Genre preference extraction ✅ Utility score optimization ✅ Persistent user preferences ✅ Weighted scoring system ✅ Recommendation explanations ✅ Modular architecture


🧪 Example Usage

User Input

I like action and sci-fi movies

Agent Output

🎬 Recommended Movie: Avengers
⭐ Score: 48
🎯 Matched Genres: ['action', 'sci-fi']
🔥 Rating: 9
📈 Popularity: 10

🚀 How to Run

1. Create Virtual Environment

Windows

python -m venv venv
venv\Scripts\activate

Mac/Linux

python3 -m venv venv
source venv/bin/activate

2. Run Agent

python main.py

🧠 Key AI Concepts Learned

This project teaches:

  • Utility-Based Decision Making
  • Optimization Systems
  • Recommendation Engines
  • Multi-factor Scoring
  • Persistent Memory
  • Modular AI Architecture
  • Preference Extraction

🔥 Major AI Concepts

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

⚠️ Current Limitations

  • Uses predefined movie dataset
  • No machine learning yet
  • No dynamic internet data
  • Basic preference understanding

🚀 Future Improvements

Planned upgrades:

  • 🤖 LLM-based reasoning
  • 📊 Machine learning recommendations
  • 🌐 API integration
  • 🧠 User behavior learning
  • 🎯 Personalized recommendation engine
  • 📈 Dynamic scoring systems

🎯 Learning Outcome

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.


👨‍💻 Author

Built as part of a deep learning journey into AI Agent Architectures.


About

Basic level utility based ai agent

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages