@tabbybyte/kimten 0.1.3 → 0.1.4
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/README.md +35 -118
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,44 +1,38 @@
|
|
|
1
1
|
# 🐈 kimten
|
|
2
|
+
🐾 _**A tiny agent loop with paws**_ 🐾
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
[](https://github.com/tabbybyte-technologies/kimten/actions/workflows/ci.yml)
|
|
5
|
+
[](https://codecov.io/gh/tabbybyte-technologies/kimten)
|
|
6
|
+
[](https://www.npmjs.com/package/@tabbybyte/kimten)
|
|
7
|
+
[](https://github.com/tabbybyte-technologies/kimten/commits/main)
|
|
8
|
+
[](LICENSE)
|
|
4
9
|
|
|
5
|
-
Small surface area, sharp claws, zero fluff (well… almost).
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
Kimten is a minimal micro-agent library: a thin wrapper over the **[Agent interface in Vercel AI SDK Core v6+](https://ai-sdk.dev/docs/agents)**.
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
> but delivered as a smol terminal cat 🐾
|
|
13
|
+
It’s meant to feel like a smart helper, not a framework.
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
It’s just a neat little helper that runs prompts, calls tools, remembers a little, and gets out of your way.
|
|
15
|
+
## ✅ What it does
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
- Runs a simple agent loop (bounded by `hops`)
|
|
18
|
+
- Lets the model call your tools (`toys`)
|
|
19
|
+
- Keeps short-term conversation memory (in-process, per instance)
|
|
20
|
+
- Supports optional structured output via Zod
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## ✨ Why Kimten?
|
|
22
|
+
## ❌ What it does *not* do
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
- No planners/graphs/state machines
|
|
25
|
+
- No streaming API surface
|
|
26
|
+
- No persistence or long-term memory
|
|
27
|
+
- No plugin system or orchestration runtime
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
- 6 middlewares
|
|
28
|
-
- 4 “agent runtimes”
|
|
29
|
-
- 200MB of dependencies
|
|
30
|
-
|
|
31
|
-
You just want:
|
|
29
|
+
---
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
✔ give it tools
|
|
35
|
-
✔ keep a bit of convo memory
|
|
36
|
-
✔ maybe get structured output
|
|
37
|
-
✔ done
|
|
31
|
+
## ✨ Why Kimten?
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
Use it when you just want an agent loop with tools and a little memory, without adopting a larger framework.
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
Good fits:
|
|
42
36
|
|
|
43
37
|
- CLI helpers
|
|
44
38
|
- small automations
|
|
@@ -51,14 +45,10 @@ Perfect for:
|
|
|
51
45
|
|
|
52
46
|
## 📦 Install
|
|
53
47
|
|
|
54
|
-
Feed the cat some treats:
|
|
55
|
-
|
|
56
48
|
```bash
|
|
57
49
|
npm i @tabbybyte/kimten ai zod @ai-sdk/openai
|
|
58
50
|
```
|
|
59
51
|
|
|
60
|
-
That’s it. No ceremony. No rituals. 🍗
|
|
61
|
-
|
|
62
52
|
### Requirements
|
|
63
53
|
|
|
64
54
|
- Node `>=22`
|
|
@@ -69,8 +59,6 @@ That’s it. No ceremony. No rituals. 🍗
|
|
|
69
59
|
|
|
70
60
|
## 🚀 Usage
|
|
71
61
|
|
|
72
|
-
Summon your little helper (with or without `toys`) and let it `play`.
|
|
73
|
-
|
|
74
62
|
```js
|
|
75
63
|
import { openai } from '@ai-sdk/openai'; // or, any other provider
|
|
76
64
|
import { z } from 'zod';
|
|
@@ -83,8 +71,6 @@ const cat = Kimten({
|
|
|
83
71
|
add: async ({ a, b }) => a + b,
|
|
84
72
|
},
|
|
85
73
|
|
|
86
|
-
personality: 'Helpful terminal cat',
|
|
87
|
-
|
|
88
74
|
hops: 10,
|
|
89
75
|
});
|
|
90
76
|
|
|
@@ -101,9 +87,6 @@ const structured = await cat.play(
|
|
|
101
87
|
cat.forget();
|
|
102
88
|
```
|
|
103
89
|
|
|
104
|
-
Done.
|
|
105
|
-
No lifecycle hooks. No config jungle. 🧘
|
|
106
|
-
|
|
107
90
|
---
|
|
108
91
|
|
|
109
92
|
## 🧠 Mental Model
|
|
@@ -119,37 +102,22 @@ loop:
|
|
|
119
102
|
return result
|
|
120
103
|
```
|
|
121
104
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
Each instance keeps a **small, short-term chat memory** 🧠
|
|
125
|
-
So follow-up prompts naturally reference earlier messages:
|
|
105
|
+
Each instance keeps short-term chat memory, so follow-up prompts naturally reference earlier messages:
|
|
126
106
|
|
|
127
107
|
> “summarize this” → “make it shorter” → “now extract bullets”
|
|
128
108
|
|
|
129
|
-
When you’re done, call `forget()` and the brain goes blank again. 🫧
|
|
130
|
-
|
|
131
|
-
It’s intentionally:
|
|
132
|
-
|
|
133
|
-
* tiny
|
|
134
|
-
* predictable
|
|
135
|
-
* hackable
|
|
136
|
-
* easy to read in one sitting
|
|
137
|
-
|
|
138
|
-
If you can read the source in ~5 minutes, we did it right 😺
|
|
139
|
-
|
|
140
109
|
---
|
|
141
110
|
|
|
142
111
|
## ⚙️ API
|
|
143
112
|
|
|
144
113
|
### `Kimten(config)`
|
|
145
114
|
|
|
146
|
-
Create a new
|
|
147
|
-
|
|
148
|
-
### Required (must-haves)
|
|
115
|
+
Create a new instance.
|
|
149
116
|
|
|
150
|
-
|
|
117
|
+
#### Required
|
|
118
|
+
* `brain` → AI SDK model instance
|
|
151
119
|
|
|
152
|
-
|
|
120
|
+
#### Optional
|
|
153
121
|
|
|
154
122
|
* `toys` → object map of tool definitions. Each entry can be:
|
|
155
123
|
* async function shorthand: `async (args) => result`
|
|
@@ -159,13 +127,13 @@ Create a new cat.
|
|
|
159
127
|
* `hops` → max agent loop steps (default: `10`)
|
|
160
128
|
prevents infinite zoomies 🌀
|
|
161
129
|
|
|
162
|
-
|
|
130
|
+
#### Tool semantics
|
|
163
131
|
|
|
164
132
|
- Tool inputs are validated only if you provide `inputSchema` (shorthand tools accept anything).
|
|
165
133
|
- Tool results should be JSON-serializable; `undefined` becomes `null`.
|
|
166
134
|
- If a tool throws, Kimten returns `{ error, toolName }` as the tool result (it does not re-throw).
|
|
167
135
|
|
|
168
|
-
|
|
136
|
+
#### Returns
|
|
169
137
|
|
|
170
138
|
* `play(input, schema?)`
|
|
171
139
|
|
|
@@ -179,46 +147,17 @@ Create a new cat.
|
|
|
179
147
|
|
|
180
148
|
---
|
|
181
149
|
|
|
182
|
-
## 🧩 Design Philosophy & Vibes
|
|
183
|
-
|
|
184
|
-
Kimten intentionally avoids “big agent framework energy”.
|
|
185
|
-
|
|
186
|
-
It’s meant to be:
|
|
187
|
-
|
|
188
|
-
* small
|
|
189
|
-
* opinionated
|
|
190
|
-
* dependency-light
|
|
191
|
-
* short-term memory by design
|
|
192
|
-
* easy to embed anywhere
|
|
193
|
-
|
|
194
|
-
No:
|
|
195
|
-
|
|
196
|
-
* streaming APIs
|
|
197
|
-
* planners or graphs
|
|
198
|
-
* middleware/plugins
|
|
199
|
-
* long-term memory
|
|
200
|
-
* persistence/storage
|
|
201
|
-
* hidden background processes
|
|
202
|
-
* TypeScript runtime/build nonsense
|
|
203
|
-
* full fledged orchestration system
|
|
204
|
-
|
|
205
|
-
If you need those… use something heavier.
|
|
206
|
-
|
|
207
|
-
If you want **simple + fast + composable**, Kimten fits nicely.
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
150
|
## 🛠 Tips
|
|
212
151
|
|
|
213
152
|
### Providers & models
|
|
214
153
|
|
|
215
154
|
For the `brain` part, feel free to use any compatible provider and their models.
|
|
216
155
|
|
|
217
|
-
Refer to https://ai-sdk.dev/docs/foundations/providers-and-models
|
|
156
|
+
Refer to the AI SDK docs: **[providers and models](https://ai-sdk.dev/docs/foundations/providers-and-models)**.
|
|
218
157
|
|
|
219
158
|
### Add tools freely
|
|
220
159
|
|
|
221
|
-
Tools can stay simple:
|
|
160
|
+
Tools can stay simple, just normal async functions:
|
|
222
161
|
|
|
223
162
|
```js
|
|
224
163
|
toys: {
|
|
@@ -229,8 +168,6 @@ toys: {
|
|
|
229
168
|
}
|
|
230
169
|
```
|
|
231
170
|
|
|
232
|
-
The model decides when to use them.
|
|
233
|
-
|
|
234
171
|
For stronger arg validation and better tool selection, use object form:
|
|
235
172
|
|
|
236
173
|
```js
|
|
@@ -246,27 +183,7 @@ toys: {
|
|
|
246
183
|
},
|
|
247
184
|
}
|
|
248
185
|
```
|
|
249
|
-
|
|
250
|
-
### Small “real” example
|
|
251
|
-
|
|
252
|
-
```js
|
|
253
|
-
toys: {
|
|
254
|
-
fetchJson: {
|
|
255
|
-
description: 'Fetch JSON from a URL (GET).',
|
|
256
|
-
inputSchema: z.object({ url: z.string().url() }),
|
|
257
|
-
async execute({ url }) {
|
|
258
|
-
const res = await fetch(url);
|
|
259
|
-
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
260
|
-
return res.json();
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
}
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
### Structured output = sanity
|
|
267
|
-
|
|
268
|
-
Use Zod schemas whenever possible.
|
|
269
|
-
LLMs lie less when types exist 😼
|
|
186
|
+
💡 For further details, refer to [AI SDK docs on Tools](https://ai-sdk.dev/docs/foundations/tools)
|
|
270
187
|
|
|
271
188
|
### Keep hops low
|
|
272
189
|
|
|
@@ -275,11 +192,11 @@ If you need 50+ steps, you probably want a planner, not Kimten.
|
|
|
275
192
|
### Reset when needed
|
|
276
193
|
|
|
277
194
|
Fresh task? Call `forget()`.
|
|
278
|
-
Cats don’t hold grudges (or context)
|
|
195
|
+
Cats don’t hold grudges (or context).😽
|
|
279
196
|
|
|
280
197
|
---
|
|
281
198
|
|
|
282
199
|
## License
|
|
283
200
|
|
|
284
|
-
MIT
|
|
285
|
-
Pet responsibly.
|
|
201
|
+
[MIT](LICENSE)
|
|
202
|
+
Pet responsibly. 🐈⬛
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tabbybyte/kimten",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"lib"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"test": "node --test"
|
|
18
|
+
"test": "node --test",
|
|
19
|
+
"test:coverage": "node --test --experimental-test-coverage --test-coverage-include=lib/**/*.js --test-coverage-include=index.js --test-coverage-exclude=test/**/*.js --test-coverage-exclude=node_modules/**",
|
|
20
|
+
"test:coverage:ci": "node --test --experimental-test-coverage --test-coverage-include=lib/**/*.js --test-coverage-include=index.js --test-coverage-exclude=test/**/*.js --test-coverage-exclude=node_modules/** --test-coverage-lines=95 --test-coverage-functions=95 --test-coverage-branches=85"
|
|
19
21
|
},
|
|
20
22
|
"keywords": [
|
|
21
23
|
"ai",
|