Skip to content

Commit 676e7e5

Browse files
Update Readme
1 parent 613fbc7 commit 676e7e5

File tree

1 file changed

+66
-79
lines changed

1 file changed

+66
-79
lines changed

README.md

Lines changed: 66 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,73 @@
1-
# 🤖 Chat Agent Starter Kit
1+
# Beatsmith AI
22

33
![npm i agents command](./npm-agents-banner.svg)
44

55
<a href="https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/agents-starter"><img src="https://deploy.workers.cloudflare.com/button" alt="Deploy to Cloudflare"/></a>
66

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

99
## Features
1010

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
1820

1921
## Prerequisites
2022

2123
- Cloudflare account
2224
- OpenAI API key
25+
- Spotify API credentials (Client ID and Client Secret)
26+
- Last.fm API key
2327

2428
## Quick Start
2529

26-
1. Create a new project:
27-
28-
```bash
29-
npx create-cloudflare@latest --template cloudflare/agents-starter
30-
```
31-
32-
2. Install dependencies:
30+
1. Install dependencies:
3331

3432
```bash
3533
npm install
3634
```
3735

38-
3. Set up your environment:
36+
2. Set up your environment:
3937

4038
Create a `.dev.vars` file:
4139

4240
```env
4341
OPENAI_API_KEY=your_openai_api_key
42+
SPOTIFY_CLIENT_ID=your_spotify_client_id
43+
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
44+
LASTFM_API_KEY=your_lastfm_api_key
4445
```
4546

46-
4. Run locally:
47+
To get your API keys:
48+
- **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:
4765

4866
```bash
4967
npm start
5068
```
5169

52-
5. Deploy:
70+
4. Deploy:
5371

5472
```bash
5573
npm run deploy
@@ -66,6 +84,16 @@ npm run deploy
6684
│ └── styles.css # UI styling
6785
```
6886

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+
6997
## Customization Guide
7098

7199
### Adding New Tools
@@ -76,7 +104,7 @@ Add new tools in `tools.ts` using the tool builder:
76104
// Example of a tool that requires confirmation
77105
const searchDatabase = tool({
78106
description: "Search the database for user records",
79-
parameters: z.object({
107+
inputSchema: z.object({
80108
query: z.string(),
81109
limit: z.number().optional()
82110
})
@@ -86,23 +114,9 @@ const searchDatabase = tool({
86114
// Example of an auto-executing tool
87115
const getCurrentTime = tool({
88116
description: "Get current server time",
89-
parameters: z.object({}),
117+
inputSchema: z.object({}),
90118
execute: async () => new Date().toISOString()
91119
});
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-
});
106120
```
107121

108122
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`:
181195
- Customize message rendering and tool confirmation dialogs
182196
- Add new controls to the header
183197

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`
227214
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)
229216

230217
## Learn More
231218

0 commit comments

Comments
 (0)