Want Music Recommendations? Look No Further.

For the final project in my Advanced Artificial Intelligence class as part of my Master in Business Analytics program, I was tasked with creating an AI agent. I chose to work alone for this project so I could fully pan out my creative vision, and I’m glad I did. I love listening to music, so I thought exploring the realm of music recommendations would be really cool. It was awesome seeing the whole project come to life, and I thoroughly enjoyed adding little details and refreshing the page to see them go into effect. Below you can see the full UI for the site I made using Python and HTML’s.

I have been able to create a music recommendation system using an AI agent built with Flask that pulls data from Spotify and Last.fm, blends audio features and similar-artist logic, and then serves up fresh song suggestions every time you hit “Search.” On the back end, I set up a Flask app that takes a user’s input (like “hotline bling drake”), calls Spotify’s API to grab the track and artist IDs, and then builds a “pool” of potential recommendations. First, I try Spotify’s built-in recommendations endpoint, but because it can be narrow, I also leverage Last.fm to find similar artists and then grab their top tracks from Spotify. If all that still doesn’t hit twenty songs, I fall back to pulling the original artist’s most popular tracks. Once I have my pool, I shuffle it so the user gets a random mix each time, then slice out the first three and send them back in a clean interface that shows album art, song title, artist, and a link to play the song on Spotify.

I also built in a “History” tab that shows all of the songs that you’ve been recommended. What’s cool about my app is that it won’t always give the same recommendations. As seen in the History tab, I searched “Norbit” by Bas twice, and got different results each time. This is especially useful if you’ve already heard all of the recommended tracks it gives you on the first attempt.

The coolest part was customizing the logic step by step—I’d tweak a filter or update the HTML for aesthetics, refresh the page to see the results, and feel like a mad scientist watching my experiment evolve. Debugging the API errors taught me a ton about real-world API quirks, and I even added fallback branches to handle missing data or “Artist Running Club”— which is an indie artist that showed up as a recommendation for rap songs. But I noticed that even Spotify’s algorithm has mistakes too.

Halfway into my testing, I realized that even Spotify’s algorithm for recommending songs messes up sometimes. Chase Shakur is an Atlanta-born R&B singer and there are recommendations for songs that are in another language.

Being able to combine my app with the recommendations that Spotify gives can allow music lovers to keep expanding their music taste in different ways. Where Spotify’s recommendation algorithm falters, mine can excel and vice versa. My app is a good starting point and works best for smaller artists especially if you have an expansive music taste and are interested in hearing music from artists you may have never heard before. I’ve already been able to find some great new songs from this method and I’m really glad I was able to have the opportunity to learn more about AI agent programming while being able to work on something I love.

Going forward, I am definitely interested in exploring the Spotify’s developer tools more in-depth and maybe even making more AI agents or data-driven tools that can benefit music lovers in new and innovative ways. If I had spent more time perfecting this current project, I would have tried to improve the algorithm for recommendations even more (I spent many hours attempting to perfect it but couldn’t get it to exactly where I wanted it to be) and I would run the Flask engine through a server that would allow me to display the whole project as an interactable interface here on my website.

If you’re interested in trying it out for yourself in the meantime, you can find the code and documentation on my Github here. Just make sure to get a Spotify Client ID & Client Secret and a LastFM API key.

Overall, the project pushed me to combine AI concepts (like feature-based recommendations) with full-stack engineering. I got to design the session history storage in Flask, integrate multiple external APIs, and fine-tune how quickly and accurately the system responds. More than anything, seeing my own playlist creator in action made me realize how powerful even a small AI agent can be when you piece together the right building blocks. It was challenging, fun, and exactly the kind of hands-on creative freedom I wanted—from idea to the finished product.