You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66-79Lines changed: 66 additions & 79 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,55 +1,73 @@
1
-
# 🤖 Chat Agent Starter Kit
1
+
# Beatsmith AI
2
2
3
3

4
4
5
5
<ahref="https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/agents-starter"><imgsrc="https://deploy.workers.cloudflare.com/button"alt="Deploy to Cloudflare"/></a>
6
6
7
-
A starter template for building AI-powered chat agents using Cloudflare's Agent platform, powered by [`agents`](https://www.npmjs.com/package/agents). This project provides a foundation for creating interactive chat experiences with AI, complete with a modern UI and tool integration capabilities.
7
+
Beatsmith AI is an AI-powered music discovery assistant built with Cloudflare's Agent platform, powered by [`agents`](https://www.npmjs.com/package/agents). Discover new songs, find similar artists, and explore music through natural conversation with AI.
8
8
9
9
## Features
10
10
11
-
- 💬 Interactive chat interface with AI
12
-
- 🛠️ Built-in tool system with human-in-the-loop confirmation
13
-
- 📅 Advanced task scheduling (one-time, delayed, and recurring via cron)
14
-
- 🌓 Dark/Light theme support
15
-
- ⚡️ Real-time streaming responses
16
-
- 🔄 State management and chat history
17
-
- 🎨 Modern, responsive UI
11
+
- Music discovery and recommendations
12
+
- Search Spotify tracks and artists
13
+
- Find similar songs using Last.fm data
14
+
- Discover related artists
15
+
- Get detailed track information
16
+
- Dark/Light theme support
17
+
- Real-time streaming responses
18
+
- State management and chat history
19
+
- Modern, responsive UI
18
20
19
21
## Prerequisites
20
22
21
23
- Cloudflare account
22
24
- OpenAI API key
25
+
- Spotify API credentials (Client ID and Client Secret)
-**OpenAI API Key**: Sign up at [OpenAI](https://platform.openai.com/api-keys)
49
+
-**Spotify Credentials**: Create an app at [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
50
+
-**Last.fm API Key**: Get an API key at [Last.fm API](https://www.last.fm/api/account/create)
51
+
52
+
### Accessing Login Features
53
+
54
+
**Note**: The Spotify login system has been deprecated in the default implementation. However, if you want to enable user-specific features (such as accessing user's top tracks, playlists, or creating playlists), you will need to:
55
+
56
+
1. Set up your own Spotify app in the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
57
+
2. Configure the redirect URI in your Spotify app settings to match your deployment URL (e.g., `https://your-domain.workers.dev/callback`)
58
+
3. Add yourself and any other users to the **User Management** section of your Spotify app
59
+
4. Update the callback URL in `tools.ts` to match your deployment
60
+
5. Users must be explicitly added to your Spotify app's user list before they can authenticate
61
+
62
+
Without setting up your own Spotify app with user management, only public Spotify features (search, track info, related artists) will be available.
63
+
64
+
3. Run locally:
47
65
48
66
```bash
49
67
npm start
50
68
```
51
69
52
-
5. Deploy:
70
+
4. Deploy:
53
71
54
72
```bash
55
73
npm run deploy
@@ -66,6 +84,16 @@ npm run deploy
66
84
│ └── styles.css # UI styling
67
85
```
68
86
87
+
## Available Tools
88
+
89
+
Beatsmith AI comes with the following music-related tools:
90
+
91
+
-**Search Spotify Tracks** - Search for songs and artists on Spotify
92
+
-**Find Similar Songs** - Discover tracks similar to a given song using Last.fm data
93
+
-**Get Related Artists** - Find artists similar to a given artist
94
+
-**Get Track Information** - Retrieve detailed metadata for any Spotify track
95
+
-**Search Spotify Artist** - Look up artist information by name or ID
96
+
69
97
## Customization Guide
70
98
71
99
### Adding New Tools
@@ -76,7 +104,7 @@ Add new tools in `tools.ts` using the tool builder:
76
104
// Example of a tool that requires confirmation
77
105
const searchDatabase =tool({
78
106
description: "Search the database for user records",
79
-
parameters: z.object({
107
+
inputSchema: z.object({
80
108
query: z.string(),
81
109
limit: z.number().optional()
82
110
})
@@ -86,23 +114,9 @@ const searchDatabase = tool({
86
114
// Example of an auto-executing tool
87
115
const getCurrentTime =tool({
88
116
description: "Get current server time",
89
-
parameters: z.object({}),
117
+
inputSchema: z.object({}),
90
118
execute: async () =>newDate().toISOString()
91
119
});
92
-
93
-
// Scheduling tool implementation
94
-
const scheduleTask =tool({
95
-
description:
96
-
"schedule a task to be executed at a later time. 'when' can be a date, a delay in seconds, or a cron pattern.",
97
-
parameters: z.object({
98
-
type: z.enum(["scheduled", "delayed", "cron"]),
99
-
when: z.union([z.number(), z.string()]),
100
-
payload: z.string()
101
-
}),
102
-
execute: async ({ type, when, payload }) => {
103
-
// ... see the implementation in tools.ts
104
-
}
105
-
});
106
120
```
107
121
108
122
To handle tool confirmations, add execution functions to the `executions` object:
@@ -181,51 +195,24 @@ The chat interface is built with React and can be customized in `app.tsx`:
181
195
- Customize message rendering and tool confirmation dialogs
182
196
- Add new controls to the header
183
197
184
-
### Example Use Cases
185
-
186
-
1.**Customer Support Agent**
187
-
- Add tools for:
188
-
- Ticket creation/lookup
189
-
- Order status checking
190
-
- Product recommendations
191
-
- FAQ database search
192
-
193
-
2.**Development Assistant**
194
-
- Integrate tools for:
195
-
- Code linting
196
-
- Git operations
197
-
- Documentation search
198
-
- Dependency checking
199
-
200
-
3.**Data Analysis Assistant**
201
-
- Build tools for:
202
-
- Database querying
203
-
- Data visualization
204
-
- Statistical analysis
205
-
- Report generation
206
-
207
-
4.**Personal Productivity Assistant**
208
-
- Implement tools for:
209
-
- Task scheduling with flexible timing options
210
-
- One-time, delayed, and recurring task management
211
-
- Task tracking with reminders
212
-
- Email drafting
213
-
- Note taking
214
-
215
-
5.**Scheduling Assistant**
216
-
- Build tools for:
217
-
- One-time event scheduling using specific dates
218
-
- Delayed task execution (e.g., "remind me in 30 minutes")
219
-
- Recurring tasks using cron patterns
220
-
- Task payload management
221
-
- Flexible scheduling patterns
222
-
223
-
Each use case can be implemented by:
224
-
225
-
1. Adding relevant tools in `tools.ts`
226
-
2. Customizing the UI for specific interactions
198
+
### Example Queries
199
+
200
+
Try asking Beatsmith AI:
201
+
202
+
- "Find songs similar to Cruel Summer"
203
+
- "Find artists similar to The Weeknd"
204
+
- "Search for Taylor Swift on Spotify"
205
+
- "Get track information for [song name]"
206
+
- "What songs are similar to [track name]?"
207
+
208
+
### Extending Beatsmith
209
+
210
+
You can extend Beatsmith AI by:
211
+
212
+
1. Adding new music-related tools in `tools.ts`
213
+
2. Customizing the UI for specific interactions in `app.tsx`
227
214
3. Extending the agent's capabilities in `server.ts`
228
-
4.Adding any necessary external API integrations
215
+
4.Integrating additional music APIs (e.g., Apple Music, YouTube Music)
0 commit comments