> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc-agui.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Spotify

**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](https://developer.spotify.com/).

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.

```python cookbook/14_tools/spotify_tools.py theme={null}
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

| 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       |

## Developer Resources

* View [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/spotify.py)
