Skip to main content
SpotifyTools enable an Agent to access Spotify API to search for songs.

Prerequisites

The following example requires the spotify library and an API key from Spotify. The only external library needed for spotify is the httpx. Which is already a dependency of Agno.

Example

The following agent will search for songs using Spotify API.
cookbook/tools/spotify_tools.py
from agno.agent import Agent
from agno.tools.spotify import SpotifyTools

agent = Agent(tools=[SpotifyTools()])
agent.print_response("Search for songs by 'Taylor Swift'")

Toolkit Params

ParameterTypeDefaultDescription
access_tokenstr-Access token for authentication purposes.
default_marketstr"US"Default market for the search.
timeoutint30Timeout for the search.

Toolkit Functions

FunctionDescription
search_tracksSearch for tracks on Spotify
search_playlistsSearch for playlists on Spotify
search_artistsSearch for artists on Spotify
search_albumsSearch for albums on Spotify
get_user_playlistsGet playlists for a specific user
get_track_recommendationsGet track recommendations based on seed data
get_artist_top_tracksGet top tracks for a specific artist
get_album_tracksGet tracks from a specific album
get_my_top_tracksGet current user’s top tracks
get_my_top_artistsGet current user’s top artists
create_playlistCreate a new playlist for the user
add_tracks_to_playlistAdd tracks to an existing playlist
get_playlistGet details of a specific playlist
update_playlist_detailsUpdate playlist name, description, or other details
remove_tracks_from_playlistRemove tracks from an existing playlist
get_current_userGet current user’s profile information
play_trackPlay a specific track (requires Spotify Premium)
get_currently_playingGet information about currently playing track

Developer Resources