@tabbybyte/kimten 0.1.2 → 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 +47 -115
- 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,24 +45,24 @@ Perfect for:
|
|
|
51
45
|
|
|
52
46
|
## 📦 Install
|
|
53
47
|
|
|
54
|
-
Feed the cat some treats:
|
|
55
|
-
|
|
56
48
|
```bash
|
|
57
|
-
npm i kimten ai zod @ai-sdk/openai
|
|
49
|
+
npm i @tabbybyte/kimten ai zod @ai-sdk/openai
|
|
58
50
|
```
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
### Requirements
|
|
53
|
+
|
|
54
|
+
- Node `>=22`
|
|
55
|
+
- AI SDK Core `>=6`
|
|
56
|
+
- Zod `>=3`
|
|
61
57
|
|
|
62
58
|
---
|
|
63
59
|
|
|
64
60
|
## 🚀 Usage
|
|
65
61
|
|
|
66
|
-
Summon your little helper (with or without `toys`) and let it `play`.
|
|
67
|
-
|
|
68
62
|
```js
|
|
69
63
|
import { openai } from '@ai-sdk/openai'; // or, any other provider
|
|
70
64
|
import { z } from 'zod';
|
|
71
|
-
import Kimten from 'kimten';
|
|
65
|
+
import Kimten from '@tabbybyte/kimten';
|
|
72
66
|
|
|
73
67
|
const cat = Kimten({
|
|
74
68
|
brain: openai('gpt-4o-mini'), // or, any other available model
|
|
@@ -77,8 +71,6 @@ const cat = Kimten({
|
|
|
77
71
|
add: async ({ a, b }) => a + b,
|
|
78
72
|
},
|
|
79
73
|
|
|
80
|
-
personality: 'Helpful terminal cat',
|
|
81
|
-
|
|
82
74
|
hops: 10,
|
|
83
75
|
});
|
|
84
76
|
|
|
@@ -95,9 +87,6 @@ const structured = await cat.play(
|
|
|
95
87
|
cat.forget();
|
|
96
88
|
```
|
|
97
89
|
|
|
98
|
-
Done.
|
|
99
|
-
No lifecycle hooks. No config jungle. 🧘
|
|
100
|
-
|
|
101
90
|
---
|
|
102
91
|
|
|
103
92
|
## 🧠 Mental Model
|
|
@@ -113,37 +102,22 @@ loop:
|
|
|
113
102
|
return result
|
|
114
103
|
```
|
|
115
104
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Each instance keeps a **small, short-term chat memory** 🧠
|
|
119
|
-
So follow-up prompts naturally reference earlier messages:
|
|
105
|
+
Each instance keeps short-term chat memory, so follow-up prompts naturally reference earlier messages:
|
|
120
106
|
|
|
121
107
|
> “summarize this” → “make it shorter” → “now extract bullets”
|
|
122
108
|
|
|
123
|
-
When you’re done, call `forget()` and the brain goes blank again. 🫧
|
|
124
|
-
|
|
125
|
-
It’s intentionally:
|
|
126
|
-
|
|
127
|
-
* tiny
|
|
128
|
-
* predictable
|
|
129
|
-
* hackable
|
|
130
|
-
* easy to read in one sitting
|
|
131
|
-
|
|
132
|
-
If you can read the source in ~5 minutes, we did it right 😺
|
|
133
|
-
|
|
134
109
|
---
|
|
135
110
|
|
|
136
111
|
## ⚙️ API
|
|
137
112
|
|
|
138
113
|
### `Kimten(config)`
|
|
139
114
|
|
|
140
|
-
Create a new
|
|
141
|
-
|
|
142
|
-
### Required (must-haves)
|
|
115
|
+
Create a new instance.
|
|
143
116
|
|
|
144
|
-
|
|
117
|
+
#### Required
|
|
118
|
+
* `brain` → AI SDK model instance
|
|
145
119
|
|
|
146
|
-
|
|
120
|
+
#### Optional
|
|
147
121
|
|
|
148
122
|
* `toys` → object map of tool definitions. Each entry can be:
|
|
149
123
|
* async function shorthand: `async (args) => result`
|
|
@@ -153,7 +127,13 @@ Create a new cat.
|
|
|
153
127
|
* `hops` → max agent loop steps (default: `10`)
|
|
154
128
|
prevents infinite zoomies 🌀
|
|
155
129
|
|
|
156
|
-
|
|
130
|
+
#### Tool semantics
|
|
131
|
+
|
|
132
|
+
- Tool inputs are validated only if you provide `inputSchema` (shorthand tools accept anything).
|
|
133
|
+
- Tool results should be JSON-serializable; `undefined` becomes `null`.
|
|
134
|
+
- If a tool throws, Kimten returns `{ error, toolName }` as the tool result (it does not re-throw).
|
|
135
|
+
|
|
136
|
+
#### Returns
|
|
157
137
|
|
|
158
138
|
* `play(input, schema?)`
|
|
159
139
|
|
|
@@ -167,37 +147,17 @@ Create a new cat.
|
|
|
167
147
|
|
|
168
148
|
---
|
|
169
149
|
|
|
170
|
-
## 🧩 Design Philosophy
|
|
171
|
-
|
|
172
|
-
Kimten intentionally avoids “big agent framework energy”.
|
|
173
|
-
|
|
174
|
-
No:
|
|
175
|
-
|
|
176
|
-
* streaming APIs
|
|
177
|
-
* planners or graphs
|
|
178
|
-
* middleware/plugins
|
|
179
|
-
* long-term memory
|
|
180
|
-
* persistence/storage
|
|
181
|
-
* hidden background processes
|
|
182
|
-
* TypeScript runtime/build nonsense
|
|
183
|
-
|
|
184
|
-
If you need those… use something heavier.
|
|
185
|
-
|
|
186
|
-
If you want **simple + fast + composable**, Kimten fits nicely.
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
150
|
## 🛠 Tips
|
|
191
151
|
|
|
192
152
|
### Providers & models
|
|
193
153
|
|
|
194
154
|
For the `brain` part, feel free to use any compatible provider and their models.
|
|
195
155
|
|
|
196
|
-
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)**.
|
|
197
157
|
|
|
198
158
|
### Add tools freely
|
|
199
159
|
|
|
200
|
-
Tools can stay simple:
|
|
160
|
+
Tools can stay simple, just normal async functions:
|
|
201
161
|
|
|
202
162
|
```js
|
|
203
163
|
toys: {
|
|
@@ -208,8 +168,6 @@ toys: {
|
|
|
208
168
|
}
|
|
209
169
|
```
|
|
210
170
|
|
|
211
|
-
The model decides when to use them.
|
|
212
|
-
|
|
213
171
|
For stronger arg validation and better tool selection, use object form:
|
|
214
172
|
|
|
215
173
|
```js
|
|
@@ -225,11 +183,7 @@ toys: {
|
|
|
225
183
|
},
|
|
226
184
|
}
|
|
227
185
|
```
|
|
228
|
-
|
|
229
|
-
### Structured output = sanity
|
|
230
|
-
|
|
231
|
-
Use Zod schemas whenever possible.
|
|
232
|
-
LLMs lie less when types exist 😼
|
|
186
|
+
💡 For further details, refer to [AI SDK docs on Tools](https://ai-sdk.dev/docs/foundations/tools)
|
|
233
187
|
|
|
234
188
|
### Keep hops low
|
|
235
189
|
|
|
@@ -238,33 +192,11 @@ If you need 50+ steps, you probably want a planner, not Kimten.
|
|
|
238
192
|
### Reset when needed
|
|
239
193
|
|
|
240
194
|
Fresh task? Call `forget()`.
|
|
241
|
-
Cats don’t hold grudges (or context)
|
|
242
|
-
|
|
243
|
-
---
|
|
244
|
-
|
|
245
|
-
## 🐾 Vibes
|
|
246
|
-
|
|
247
|
-
Kimten is:
|
|
248
|
-
|
|
249
|
-
* small
|
|
250
|
-
* opinionated
|
|
251
|
-
* dependency-light
|
|
252
|
-
* short-memory by design
|
|
253
|
-
* easy to embed anywhere
|
|
254
|
-
|
|
255
|
-
It’s not trying to be LangChain or a full orchestration system.
|
|
256
|
-
|
|
257
|
-
It’s just a cat.
|
|
258
|
-
|
|
259
|
-
A helpful one.
|
|
260
|
-
|
|
261
|
-
In your terminal.
|
|
262
|
-
|
|
263
|
-
Typing. 🐈⬛
|
|
195
|
+
Cats don’t hold grudges (or context).😽
|
|
264
196
|
|
|
265
197
|
---
|
|
266
198
|
|
|
267
199
|
## License
|
|
268
200
|
|
|
269
|
-
MIT
|
|
270
|
-
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",
|