lua-cli 3.1.0-alpha.4 → 3.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/cdn.api.service.d.ts +18 -0
- package/dist/api/cdn.api.service.js +43 -0
- package/dist/api/custom.data.api.service.d.ts +4 -3
- package/dist/api/custom.data.api.service.js +4 -3
- package/dist/api/developer.api.service.d.ts +54 -1
- package/dist/api/developer.api.service.js +89 -0
- package/dist/api/job.api.service.d.ts +10 -0
- package/dist/api/job.api.service.js +14 -0
- package/dist/api/lazy-instances.d.ts +8 -0
- package/dist/api/lazy-instances.js +16 -0
- package/dist/api/postprocessor.api.service.d.ts +3 -6
- package/dist/api/postprocessor.api.service.js +2 -3
- package/dist/api-exports.d.ts +74 -6
- package/dist/api-exports.js +87 -7
- package/dist/cli/command-definitions.js +34 -7
- package/dist/commands/admin.js +1 -1
- package/dist/commands/channels.js +1 -1
- package/dist/commands/compile.js +23 -4
- package/dist/commands/evals.d.ts +8 -0
- package/dist/commands/evals.js +41 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/init.d.ts +10 -1
- package/dist/commands/init.js +13 -3
- package/dist/commands/mcp.d.ts +18 -0
- package/dist/commands/mcp.js +393 -0
- package/dist/commands/push.js +172 -14
- package/dist/common/data.entry.instance.d.ts +1 -1
- package/dist/common/data.entry.instance.js +4 -4
- package/dist/common/job.instance.d.ts +24 -0
- package/dist/common/job.instance.js +38 -0
- package/dist/config/constants.d.ts +1 -0
- package/dist/config/constants.js +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/cdn.d.ts +24 -0
- package/dist/interfaces/cdn.js +5 -0
- package/dist/interfaces/compile.d.ts +1 -0
- package/dist/interfaces/custom.data.d.ts +3 -3
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/mcp.d.ts +64 -0
- package/dist/interfaces/mcp.js +5 -0
- package/dist/types/api-contracts.d.ts +36 -14
- package/dist/types/compile.types.d.ts +5 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +3 -1
- package/dist/types/skill.d.ts +120 -13
- package/dist/types/skill.js +95 -5
- package/dist/utils/bundling.d.ts +4 -11
- package/dist/utils/bundling.js +19 -27
- package/dist/utils/compile.d.ts +17 -8
- package/dist/utils/compile.js +71 -37
- package/dist/utils/deployment.js +13 -6
- package/dist/utils/dev-api.js +1 -2
- package/dist/utils/dev-server.js +1 -1
- package/dist/utils/files.d.ts +8 -1
- package/dist/utils/files.js +13 -2
- package/dist/utils/init-helpers.d.ts +3 -1
- package/dist/utils/init-helpers.js +7 -2
- package/dist/utils/mcp-server-management.d.ts +23 -0
- package/dist/utils/mcp-server-management.js +212 -0
- package/dist/utils/sandbox.d.ts +4 -2
- package/dist/utils/sandbox.js +22 -3
- package/dist/web/app.css +1505 -14
- package/dist/web/app.js +79 -64
- package/package.json +2 -6
- package/template/QUICKSTART.md +57 -761
- package/template/README.md +80 -906
- package/template/examples/README.md +106 -0
- package/template/{src → examples}/jobs/AbandonedBasketProcessorJob.ts +67 -11
- package/template/{src → examples}/postprocessors/modifyResponse.ts +3 -3
- package/template/{src → examples}/skills/tools/GameScoreTrackerTool.ts +11 -15
- package/template/{src → examples}/skills/tools/OrderTool.ts +25 -0
- package/template/examples/skills/tools/PremiumFeatureTool.ts +98 -0
- package/template/{src → examples}/skills/tools/UserDataTool.ts +34 -0
- package/template/examples/webhooks/FileUploadWebhook.ts +86 -0
- package/template/package-lock.json +7895 -0
- package/template/package.json +1 -1
- package/template/src/index.ts +40 -22
- /package/template/{src → examples}/jobs/DailyCleanupJob.ts +0 -0
- /package/template/{src → examples}/jobs/DataMigrationJob.ts +0 -0
- /package/template/{src → examples}/jobs/HealthCheckJob.ts +0 -0
- /package/template/{src → examples}/preprocessors/messageMatching.ts +0 -0
- /package/template/{src → examples}/services/ApiService.ts +0 -0
- /package/template/{src → examples}/services/GetWeather.ts +0 -0
- /package/template/{src → examples}/skills/basket.skill.ts +0 -0
- /package/template/{src → examples}/skills/product.skill.ts +0 -0
- /package/template/{src → examples}/skills/tools/BasketTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/CreateInlineJob.ts +0 -0
- /package/template/{src → examples}/skills/tools/CreatePostTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/CustomDataTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/GetWeatherTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/PaymentTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/ProductsTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/SmartBasketTool.ts +0 -0
- /package/template/{src → examples}/skills/user.skill.ts +0 -0
- /package/template/{src → examples}/webhooks/PaymentWebhook.ts +0 -0
- /package/template/{src → examples}/webhooks/UserEventWebhook.ts +0 -0
package/template/README.md
CHANGED
|
@@ -1,967 +1,141 @@
|
|
|
1
|
-
# 🤖 Lua AI Agent
|
|
1
|
+
# 🤖 Lua AI Agent
|
|
2
2
|
|
|
3
|
-
Welcome to your Lua AI Agent! This is a
|
|
4
|
-
|
|
5
|
-
## 🎯 What You've Got
|
|
6
|
-
|
|
7
|
-
This template includes **everything you need** to create a production-ready AI agent:
|
|
8
|
-
|
|
9
|
-
- ✅ **LuaAgent Configuration** - Unified agent setup with persona and welcome message
|
|
10
|
-
- ✅ **Example Skills & Tools** - 30+ pre-built tools demonstrating best practices
|
|
11
|
-
- ✅ **Webhooks** - HTTP endpoints for external integrations
|
|
12
|
-
- ✅ **Scheduled Jobs** - Automated background tasks
|
|
13
|
-
- ✅ **Message Processors** - Pre/post-process conversations
|
|
14
|
-
- ✅ **Type Safety** - Full TypeScript support with Zod validation
|
|
15
|
-
- ✅ **Testing Suite** - Local testing before deployment
|
|
16
|
-
- ✅ **CI/CD Ready** - Batch deployment commands
|
|
17
|
-
|
|
18
|
-
---
|
|
3
|
+
Welcome to your Lua AI Agent! This is a minimal project ready for you to build your custom agent.
|
|
19
4
|
|
|
20
5
|
## 🚀 Quick Start
|
|
21
6
|
|
|
22
|
-
**New to Lua?** Start here:
|
|
23
|
-
|
|
24
7
|
```bash
|
|
25
|
-
# 1. Test your
|
|
26
|
-
lua test
|
|
27
|
-
|
|
28
|
-
# 2. Chat with your agent (sandbox mode)
|
|
8
|
+
# 1. Test your agent (sandbox mode)
|
|
29
9
|
lua chat
|
|
30
10
|
|
|
11
|
+
# 2. Create your first tool
|
|
12
|
+
# See "Creating Your First Tool" below
|
|
13
|
+
|
|
31
14
|
# 3. Deploy to production
|
|
32
15
|
lua push all --force --auto-deploy
|
|
33
16
|
```
|
|
34
17
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## 📦 What's Inside
|
|
40
|
-
|
|
41
|
-
### Core Files
|
|
42
|
-
|
|
43
|
-
| File | Purpose |
|
|
44
|
-
|------|---------|
|
|
45
|
-
| `src/index.ts` | **Main file** - LuaAgent configuration |
|
|
46
|
-
| `lua.skill.yaml` | Agent metadata and component registry |
|
|
47
|
-
| `.env` | Environment variables (API keys, secrets) |
|
|
48
|
-
|
|
49
|
-
### Directory Structure
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
src/
|
|
53
|
-
├── index.ts # 🎯 LuaAgent - Your agent's configuration
|
|
54
|
-
├── skills/ # Tools grouped by functionality
|
|
55
|
-
│ ├── tools/ # Individual tool implementations
|
|
56
|
-
│ │ ├── GetWeatherTool.ts # Example: External API integration
|
|
57
|
-
│ │ ├── ProductsTool.ts # Example: CRUD operations
|
|
58
|
-
│ │ ├── BasketTool.ts # Example: Shopping cart
|
|
59
|
-
│ │ └── SmartBasketTool.ts # Example: Complex tool with state
|
|
60
|
-
│ ├── product.skill.ts # Skill that groups product tools
|
|
61
|
-
│ └── basket.skill.ts # Skill that groups basket tools
|
|
62
|
-
├── webhooks/ # HTTP endpoints
|
|
63
|
-
│ ├── PaymentWebhook.ts # Example: Payment notifications
|
|
64
|
-
│ └── UserEventWebhook.ts # Example: External events
|
|
65
|
-
├── jobs/ # Scheduled tasks
|
|
66
|
-
│ ├── DailyCleanupJob.ts # Example: Recurring cleanup
|
|
67
|
-
│ └── HealthCheckJob.ts # Example: Monitoring job
|
|
68
|
-
├── preprocessors/ # Before-message processing
|
|
69
|
-
│ └── messageMatching.ts # Example: Route messages
|
|
70
|
-
└── postprocessors/ # After-response processing
|
|
71
|
-
└── modifyResponse.ts # Example: Format responses
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## 🤖 Your Agent at a Glance
|
|
77
|
-
|
|
78
|
-
Your agent is configured in `src/index.ts`:
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
export const agent = new LuaAgent({
|
|
82
|
-
name: 'your-agent-name',
|
|
83
|
-
persona: 'Your agent personality and behavior...',
|
|
84
|
-
|
|
85
|
-
skills: [
|
|
86
|
-
generalSkill, // Weather, posts, utils
|
|
87
|
-
userSkill, // User data management
|
|
88
|
-
productSkill, // Product operations
|
|
89
|
-
basketSkill, // Shopping cart
|
|
90
|
-
orderSkill, // Order processing
|
|
91
|
-
customDataSkill, // Custom data storage
|
|
92
|
-
paymentSkill // Payment processing
|
|
93
|
-
],
|
|
94
|
-
|
|
95
|
-
webhooks: [
|
|
96
|
-
// paymentWebhook, // Uncomment to enable
|
|
97
|
-
],
|
|
98
|
-
|
|
99
|
-
jobs: [
|
|
100
|
-
// dailyCleanupJob, // Uncomment to enable
|
|
101
|
-
],
|
|
102
|
-
|
|
103
|
-
preProcessors: [
|
|
104
|
-
// messageMatchingProcessor, // Uncomment to enable
|
|
105
|
-
],
|
|
106
|
-
|
|
107
|
-
postProcessors: [
|
|
108
|
-
// responseModifierProcessor, // Uncomment to enable
|
|
109
|
-
]
|
|
110
|
-
});
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## 🛠️ Example Tools Included
|
|
116
|
-
|
|
117
|
-
### General Purpose
|
|
118
|
-
- **get_weather** - Fetch weather data from external API
|
|
119
|
-
- **create_post** - Create posts with external service
|
|
120
|
-
- **create_inline_job** - Demonstrates dynamic job creation
|
|
121
|
-
|
|
122
|
-
### User Management
|
|
123
|
-
- **get_user_data** - Retrieve user information
|
|
124
|
-
- **update_user_data** - Update user profiles
|
|
125
|
-
|
|
126
|
-
### E-commerce
|
|
127
|
-
- **search_products** - Search product catalog
|
|
128
|
-
- **create_product** - Add new products
|
|
129
|
-
- **update_product** - Modify existing products
|
|
130
|
-
- **delete_product** - Remove products
|
|
131
|
-
- **create_basket** - Create shopping cart
|
|
132
|
-
- **add_item_to_basket** - Add products to cart
|
|
133
|
-
- **checkout_basket** - Complete purchase
|
|
134
|
-
- **create_order** - Place orders
|
|
135
|
-
- **update_order_status** - Track order progress
|
|
136
|
-
|
|
137
|
-
### Advanced Examples
|
|
138
|
-
- **smart_basket_tool** - Complex state management with AI-powered recommendations
|
|
139
|
-
- **game_score_tracker** - Multi-player game tracking with leaderboards
|
|
140
|
-
- **create_payment_link** - Stripe integration for payments
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
## 🎓 Learning Path
|
|
145
|
-
|
|
146
|
-
### Beginner
|
|
147
|
-
1. ✅ Read [QUICKSTART.md](QUICKSTART.md)
|
|
148
|
-
2. ✅ Run `lua test` to try existing tools
|
|
149
|
-
3. ✅ Run `lua chat` to interact with your agent
|
|
150
|
-
4. ✅ Modify the agent persona in `src/index.ts`
|
|
151
|
-
|
|
152
|
-
### Intermediate
|
|
153
|
-
1. ✅ Create your first custom tool
|
|
154
|
-
2. ✅ Group tools into a skill
|
|
155
|
-
3. ✅ Add the skill to your LuaAgent
|
|
156
|
-
4. ✅ Test and deploy with `lua push`
|
|
157
|
-
|
|
158
|
-
### Advanced
|
|
159
|
-
1. ✅ Create webhooks for external integrations
|
|
160
|
-
2. ✅ Schedule jobs for automated tasks
|
|
161
|
-
3. ✅ Add preprocessors to route/filter messages
|
|
162
|
-
4. ✅ Use postprocessors to format responses
|
|
163
|
-
5. ✅ Implement complex tools with external APIs
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## 🔑 Key Features
|
|
168
|
-
|
|
169
|
-
### Intelligent Tools
|
|
170
|
-
Your agent can use tools to accomplish tasks:
|
|
171
|
-
```typescript
|
|
172
|
-
// User: "What's the weather in Tokyo?"
|
|
173
|
-
// Agent uses: get_weather tool
|
|
174
|
-
// Response: "It's 72°F and sunny in Tokyo"
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### External Integrations
|
|
178
|
-
Connect to any API:
|
|
179
|
-
```typescript
|
|
180
|
-
// Stripe, OpenAI, Pinecone, custom APIs
|
|
181
|
-
const result = await axios.post(API_URL, data);
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### User Context
|
|
185
|
-
Access user data in every tool:
|
|
186
|
-
```typescript
|
|
187
|
-
const user = await User.get();
|
|
188
|
-
const preferences = user.preferences;
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Persistent Storage
|
|
192
|
-
Store data across conversations:
|
|
193
|
-
```typescript
|
|
194
|
-
await Data.create('notes', {
|
|
195
|
-
title: "Meeting Notes",
|
|
196
|
-
content: "..."
|
|
197
|
-
});
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### Scheduled Automation
|
|
201
|
-
Run tasks on a schedule:
|
|
202
|
-
```typescript
|
|
203
|
-
// Every day at 9 AM
|
|
204
|
-
schedule: {
|
|
205
|
-
type: "cron",
|
|
206
|
-
pattern: "0 9 * * *"
|
|
207
|
-
}
|
|
208
|
-
```
|
|
18
|
+
## 📁 Project Structure
|
|
209
19
|
|
|
210
|
-
### Real-time Events
|
|
211
|
-
Receive HTTP webhooks:
|
|
212
|
-
```typescript
|
|
213
|
-
// POST /webhook/{webhookId}
|
|
214
|
-
// Process payment confirmations, order updates, etc.
|
|
215
20
|
```
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
graph LR
|
|
223
|
-
A[Write Code] --> B[lua test]
|
|
224
|
-
B --> C[lua chat sandbox]
|
|
225
|
-
C --> D{Works?}
|
|
226
|
-
D -->|No| A
|
|
227
|
-
D -->|Yes| E[lua compile]
|
|
228
|
-
E --> F[lua push]
|
|
229
|
-
F --> G[lua chat production]
|
|
230
|
-
G --> H{Deploy?}
|
|
231
|
-
H -->|Yes| I[lua deploy]
|
|
232
|
-
H -->|No| A
|
|
21
|
+
your-project/
|
|
22
|
+
├── src/
|
|
23
|
+
│ └── index.ts # Your agent configuration
|
|
24
|
+
├── lua.skill.yaml # Agent metadata (auto-managed)
|
|
25
|
+
├── package.json # Dependencies
|
|
26
|
+
└── tsconfig.json # TypeScript config
|
|
233
27
|
```
|
|
234
28
|
|
|
235
|
-
|
|
29
|
+
## 🛠️ Creating Your First Tool
|
|
236
30
|
|
|
237
|
-
|
|
238
|
-
|---------|---------|-------------|
|
|
239
|
-
| `lua test` | Test individual tools | During development |
|
|
240
|
-
| `lua chat` | Interactive testing | Validate tool interactions |
|
|
241
|
-
| `lua compile` | Bundle your code | Before pushing |
|
|
242
|
-
| `lua push` | Upload to server | Ready to deploy |
|
|
243
|
-
| `lua deploy` | Publish to production | Make live for users |
|
|
244
|
-
| `lua push all --force` | Batch push all | CI/CD pipelines |
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## 🔒 Environment Variables
|
|
249
|
-
|
|
250
|
-
Store sensitive data in `.env`:
|
|
31
|
+
### 1. Create the tool file
|
|
251
32
|
|
|
252
33
|
```bash
|
|
253
|
-
|
|
254
|
-
cp env.example .env
|
|
255
|
-
|
|
256
|
-
# Add your API keys
|
|
257
|
-
OPENAI_API_KEY=sk-...
|
|
258
|
-
STRIPE_SECRET_KEY=sk_live_...
|
|
259
|
-
PINECONE_API_KEY=...
|
|
260
|
-
|
|
261
|
-
# Optional: For CI/CD
|
|
262
|
-
LUA_API_KEY=your-lua-api-key
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
**Priority:**
|
|
266
|
-
1. System keychain (most secure)
|
|
267
|
-
2. `LUA_API_KEY` environment variable
|
|
268
|
-
3. `.env` file
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## 🎨 Customization Guide
|
|
273
|
-
|
|
274
|
-
### 1. Update Agent Identity
|
|
275
|
-
|
|
276
|
-
Edit `src/index.ts`:
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
export const agent = new LuaAgent({
|
|
280
|
-
name: 'my-customer-support-bot', // ✏️ Change this
|
|
281
|
-
|
|
282
|
-
persona: `You are Sarah, a friendly customer support agent...`, // ✏️ Customize
|
|
283
|
-
|
|
284
|
-
// ...
|
|
285
|
-
});
|
|
34
|
+
mkdir -p src/skills/tools
|
|
286
35
|
```
|
|
287
36
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
Create `src/skills/tools/MyTool.ts`:
|
|
37
|
+
Create `src/skills/tools/GreetingTool.ts`:
|
|
291
38
|
|
|
292
39
|
```typescript
|
|
293
|
-
import { LuaTool } from "lua-cli
|
|
40
|
+
import { LuaTool } from "lua-cli";
|
|
294
41
|
import { z } from "zod";
|
|
295
42
|
|
|
296
|
-
export default class
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
43
|
+
export default class GreetingTool implements LuaTool {
|
|
44
|
+
name = "greet_user";
|
|
45
|
+
description = "Generate a personalized greeting";
|
|
46
|
+
|
|
47
|
+
inputSchema = z.object({
|
|
48
|
+
name: z.string().describe("The name of the person to greet")
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
52
|
+
return {
|
|
53
|
+
greeting: `Hello, ${input.name}! How can I help you today?`
|
|
54
|
+
};
|
|
55
|
+
}
|
|
308
56
|
}
|
|
309
57
|
```
|
|
310
58
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
```typescript
|
|
314
|
-
import MyTool from './skills/tools/MyTool';
|
|
315
|
-
|
|
316
|
-
const mySkill = new LuaSkill({
|
|
317
|
-
name: 'my-skill',
|
|
318
|
-
description: 'My custom skill',
|
|
319
|
-
context: 'Use these tools for...',
|
|
320
|
-
tools: [new MyTool()]
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
export const agent = new LuaAgent({
|
|
324
|
-
// ...
|
|
325
|
-
skills: [...existingSkills, mySkill],
|
|
326
|
-
});
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### 3. Configure Webhooks
|
|
59
|
+
### 2. Create a skill to group your tools
|
|
330
60
|
|
|
331
|
-
|
|
61
|
+
Create `src/skills/greeting.skill.ts`:
|
|
332
62
|
|
|
333
63
|
```typescript
|
|
334
|
-
import
|
|
64
|
+
import { LuaSkill } from "lua-cli";
|
|
65
|
+
import GreetingTool from "./tools/GreetingTool";
|
|
335
66
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
67
|
+
const greetingSkill = new LuaSkill({
|
|
68
|
+
name: "greeting-skill",
|
|
69
|
+
description: "Tools for greeting users",
|
|
70
|
+
context: "Use these tools when the user wants to be greeted",
|
|
71
|
+
tools: [new GreetingTool()],
|
|
339
72
|
});
|
|
340
|
-
```
|
|
341
73
|
|
|
342
|
-
|
|
343
|
-
```
|
|
344
|
-
https://webhook.heylua.ai/{agentId}/{webhookId} // default
|
|
345
|
-
https://webhook.heylua.ai/{agentId}/{webhook-name} // friendly alias
|
|
74
|
+
export default greetingSkill;
|
|
346
75
|
```
|
|
347
76
|
|
|
348
|
-
###
|
|
77
|
+
### 3. Add the skill to your agent
|
|
349
78
|
|
|
350
|
-
|
|
79
|
+
Update `src/index.ts`:
|
|
351
80
|
|
|
352
81
|
```typescript
|
|
353
|
-
import
|
|
82
|
+
import { LuaAgent } from "lua-cli";
|
|
83
|
+
import greetingSkill from "./skills/greeting.skill";
|
|
354
84
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
85
|
+
const agent = new LuaAgent({
|
|
86
|
+
name: `My Agent`,
|
|
87
|
+
persona: `You are a friendly assistant.`,
|
|
88
|
+
skills: [greetingSkill],
|
|
358
89
|
});
|
|
359
90
|
```
|
|
360
91
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
## 📚 Documentation
|
|
364
|
-
|
|
365
|
-
### Comprehensive Guides
|
|
366
|
-
- **[Quick Start Guide](QUICKSTART.md)** - Step-by-step tutorial
|
|
367
|
-
- **[Example Skills](src/skills/)** - Browse working examples
|
|
368
|
-
- **[Example Webhooks](src/webhooks/)** - Webhook patterns
|
|
369
|
-
- **[Example Jobs](src/jobs/)** - Job scheduling examples
|
|
370
|
-
|
|
371
|
-
### Official Documentation
|
|
372
|
-
- **Lua Docs:** https://docs.heylua.ai
|
|
373
|
-
- **CLI Reference:** https://github.com/heylua/lua-cli
|
|
374
|
-
- **Community:** https://community.heylua.ai
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
## 🧪 Testing Strategy
|
|
379
|
-
|
|
380
|
-
### Local Testing (Recommended)
|
|
381
|
-
|
|
382
|
-
```bash
|
|
383
|
-
# Test individual tools
|
|
384
|
-
lua test
|
|
385
|
-
|
|
386
|
-
# Interactive chat testing
|
|
387
|
-
lua chat
|
|
388
|
-
# Select: Sandbox
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
**Why sandbox?**
|
|
392
|
-
- ✅ Uses your local code (not deployed)
|
|
393
|
-
- ✅ Safe for experimentation
|
|
394
|
-
- ✅ Instant feedback
|
|
395
|
-
- ✅ No production impact
|
|
396
|
-
|
|
397
|
-
### Production Testing
|
|
398
|
-
|
|
399
|
-
```bash
|
|
400
|
-
lua chat
|
|
401
|
-
# Select: Production
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
**When to use:**
|
|
405
|
-
- ✅ After deploying
|
|
406
|
-
- ✅ Validate production behavior
|
|
407
|
-
- ✅ Test with real data
|
|
408
|
-
|
|
409
|
-
---
|
|
410
|
-
|
|
411
|
-
## 🚀 Deployment Options
|
|
412
|
-
|
|
413
|
-
### Option 1: Interactive (Recommended for First Time)
|
|
414
|
-
|
|
415
|
-
```bash
|
|
416
|
-
lua push
|
|
417
|
-
# Select component type
|
|
418
|
-
# Confirm version
|
|
419
|
-
# Choose whether to deploy
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
**Best for:**
|
|
423
|
-
- Learning the deployment process
|
|
424
|
-
- Reviewing changes before deploying
|
|
425
|
-
- Fine-grained control
|
|
426
|
-
|
|
427
|
-
### Option 2: Batch Deployment (CI/CD)
|
|
92
|
+
### 4. Test it!
|
|
428
93
|
|
|
429
94
|
```bash
|
|
430
|
-
lua
|
|
95
|
+
lua test # Test the tool directly
|
|
96
|
+
lua chat # Chat with your agent
|
|
431
97
|
```
|
|
432
98
|
|
|
433
|
-
|
|
434
|
-
1. Compiles all code
|
|
435
|
-
2. Auto-bumps patch versions
|
|
436
|
-
3. Pushes all skills, webhooks, jobs, processors
|
|
437
|
-
4. Deploys everything to production
|
|
438
|
-
|
|
439
|
-
**Best for:**
|
|
440
|
-
- CI/CD pipelines
|
|
441
|
-
- Batch updates
|
|
442
|
-
- Production deployments
|
|
99
|
+
## 📖 Essential Commands
|
|
443
100
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
- ✅ Use TypeScript for better error catching
|
|
453
|
-
|
|
454
|
-
### Tools
|
|
455
|
-
- ✅ Validate all inputs with Zod schemas
|
|
456
|
-
- ✅ Return structured objects (not just strings)
|
|
457
|
-
- ✅ Handle errors gracefully
|
|
458
|
-
- ✅ Use descriptive names and descriptions (the AI reads these!)
|
|
459
|
-
|
|
460
|
-
### Jobs
|
|
461
|
-
- ✅ Always pass data via `metadata` field
|
|
462
|
-
- ✅ Make execute functions self-contained
|
|
463
|
-
- ✅ Use appropriate schedule types (once, cron, interval)
|
|
464
|
-
- ✅ Test job logic in regular tools first
|
|
465
|
-
|
|
466
|
-
### Webhooks
|
|
467
|
-
- ✅ Validate signatures in production
|
|
468
|
-
- ✅ Return proper HTTP status codes
|
|
469
|
-
- ✅ Handle retries and idempotency
|
|
470
|
-
- ✅ Test with tools like Postman first
|
|
471
|
-
|
|
472
|
-
### Agent Persona
|
|
473
|
-
- ✅ Be specific about personality and tone
|
|
474
|
-
- ✅ Define what the agent can/cannot do
|
|
475
|
-
- ✅ Give examples of good responses
|
|
476
|
-
- ✅ Update based on user feedback
|
|
101
|
+
| Command | Purpose |
|
|
102
|
+
|---------|---------|
|
|
103
|
+
| `lua test` | Test individual tools interactively |
|
|
104
|
+
| `lua chat` | Interactive chat with your agent |
|
|
105
|
+
| `lua compile` | Compile your code |
|
|
106
|
+
| `lua push` | Upload to server |
|
|
107
|
+
| `lua deploy` | Deploy to production |
|
|
108
|
+
| `lua logs` | View execution logs |
|
|
477
109
|
|
|
478
|
-
|
|
110
|
+
## 🎯 Want Examples?
|
|
479
111
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
### When You Make Changes
|
|
112
|
+
Initialize a new project with example code:
|
|
483
113
|
|
|
484
114
|
```bash
|
|
485
|
-
|
|
486
|
-
lua
|
|
487
|
-
|
|
488
|
-
# 2. Compile
|
|
489
|
-
lua compile
|
|
490
|
-
|
|
491
|
-
# 3. Push new version
|
|
492
|
-
lua push
|
|
493
|
-
|
|
494
|
-
# 4. Deploy when ready
|
|
495
|
-
lua deploy
|
|
496
|
-
```
|
|
497
|
-
|
|
498
|
-
### Sync Your Configuration
|
|
499
|
-
|
|
500
|
-
The CLI automatically keeps your `lua.skill.yaml` and `LuaAgent` in sync:
|
|
501
|
-
|
|
502
|
-
- **Run `lua init`** → Syncs agent name and persona to both files
|
|
503
|
-
- **Run `lua compile`** → Syncs LuaAgent changes back to YAML
|
|
504
|
-
- **Manual edit YAML** → Re-run `lua compile` to rebuild
|
|
505
|
-
|
|
506
|
-
---
|
|
507
|
-
|
|
508
|
-
## 🎨 Example Use Cases
|
|
509
|
-
|
|
510
|
-
### Customer Support Agent
|
|
511
|
-
```typescript
|
|
512
|
-
persona: `You are Alex, a patient and knowledgeable customer support agent.
|
|
513
|
-
You help customers with orders, returns, and product questions.
|
|
514
|
-
Always be empathetic and solution-oriented.`
|
|
515
|
-
|
|
516
|
-
skills: [productSkill, orderSkill, basketSkill]
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
### E-commerce Assistant
|
|
520
|
-
```typescript
|
|
521
|
-
persona: `You are Sophia, an enthusiastic shopping assistant.
|
|
522
|
-
You help customers find products, make recommendations, and complete purchases.
|
|
523
|
-
Use a friendly, upbeat tone and be proactive with suggestions.`
|
|
524
|
-
|
|
525
|
-
skills: [productSkill, basketSkill, paymentSkill]
|
|
115
|
+
mkdir my-project-with-examples && cd my-project-with-examples
|
|
116
|
+
lua init --with-examples
|
|
526
117
|
```
|
|
527
118
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
skills: [customDataSkill, analyticsSkill, reportSkill]
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
---
|
|
538
|
-
|
|
539
|
-
## 🔐 Security Best Practices
|
|
119
|
+
This includes:
|
|
120
|
+
- ✅ 30+ example tools
|
|
121
|
+
- ✅ Example webhooks (HTTP endpoints)
|
|
122
|
+
- ✅ Example scheduled jobs
|
|
123
|
+
- ✅ Example pre/post processors
|
|
124
|
+
- ✅ Working e-commerce flow (products, baskets, orders)
|
|
540
125
|
|
|
541
|
-
|
|
542
|
-
- ✅ Never commit `.env` file to version control
|
|
543
|
-
- ✅ Use `.env.example` as a template
|
|
544
|
-
- ✅ Rotate API keys regularly
|
|
545
|
-
- ✅ Use environment-specific keys (sandbox vs production)
|
|
126
|
+
## 📚 Learn More
|
|
546
127
|
|
|
547
|
-
### Webhooks
|
|
548
|
-
- ✅ Validate webhook signatures in production
|
|
549
|
-
- ✅ Use HTTPS endpoints only
|
|
550
|
-
- ✅ Rate limit webhook handlers
|
|
551
|
-
- ✅ Log all webhook events
|
|
552
|
-
|
|
553
|
-
### User Data
|
|
554
|
-
- ✅ Only store necessary data
|
|
555
|
-
- ✅ Encrypt sensitive information
|
|
556
|
-
- ✅ Respect user privacy preferences
|
|
557
|
-
- ✅ Implement data deletion on request
|
|
558
|
-
|
|
559
|
-
---
|
|
560
|
-
|
|
561
|
-
## 🐛 Troubleshooting
|
|
562
|
-
|
|
563
|
-
### Common Issues
|
|
564
|
-
|
|
565
|
-
**"Tool not found by agent"**
|
|
566
|
-
```bash
|
|
567
|
-
# Make sure tool is in a skill, skill is in LuaAgent
|
|
568
|
-
lua compile # Rebuilds everything
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
**"Cannot find module '../services/ApiService'"**
|
|
572
|
-
```bash
|
|
573
|
-
# Make sure all dependencies are installed
|
|
574
|
-
npm install
|
|
575
|
-
```
|
|
576
|
-
|
|
577
|
-
**"Job execute function: ReferenceError: input is not defined"**
|
|
578
|
-
```typescript
|
|
579
|
-
// ❌ Wrong: Accessing parent scope
|
|
580
|
-
execute: async (job) => {
|
|
581
|
-
const message = input.message; // Error!
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
// ✅ Correct: Use metadata
|
|
585
|
-
metadata: { message: input.message },
|
|
586
|
-
execute: async (job) => {
|
|
587
|
-
const message = job.metadata.message; // Works!
|
|
588
|
-
}
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
**"Version not found when deploying"**
|
|
592
|
-
```bash
|
|
593
|
-
# Server needs time to process. Wait 10 seconds, then:
|
|
594
|
-
lua deploy
|
|
595
|
-
```
|
|
596
|
-
|
|
597
|
-
---
|
|
598
|
-
|
|
599
|
-
## 📈 Scaling Your Agent
|
|
600
|
-
|
|
601
|
-
### Add More Skills
|
|
602
|
-
|
|
603
|
-
As your agent grows, organize tools into skills:
|
|
604
|
-
|
|
605
|
-
```typescript
|
|
606
|
-
// src/skills/analytics.skill.ts
|
|
607
|
-
export const analyticsSkill = new LuaSkill({
|
|
608
|
-
name: 'analytics-skill',
|
|
609
|
-
description: 'Data analytics and reporting',
|
|
610
|
-
context: 'Use these tools for data analysis',
|
|
611
|
-
tools: [
|
|
612
|
-
new GenerateReportTool(),
|
|
613
|
-
new ExportDataTool(),
|
|
614
|
-
new VisualizeTool()
|
|
615
|
-
]
|
|
616
|
-
});
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
### Add Background Processing
|
|
620
|
-
|
|
621
|
-
Use jobs for heavy or scheduled work:
|
|
622
|
-
|
|
623
|
-
```typescript
|
|
624
|
-
// Instead of making users wait
|
|
625
|
-
// Create a job that processes in background
|
|
626
|
-
const job = await Jobs.create({
|
|
627
|
-
name: 'process-large-file',
|
|
628
|
-
metadata: { fileId: input.fileId },
|
|
629
|
-
schedule: { type: "once", executeAt: new Date() },
|
|
630
|
-
execute: async (job) => {
|
|
631
|
-
// Process file
|
|
632
|
-
// Notify user when done
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
```
|
|
636
|
-
|
|
637
|
-
### Add External Integrations
|
|
638
|
-
|
|
639
|
-
Use webhooks to receive events:
|
|
640
|
-
|
|
641
|
-
```typescript
|
|
642
|
-
// Receive events from Stripe, Shopify, etc.
|
|
643
|
-
export default new LuaWebhook({
|
|
644
|
-
name: "shopify-order",
|
|
645
|
-
execute: async (event) => {
|
|
646
|
-
const { body } = event;
|
|
647
|
-
// Process Shopify order
|
|
648
|
-
// Update your system
|
|
649
|
-
// Notify customer
|
|
650
|
-
}
|
|
651
|
-
});
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
---
|
|
655
|
-
|
|
656
|
-
## 🔧 Advanced Configuration
|
|
657
|
-
|
|
658
|
-
### Multiple Environments
|
|
659
|
-
|
|
660
|
-
```bash
|
|
661
|
-
# Sandbox (testing)
|
|
662
|
-
lua chat # Select Sandbox
|
|
663
|
-
lua env sandbox
|
|
664
|
-
|
|
665
|
-
# Production (live users)
|
|
666
|
-
lua chat # Select Production
|
|
667
|
-
lua env production
|
|
668
|
-
```
|
|
669
|
-
|
|
670
|
-
### Skill Overrides
|
|
671
|
-
|
|
672
|
-
Test specific skill versions without deploying:
|
|
673
|
-
|
|
674
|
-
```typescript
|
|
675
|
-
// In sandbox mode, test development versions
|
|
676
|
-
// Production uses deployed versions
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
### Processor Chains
|
|
680
|
-
|
|
681
|
-
Process messages in order:
|
|
682
|
-
|
|
683
|
-
```typescript
|
|
684
|
-
preProcessors: [
|
|
685
|
-
profanityFilter, // 1. Clean input
|
|
686
|
-
intentClassifier, // 2. Detect intent
|
|
687
|
-
messageRouter // 3. Route to handler
|
|
688
|
-
]
|
|
689
|
-
|
|
690
|
-
postProcessors: [
|
|
691
|
-
responseFormatter, // 1. Format output
|
|
692
|
-
addDisclaimer, // 2. Add legal text
|
|
693
|
-
translateResponse // 3. Translate if needed
|
|
694
|
-
]
|
|
695
|
-
```
|
|
696
|
-
|
|
697
|
-
---
|
|
698
|
-
|
|
699
|
-
## 📊 Monitoring & Management
|
|
700
|
-
|
|
701
|
-
### View Production Status
|
|
702
|
-
|
|
703
|
-
```bash
|
|
704
|
-
lua production
|
|
705
|
-
```
|
|
706
|
-
|
|
707
|
-
Shows:
|
|
708
|
-
- Active skills and versions
|
|
709
|
-
- Webhook URLs
|
|
710
|
-
- Scheduled jobs
|
|
711
|
-
- Environment variables
|
|
712
|
-
|
|
713
|
-
### View Logs
|
|
714
|
-
|
|
715
|
-
```bash
|
|
716
|
-
lua logs
|
|
717
|
-
```
|
|
718
|
-
|
|
719
|
-
Interactive filtering by primitive type:
|
|
720
|
-
- **Skills** - Filter by specific skill or view all skill logs
|
|
721
|
-
- **Jobs** - Filter by specific job (including dynamically created jobs) or view all job logs
|
|
722
|
-
- **Webhooks** - Filter by specific webhook or view all webhook logs
|
|
723
|
-
- **Preprocessors** - Filter by specific preprocessor or view all preprocessor logs
|
|
724
|
-
- **Postprocessors** - Filter by specific postprocessor or view all postprocessor logs
|
|
725
|
-
|
|
726
|
-
Each log entry displays:
|
|
727
|
-
- Primitive type, name, and ID
|
|
728
|
-
- Tool name (for skill-related logs)
|
|
729
|
-
- Timestamp and log level
|
|
730
|
-
- Full message content
|
|
731
|
-
|
|
732
|
-
See:
|
|
733
|
-
- Agent conversations
|
|
734
|
-
- Tool executions
|
|
735
|
-
- Errors and warnings
|
|
736
|
-
- Performance metrics
|
|
737
|
-
|
|
738
|
-
### Manage Skills
|
|
739
|
-
|
|
740
|
-
```bash
|
|
741
|
-
# List all skills
|
|
742
|
-
lua skills
|
|
743
|
-
|
|
744
|
-
# Push specific skill
|
|
745
|
-
lua push skill
|
|
746
|
-
|
|
747
|
-
# Deploy specific version
|
|
748
|
-
lua deploy
|
|
749
|
-
```
|
|
750
|
-
|
|
751
|
-
---
|
|
752
|
-
|
|
753
|
-
## 🌐 CI/CD Integration
|
|
754
|
-
|
|
755
|
-
### GitHub Actions Example
|
|
756
|
-
|
|
757
|
-
```yaml
|
|
758
|
-
# .github/workflows/deploy.yml
|
|
759
|
-
name: Deploy Lua Agent
|
|
760
|
-
|
|
761
|
-
on:
|
|
762
|
-
push:
|
|
763
|
-
branches: [main]
|
|
764
|
-
|
|
765
|
-
jobs:
|
|
766
|
-
deploy:
|
|
767
|
-
runs-on: ubuntu-latest
|
|
768
|
-
steps:
|
|
769
|
-
- uses: actions/checkout@v3
|
|
770
|
-
|
|
771
|
-
- name: Setup Node.js
|
|
772
|
-
uses: actions/setup-node@v3
|
|
773
|
-
with:
|
|
774
|
-
node-version: '20'
|
|
775
|
-
|
|
776
|
-
- name: Install dependencies
|
|
777
|
-
run: npm install
|
|
778
|
-
|
|
779
|
-
- name: Install Lua CLI
|
|
780
|
-
run: npm install -g lua-cli@alpha
|
|
781
|
-
|
|
782
|
-
- name: Deploy to production
|
|
783
|
-
run: lua push all --force --auto-deploy
|
|
784
|
-
env:
|
|
785
|
-
LUA_API_KEY: ${{ secrets.LUA_API_KEY }}
|
|
786
|
-
```
|
|
787
|
-
|
|
788
|
-
### GitLab CI Example
|
|
789
|
-
|
|
790
|
-
```yaml
|
|
791
|
-
# .gitlab-ci.yml
|
|
792
|
-
deploy:
|
|
793
|
-
stage: deploy
|
|
794
|
-
image: node:20
|
|
795
|
-
script:
|
|
796
|
-
- npm install
|
|
797
|
-
- npm install -g lua-cli@alpha
|
|
798
|
-
- lua push all --force --auto-deploy
|
|
799
|
-
only:
|
|
800
|
-
- main
|
|
801
|
-
variables:
|
|
802
|
-
LUA_API_KEY: $LUA_API_KEY
|
|
803
|
-
```
|
|
804
|
-
|
|
805
|
-
---
|
|
806
|
-
|
|
807
|
-
## 🤝 Contributing
|
|
808
|
-
|
|
809
|
-
### Adding Examples
|
|
810
|
-
|
|
811
|
-
Have a great tool example? Add it to the template:
|
|
812
|
-
|
|
813
|
-
1. Create the tool in `src/skills/tools/`
|
|
814
|
-
2. Add it to a skill
|
|
815
|
-
3. Test thoroughly
|
|
816
|
-
4. Document the use case
|
|
817
|
-
|
|
818
|
-
### Reporting Issues
|
|
819
|
-
|
|
820
|
-
Found a bug or have a suggestion?
|
|
821
|
-
|
|
822
|
-
- GitHub Issues: https://github.com/heylua/lua-cli/issues
|
|
823
|
-
- Email: support@heylua.ai
|
|
824
|
-
|
|
825
|
-
---
|
|
826
|
-
|
|
827
|
-
## 📝 Important Notes
|
|
828
|
-
|
|
829
|
-
### About Jobs and Closures
|
|
830
|
-
|
|
831
|
-
⚠️ **Job execute functions must be self-contained**
|
|
832
|
-
|
|
833
|
-
```typescript
|
|
834
|
-
// ❌ This will NOT work:
|
|
835
|
-
async execute(input: any) {
|
|
836
|
-
const userMessage = input.message;
|
|
837
|
-
|
|
838
|
-
await Jobs.create({
|
|
839
|
-
execute: async (job) => {
|
|
840
|
-
// userMessage is undefined here!
|
|
841
|
-
await user.send(userMessage);
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
// ✅ This WILL work:
|
|
847
|
-
async execute(input: any) {
|
|
848
|
-
await Jobs.create({
|
|
849
|
-
metadata: { message: input.message }, // Pass via metadata
|
|
850
|
-
execute: async (job) => {
|
|
851
|
-
// Access from metadata
|
|
852
|
-
await job.user().send(job.metadata.message);
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
```
|
|
857
|
-
|
|
858
|
-
**Why?** Jobs are serialized and executed in a sandbox. They can't access parent scope variables.
|
|
859
|
-
|
|
860
|
-
### About Bundling
|
|
861
|
-
|
|
862
|
-
The CLI automatically:
|
|
863
|
-
- ✅ Bundles all tool code and dependencies
|
|
864
|
-
- ✅ Excludes lua-cli APIs (available in sandbox)
|
|
865
|
-
- ✅ Compresses code for transmission
|
|
866
|
-
- ✅ Handles imports and dependencies
|
|
867
|
-
|
|
868
|
-
You don't need to worry about bundling - it just works!
|
|
869
|
-
|
|
870
|
-
---
|
|
871
|
-
|
|
872
|
-
## 🎯 What's Next?
|
|
873
|
-
|
|
874
|
-
### Immediate Actions
|
|
875
|
-
1. ✅ Test the example tools: `lua test`
|
|
876
|
-
2. ✅ Chat with your agent: `lua chat` (select Sandbox)
|
|
877
|
-
3. ✅ Read the [Quick Start Guide](QUICKSTART.md)
|
|
878
|
-
4. ✅ Customize the agent persona in `src/index.ts`
|
|
879
|
-
|
|
880
|
-
### Short Term
|
|
881
|
-
1. ✅ Create your first custom tool
|
|
882
|
-
2. ✅ Deploy to production: `lua push`
|
|
883
|
-
3. ✅ Test in production: `lua chat` (select Production)
|
|
884
|
-
|
|
885
|
-
### Long Term
|
|
886
|
-
1. ✅ Add webhooks for external integrations
|
|
887
|
-
2. ✅ Schedule jobs for automated tasks
|
|
888
|
-
3. ✅ Build advanced tools with AI/external APIs
|
|
889
|
-
4. ✅ Monitor and improve based on user feedback
|
|
890
|
-
|
|
891
|
-
---
|
|
892
|
-
|
|
893
|
-
## 🌟 Example Projects
|
|
894
|
-
|
|
895
|
-
### Simple Assistant
|
|
896
|
-
- 3-5 basic tools
|
|
897
|
-
- No webhooks or jobs
|
|
898
|
-
- General Q&A and information retrieval
|
|
899
|
-
|
|
900
|
-
### E-commerce Bot
|
|
901
|
-
- Product catalog management
|
|
902
|
-
- Shopping cart tools
|
|
903
|
-
- Payment webhooks
|
|
904
|
-
- Abandoned cart jobs
|
|
905
|
-
|
|
906
|
-
### Support Agent
|
|
907
|
-
- Knowledge base search
|
|
908
|
-
- Ticket creation tools
|
|
909
|
-
- Escalation webhooks
|
|
910
|
-
- Daily summary jobs
|
|
911
|
-
|
|
912
|
-
### Data Platform
|
|
913
|
-
- Custom data tools
|
|
914
|
-
- Report generation
|
|
915
|
-
- Scheduled analytics jobs
|
|
916
|
-
- Webhook integrations
|
|
917
|
-
|
|
918
|
-
---
|
|
919
|
-
|
|
920
|
-
## 📞 Support & Resources
|
|
921
|
-
|
|
922
|
-
### Get Help
|
|
923
128
|
- **Documentation:** https://docs.heylua.ai
|
|
924
|
-
- **
|
|
925
|
-
- **
|
|
926
|
-
- **Community:** https://community.heylua.ai
|
|
927
|
-
|
|
928
|
-
### Stay Updated
|
|
929
|
-
```bash
|
|
930
|
-
# Check your version
|
|
931
|
-
lua --version
|
|
932
|
-
|
|
933
|
-
# Update to latest alpha
|
|
934
|
-
npm install -g lua-cli@alpha
|
|
935
|
-
```
|
|
936
|
-
|
|
937
|
-
---
|
|
129
|
+
- **Examples:** https://docs.heylua.ai/examples
|
|
130
|
+
- **API Reference:** https://docs.heylua.ai/api
|
|
938
131
|
|
|
939
|
-
##
|
|
132
|
+
## 💡 Tips
|
|
940
133
|
|
|
941
|
-
|
|
134
|
+
1. **Use Zod schemas** - They provide type safety and help the AI understand your tool inputs
|
|
135
|
+
2. **Write clear descriptions** - The AI reads these to decide when to use your tools
|
|
136
|
+
3. **Test in sandbox first** - Use `lua chat` with sandbox mode before deploying
|
|
137
|
+
4. **Keep tools focused** - Each tool should do one thing well
|
|
942
138
|
|
|
943
139
|
---
|
|
944
140
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
You're all set to build amazing AI agents with Lua!
|
|
948
|
-
|
|
949
|
-
**Remember:**
|
|
950
|
-
1. Start small - test one tool at a time
|
|
951
|
-
2. Use sandbox mode liberally
|
|
952
|
-
3. Read the example code - it's full of patterns
|
|
953
|
-
4. Deploy often - iterate quickly
|
|
954
|
-
|
|
955
|
-
**Need inspiration?** Check out the example tools in `src/skills/tools/` - they demonstrate:
|
|
956
|
-
- External API calls
|
|
957
|
-
- State management
|
|
958
|
-
- Error handling
|
|
959
|
-
- Complex business logic
|
|
960
|
-
- AI integrations
|
|
961
|
-
|
|
962
|
-
Build something awesome! 🚀
|
|
963
|
-
|
|
964
|
-
---
|
|
965
|
-
|
|
966
|
-
*Template version: 3.0.0 | Last updated: October 2025*
|
|
967
|
-
|
|
141
|
+
*Built with [Lua CLI](https://www.npmjs.com/package/lua-cli)*
|