Skip to content

Commit 399f6a7

Browse files
committed
update readme
1 parent e81184c commit 399f6a7

1 file changed

Lines changed: 40 additions & 212 deletions

File tree

README.md

Lines changed: 40 additions & 212 deletions
Original file line numberDiff line numberDiff line change
@@ -1,238 +1,66 @@
1-
# 🤖 Chat Agent Starter Kit
1+
# Supermemory x Pipecat
22

3-
![npm i agents command](./npm-agents-banner.svg)
4-
5-
<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>
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.
8-
9-
## Features
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
18-
19-
## Prerequisites
20-
21-
- Cloudflare account
22-
- OpenAI API key
3+
Voice assistant with persistent memory powered by [Supermemory](https://supermemory.ai) and [Pipecat](https://pipecat.ai).
234

245
## Quick Start
256

26-
1. Create a new project:
27-
287
```bash
29-
npx create-cloudflare@latest --template cloudflare/agents-starter
8+
bun install && cd backend && pip install -r requirements.txt
309
```
3110

32-
2. Install dependencies:
33-
3411
```bash
35-
npm install
36-
```
37-
38-
3. Set up your environment:
39-
40-
Create a `.dev.vars` file:
41-
42-
```env
43-
OPENAI_API_KEY=your_openai_api_key
12+
# backend/.env
13+
OPENAI_API_KEY=sk-...
14+
SUPERMEMORY_API_KEY=sm-...
4415
```
4516

46-
4. Run locally:
47-
4817
```bash
49-
npm start
18+
bun run start:backend # Terminal 1
19+
bun run dev # Terminal 2
5020
```
5121

52-
5. Deploy:
22+
## Pipecat Memory Integration
5323

54-
```bash
55-
npm run deploy
56-
```
24+
Add persistent memory to your Pipecat voice AI agent. Remember user preferences, past conversations, and context across sessions.
5725

58-
## Project Structure
26+
Supermemory integrates with Pipecat, providing long-term memory capabilities for voice AI agents. Your Pipecat applications will remember past conversations and provide personalized responses based on user history.
5927

60-
```
61-
├── src/
62-
│ ├── app.tsx # Chat UI implementation
63-
│ ├── server.ts # Chat agent logic
64-
│ ├── tools.ts # Tool definitions
65-
│ ├── utils.ts # Helper functions
66-
│ └── styles.css # UI styling
67-
```
28+
### Installation
6829

69-
## Customization Guide
70-
71-
### Adding New Tools
72-
73-
Add new tools in `tools.ts` using the tool builder:
74-
75-
```ts
76-
// Example of a tool that requires confirmation
77-
const searchDatabase = tool({
78-
description: "Search the database for user records",
79-
parameters: z.object({
80-
query: z.string(),
81-
limit: z.number().optional(),
82-
}),
83-
// No execute function = requires confirmation
84-
});
85-
86-
// Example of an auto-executing tool
87-
const getCurrentTime = tool({
88-
description: "Get current server time",
89-
parameters: z.object({}),
90-
execute: async () => new Date().toISOString(),
91-
});
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-
```
107-
108-
To handle tool confirmations, add execution functions to the `executions` object:
109-
110-
```typescript
111-
export const executions = {
112-
searchDatabase: async ({
113-
query,
114-
limit,
115-
}: {
116-
query: string;
117-
limit?: number;
118-
}) => {
119-
// Implementation for when the tool is confirmed
120-
const results = await db.search(query, limit);
121-
return results;
122-
},
123-
// Add more execution handlers for other tools that require confirmation
124-
};
30+
```bash
31+
pip install supermemory-pipecat
12532
```
12633

127-
Tools can be configured in two ways:
128-
129-
1. With an `execute` function for automatic execution
130-
2. Without an `execute` function, requiring confirmation and using the `executions` object to handle the confirmed action. NOTE: The keys in `executions` should match `toolsRequiringConfirmation` in `app.tsx`.
131-
132-
### Use a different AI model provider
34+
### Configuration
13335

134-
The starting [`server.ts`](https://github.com/cloudflare/agents-starter/blob/main/src/server.ts) implementation uses the [`ai-sdk`](https://sdk.vercel.ai/docs/introduction) and the [OpenAI provider](https://sdk.vercel.ai/providers/ai-sdk-providers/openai), but you can use any AI model provider by:
36+
```python
37+
from supermemory_pipecat import SupermemoryPipecatService, InputParams
13538

136-
1. Installing an alternative AI provider for the `ai-sdk`, such as the [`workers-ai-provider`](https://sdk.vercel.ai/providers/community-providers/cloudflare-workers-ai) or [`anthropic`](https://sdk.vercel.ai/providers/ai-sdk-providers/anthropic) provider:
137-
2. Replacing the AI SDK with the [OpenAI SDK](https://github.com/openai/openai-node)
138-
3. Using the Cloudflare [Workers AI + AI Gateway](https://developers.cloudflare.com/ai-gateway/providers/workersai/#workers-binding) binding API directly
139-
140-
For example, to use the [`workers-ai-provider`](https://sdk.vercel.ai/providers/community-providers/cloudflare-workers-ai), install the package:
141-
142-
```sh
143-
npm install workers-ai-provider
39+
memory = SupermemoryPipecatService(
40+
api_key=os.getenv("SUPERMEMORY_API_KEY"),
41+
user_id="user_123",
42+
params=InputParams(mode="full", search_limit=10),
43+
)
14444
```
14545

146-
Add an `ai` binding to `wrangler.jsonc`:
147-
148-
```jsonc
149-
// rest of file
150-
"ai": {
151-
"binding": "AI"
152-
}
153-
// rest of file
46+
**Modes:** `profile` (user facts) | `query` (search) | `full` (both)
47+
48+
### Pipeline Integration
49+
50+
```python
51+
pipeline = Pipeline([
52+
transport.input(),
53+
stt,
54+
context_aggregator.user(),
55+
memory, # Supermemory
56+
llm,
57+
tts,
58+
transport.output(),
59+
context_aggregator.assistant(),
60+
])
15461
```
15562

156-
Replace the `@ai-sdk/openai` import and usage with the `workers-ai-provider`:
157-
158-
```diff
159-
// server.ts
160-
// Change the imports
161-
- import { openai } from "@ai-sdk/openai";
162-
+ import { createWorkersAI } from 'workers-ai-provider';
163-
164-
// Create a Workers AI instance
165-
+ const workersai = createWorkersAI({ binding: env.AI });
166-
167-
// Use it when calling the streamText method (or other methods)
168-
// from the ai-sdk
169-
- const model = openai("gpt-5");
170-
+ const model = workersai("@cf/deepseek-ai/deepseek-r1-distill-qwen-32b")
171-
```
172-
173-
Commit your changes and then run the `agents-starter` as per the rest of this README.
174-
175-
### Modifying the UI
176-
177-
The chat interface is built with React and can be customized in `app.tsx`:
178-
179-
- Modify the theme colors in `styles.css`
180-
- Add new UI components in the chat container
181-
- Customize message rendering and tool confirmation dialogs
182-
- Add new controls to the header
183-
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
227-
3. Extending the agent's capabilities in `server.ts`
228-
4. Adding any necessary external API integrations
229-
230-
## Learn More
231-
232-
- [`agents`](https://github.com/cloudflare/agents/blob/main/packages/agents/README.md)
233-
- [Cloudflare Agents Documentation](https://developers.cloudflare.com/agents/)
234-
- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)
235-
236-
## License
63+
## Links
23764

238-
MIT
65+
- [Supermemory Docs](https://supermemory.ai/docs)
66+
- [Pipecat Docs](https://docs.pipecat.ai)

0 commit comments

Comments
 (0)