@lakitu/sdk 0.1.1 → 0.1.2
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/LICENSE +21 -0
- package/README.md +295 -97
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lakitu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,14 +2,75 @@
|
|
|
2
2
|
<img src="assets/laki2-banner.jpeg" alt="Lakitu Banner" width="100%">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# @lakitu/sdk
|
|
6
6
|
|
|
7
|
-
> AI agent
|
|
7
|
+
> Self-hosted AI agent framework for [Convex](https://convex.dev) + [E2B](https://e2b.dev) with **code execution**.
|
|
8
8
|
|
|
9
|
-
Lakitu
|
|
9
|
+
Lakitu runs AI agents in secure E2B sandboxes where they write and execute TypeScript code. Instead of JSON tool calls, agents import from **KSAs** (Knowledge, Skills, and Abilities) — plain TypeScript modules.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# In your Convex project
|
|
15
|
+
npx @lakitu/sdk init
|
|
16
|
+
|
|
17
|
+
# Build your E2B sandbox template
|
|
18
|
+
npx @lakitu/sdk build
|
|
19
|
+
|
|
20
|
+
# Publish template to E2B
|
|
21
|
+
npx @lakitu/sdk publish
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @lakitu/sdk
|
|
28
|
+
# or
|
|
29
|
+
bun add @lakitu/sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## CLI Commands
|
|
33
|
+
|
|
34
|
+
### `npx @lakitu/sdk init`
|
|
35
|
+
|
|
36
|
+
Initialize Lakitu in your Convex project:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx @lakitu/sdk init
|
|
40
|
+
npx @lakitu/sdk init --dir ./convex # Custom convex directory
|
|
41
|
+
npx @lakitu/sdk init --skip-install # Skip npm install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This creates:
|
|
45
|
+
```
|
|
46
|
+
convex/
|
|
47
|
+
└── lakitu/
|
|
48
|
+
├── config.ts # Lakitu configuration
|
|
49
|
+
└── example.ts # Example KSA to get started
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `npx @lakitu/sdk build`
|
|
53
|
+
|
|
54
|
+
Build your E2B sandbox template with pre-deployed Convex functions:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx @lakitu/sdk build # Build both base + custom templates
|
|
58
|
+
npx @lakitu/sdk build --base # Build base template only
|
|
59
|
+
npx @lakitu/sdk build --custom # Build custom template only
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `npx @lakitu/sdk publish`
|
|
63
|
+
|
|
64
|
+
Manage your E2B templates:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx @lakitu/sdk publish
|
|
68
|
+
```
|
|
10
69
|
|
|
11
70
|
## The Code Execution Model
|
|
12
71
|
|
|
72
|
+
Traditional agents use JSON tool calls. Lakitu agents write code:
|
|
73
|
+
|
|
13
74
|
```
|
|
14
75
|
Traditional Agent: Lakitu Agent:
|
|
15
76
|
┌─────────────────┐ ┌─────────────────┐
|
|
@@ -28,52 +89,176 @@ Traditional Agent: Lakitu Agent:
|
|
|
28
89
|
└─────────┘ └───────────────┘
|
|
29
90
|
```
|
|
30
91
|
|
|
31
|
-
**Why
|
|
92
|
+
**Why code execution?**
|
|
93
|
+
- **Token efficient** — No tool schemas sent every request
|
|
94
|
+
- **Composable** — Chain operations naturally in code
|
|
95
|
+
- **Debuggable** — See exactly what code ran
|
|
96
|
+
- **Model agnostic** — Any LLM that generates code works
|
|
32
97
|
|
|
33
|
-
|
|
98
|
+
---
|
|
34
99
|
|
|
35
|
-
|
|
36
|
-
- **Knowledge**: JSDoc documentation
|
|
37
|
-
- **Skills**: Executable functions
|
|
38
|
-
- **Abilities**: What the agent can accomplish
|
|
100
|
+
## KSA SDK
|
|
39
101
|
|
|
40
|
-
|
|
102
|
+
KSAs (Knowledge, Skills, and Abilities) are capability modules that agents use via code execution. The SDK provides a type-safe builder API for defining KSAs.
|
|
41
103
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
104
|
+
### Defining a KSA
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { defineKSA, fn, service, primitive } from "@lakitu/sdk";
|
|
108
|
+
|
|
109
|
+
export const myKSA = defineKSA("myKsa")
|
|
110
|
+
.description("Description of what this KSA does")
|
|
111
|
+
.category("skills") // "core" | "skills" | "deliverables"
|
|
112
|
+
.group("research") // Optional subcategory
|
|
113
|
+
.icon("mdi-search") // Optional MDI icon
|
|
114
|
+
|
|
115
|
+
// Add functions
|
|
116
|
+
.fn("search", fn()
|
|
117
|
+
.description("Search for something")
|
|
118
|
+
.param("query", { type: "string", required: true })
|
|
119
|
+
.param("limit", { type: "number", default: 10 })
|
|
120
|
+
.returns<SearchResult[]>()
|
|
121
|
+
.impl(service("services.Search.internal.query")
|
|
122
|
+
.mapArgs(({ query, limit }) => ({ q: query, max: limit }))
|
|
123
|
+
.mapResult(r => r.results)
|
|
124
|
+
)
|
|
125
|
+
)
|
|
53
126
|
|
|
54
|
-
|
|
127
|
+
.fn("readFile", fn()
|
|
128
|
+
.description("Read a local file")
|
|
129
|
+
.param("path", { type: "string", required: true })
|
|
130
|
+
.impl(primitive("file.read"))
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
.build();
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### SDK Exports
|
|
55
137
|
|
|
56
138
|
```typescript
|
|
57
|
-
import {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
139
|
+
import {
|
|
140
|
+
// Builders
|
|
141
|
+
defineKSA, // Create a KSA definition
|
|
142
|
+
fn, // Create a function definition
|
|
143
|
+
service, // Service implementation (calls cloud Convex)
|
|
144
|
+
primitive, // Primitive implementation (local sandbox ops)
|
|
145
|
+
composite, // Composite implementation (chain operations)
|
|
146
|
+
|
|
147
|
+
// Registry utilities
|
|
148
|
+
createRegistry,
|
|
149
|
+
getFunction,
|
|
150
|
+
|
|
151
|
+
// Types
|
|
152
|
+
type KSADef,
|
|
153
|
+
type FunctionDef,
|
|
154
|
+
type ParamDef,
|
|
155
|
+
type Implementation,
|
|
156
|
+
} from "@lakitu/sdk";
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Implementation Types
|
|
160
|
+
|
|
161
|
+
#### Service Implementation
|
|
162
|
+
Calls a Convex function via the cloud gateway:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
.impl(service("services.MyService.internal.action")
|
|
166
|
+
.mapArgs(({ input }) => ({ data: input })) // Transform args
|
|
167
|
+
.mapResult(r => r.value) // Transform result
|
|
168
|
+
)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### Primitive Implementation
|
|
172
|
+
Uses local sandbox capabilities (file, shell, browser):
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
.impl(primitive("file.read"))
|
|
176
|
+
.impl(primitive("shell.exec"))
|
|
177
|
+
.impl(primitive("browser.screenshot"))
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Available primitives:
|
|
181
|
+
- `file.read`, `file.write`, `file.edit`, `file.glob`, `file.grep`, `file.ls`, `file.exists`, `file.stat`
|
|
182
|
+
- `shell.exec`
|
|
183
|
+
- `browser.open`, `browser.screenshot`, `browser.click`, `browser.type`, `browser.getHtml`, `browser.getText`, `browser.close`
|
|
184
|
+
|
|
185
|
+
#### Composite Implementation
|
|
186
|
+
Chain multiple operations:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
.impl(composite()
|
|
190
|
+
.call("file.read", { filePath: "./config.json" }, "config")
|
|
191
|
+
.call("myKsa.process", ctx => ({ data: ctx.vars.config }), "result")
|
|
192
|
+
.return(ctx => ctx.vars.result)
|
|
193
|
+
)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Parameter Types
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
.param("name", { type: "string", required: true })
|
|
200
|
+
.param("count", { type: "number", default: 10 })
|
|
201
|
+
.param("enabled", { type: "boolean", default: false })
|
|
202
|
+
.param("tags", { type: "array" })
|
|
203
|
+
.param("options", { type: "object" })
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Configuration
|
|
209
|
+
|
|
210
|
+
After running `init`, configure Lakitu in `convex/lakitu/config.ts`:
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
import { Lakitu } from "@lakitu/sdk";
|
|
214
|
+
|
|
215
|
+
export default Lakitu.configure({
|
|
216
|
+
// E2B template name (build with: npx lakitu build)
|
|
217
|
+
template: "lakitu",
|
|
218
|
+
|
|
219
|
+
// Default model for agent
|
|
220
|
+
model: "anthropic/claude-sonnet-4-20250514",
|
|
221
|
+
|
|
222
|
+
// KSA modules to enable
|
|
223
|
+
ksas: [
|
|
224
|
+
// Built-in KSAs
|
|
225
|
+
"file",
|
|
226
|
+
"shell",
|
|
227
|
+
"browser",
|
|
228
|
+
"beads",
|
|
229
|
+
|
|
230
|
+
// Custom KSAs
|
|
231
|
+
"./myCustomKsa",
|
|
232
|
+
],
|
|
233
|
+
|
|
234
|
+
// Sandbox pool settings
|
|
235
|
+
pool: {
|
|
236
|
+
min: 0,
|
|
237
|
+
max: 5,
|
|
238
|
+
idleTimeout: 300_000,
|
|
239
|
+
},
|
|
74
240
|
});
|
|
75
241
|
```
|
|
76
242
|
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Built-in KSAs
|
|
246
|
+
|
|
247
|
+
| Category | KSA | Functions |
|
|
248
|
+
|----------|-----|-----------|
|
|
249
|
+
| **Core** | `file` | `read`, `write`, `edit`, `glob`, `grep`, `ls` |
|
|
250
|
+
| | `shell` | `exec` |
|
|
251
|
+
| | `browser` | `open`, `screenshot`, `click`, `type`, `getText` |
|
|
252
|
+
| | `beads` | `create`, `update`, `close`, `list`, `getReady` |
|
|
253
|
+
| **Skills** | `web` | `search`, `scrape` |
|
|
254
|
+
| | `news` | `trending`, `search`, `analyze` |
|
|
255
|
+
| | `social` | `tiktok`, `instagram`, `twitter`, `search` |
|
|
256
|
+
| | `companies` | `enrich`, `search`, `techStack` |
|
|
257
|
+
| **Deliverables** | `pdf` | `generate` |
|
|
258
|
+
| | `email` | `send`, `sendBulk` |
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
77
262
|
## Architecture
|
|
78
263
|
|
|
79
264
|
```
|
|
@@ -92,7 +277,7 @@ await send({
|
|
|
92
277
|
│ ▼ │
|
|
93
278
|
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
94
279
|
│ │ CLOUD GATEWAY │ │
|
|
95
|
-
│ │ HTTP → Convex Services (OpenRouter,
|
|
280
|
+
│ │ HTTP → Convex Services (OpenRouter, external APIs) │ │
|
|
96
281
|
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
97
282
|
│ │
|
|
98
283
|
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
@@ -102,65 +287,78 @@ await send({
|
|
|
102
287
|
└─────────────────────────────────────────────────────────────────────────┘
|
|
103
288
|
```
|
|
104
289
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Example: Custom KSA
|
|
293
|
+
|
|
294
|
+
Create `convex/lakitu/weather.ts`:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
import { defineKSA, fn, service } from "@lakitu/sdk";
|
|
298
|
+
|
|
299
|
+
export const weatherKSA = defineKSA("weather")
|
|
300
|
+
.description("Weather data and forecasts")
|
|
301
|
+
.category("skills")
|
|
302
|
+
.group("data")
|
|
303
|
+
|
|
304
|
+
.fn("current", fn()
|
|
305
|
+
.description("Get current weather for a location")
|
|
306
|
+
.param("location", { type: "string", required: true, description: "City name or coordinates" })
|
|
307
|
+
.impl(service("services.Weather.internal.getCurrent"))
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
.fn("forecast", fn()
|
|
311
|
+
.description("Get weather forecast")
|
|
312
|
+
.param("location", { type: "string", required: true })
|
|
313
|
+
.param("days", { type: "number", default: 7 })
|
|
314
|
+
.impl(service("services.Weather.internal.getForecast"))
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
.build();
|
|
318
|
+
|
|
319
|
+
export default weatherKSA;
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
The agent can then use it:
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
import { current, forecast } from './ksa/weather';
|
|
326
|
+
|
|
327
|
+
const weather = await current("San Francisco");
|
|
328
|
+
console.log(`Current: ${weather.temp}°F, ${weather.condition}`);
|
|
329
|
+
|
|
330
|
+
const nextWeek = await forecast("San Francisco", 7);
|
|
331
|
+
for (const day of nextWeek) {
|
|
332
|
+
console.log(`${day.date}: ${day.high}°F / ${day.low}°F`);
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Environment Variables
|
|
339
|
+
|
|
340
|
+
For `build` command:
|
|
341
|
+
- `E2B_API_KEY` — Your E2B API key (or run `e2b auth login`)
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Requirements
|
|
346
|
+
|
|
347
|
+
- [Convex](https://convex.dev) project
|
|
348
|
+
- [E2B](https://e2b.dev) account (for sandbox hosting)
|
|
349
|
+
- Node.js 18+ or Bun
|
|
350
|
+
|
|
351
|
+
---
|
|
162
352
|
|
|
163
353
|
## Links
|
|
164
354
|
|
|
355
|
+
- [npm package](https://www.npmjs.com/package/@lakitu/sdk)
|
|
356
|
+
- [GitHub](https://github.com/shinyobjectz/lakitu)
|
|
165
357
|
- [E2B Documentation](https://e2b.dev/docs)
|
|
166
358
|
- [Convex Documentation](https://docs.convex.dev)
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## License
|
|
363
|
+
|
|
364
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakitu/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Self-hosted AI agent framework for Convex + E2B with code execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/sdk/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
],
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
|
62
|
-
"url": "https://github.com/
|
|
62
|
+
"url": "https://github.com/shinyobjectz/lakitu"
|
|
63
63
|
},
|
|
64
64
|
"license": "MIT",
|
|
65
65
|
"dependencies": {
|