Prerequisites
The following example requires thespotify 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
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
access_token | str | - | Access token for authentication purposes. |
default_market | str | "US" | Default market for the search. |
timeout | int | 30 | Timeout for the search. |
Toolkit Functions
| Function | Description |
|---|---|
search_tracks | Search for tracks on Spotify |
search_playlists | Search for playlists on Spotify |
search_artists | Search for artists on Spotify |
search_albums | Search for albums on Spotify |
get_user_playlists | Get playlists for a specific user |
get_track_recommendations | Get track recommendations based on seed data |
get_artist_top_tracks | Get top tracks for a specific artist |
get_album_tracks | Get tracks from a specific album |
get_my_top_tracks | Get current user’s top tracks |
get_my_top_artists | Get current user’s top artists |
create_playlist | Create a new playlist for the user |
add_tracks_to_playlist | Add tracks to an existing playlist |
get_playlist | Get details of a specific playlist |
update_playlist_details | Update playlist name, description, or other details |
remove_tracks_from_playlist | Remove tracks from an existing playlist |
get_current_user | Get current user’s profile information |
play_track | Play a specific track (requires Spotify Premium) |
get_currently_playing | Get information about currently playing track |