@vibe-agent-toolkit/vat-example-cat-agents 0.1.2-rc.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 +697 -0
- package/dist/conversational-assistant/breed-advisor.d.ts +24 -0
- package/dist/conversational-assistant/breed-advisor.d.ts.map +1 -0
- package/dist/conversational-assistant/breed-advisor.js +390 -0
- package/dist/conversational-assistant/breed-advisor.js.map +1 -0
- package/dist/conversational-assistant/breed-knowledge.d.ts +42 -0
- package/dist/conversational-assistant/breed-knowledge.d.ts.map +1 -0
- package/dist/conversational-assistant/breed-knowledge.js +335 -0
- package/dist/conversational-assistant/breed-knowledge.js.map +1 -0
- package/dist/external-event-integrator/human-approval.d.ts +207 -0
- package/dist/external-event-integrator/human-approval.d.ts.map +1 -0
- package/dist/external-event-integrator/human-approval.js +387 -0
- package/dist/external-event-integrator/human-approval.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-collections.d.ts +30 -0
- package/dist/mcp-collections.d.ts.map +1 -0
- package/dist/mcp-collections.js +58 -0
- package/dist/mcp-collections.js.map +1 -0
- package/dist/one-shot-llm-analyzer/description-parser.d.ts +55 -0
- package/dist/one-shot-llm-analyzer/description-parser.d.ts.map +1 -0
- package/dist/one-shot-llm-analyzer/description-parser.js +349 -0
- package/dist/one-shot-llm-analyzer/description-parser.js.map +1 -0
- package/dist/one-shot-llm-analyzer/haiku-generator.d.ts +157 -0
- package/dist/one-shot-llm-analyzer/haiku-generator.d.ts.map +1 -0
- package/dist/one-shot-llm-analyzer/haiku-generator.js +66 -0
- package/dist/one-shot-llm-analyzer/haiku-generator.js.map +1 -0
- package/dist/one-shot-llm-analyzer/name-generator.d.ts +157 -0
- package/dist/one-shot-llm-analyzer/name-generator.d.ts.map +1 -0
- package/dist/one-shot-llm-analyzer/name-generator.js +121 -0
- package/dist/one-shot-llm-analyzer/name-generator.js.map +1 -0
- package/dist/one-shot-llm-analyzer/photo-analyzer.d.ts +57 -0
- package/dist/one-shot-llm-analyzer/photo-analyzer.d.ts.map +1 -0
- package/dist/one-shot-llm-analyzer/photo-analyzer.js +288 -0
- package/dist/one-shot-llm-analyzer/photo-analyzer.js.map +1 -0
- package/dist/pure-function-tool/haiku-validator.d.ts +27 -0
- package/dist/pure-function-tool/haiku-validator.d.ts.map +1 -0
- package/dist/pure-function-tool/haiku-validator.js +148 -0
- package/dist/pure-function-tool/haiku-validator.js.map +1 -0
- package/dist/pure-function-tool/name-validator.d.ts +203 -0
- package/dist/pure-function-tool/name-validator.d.ts.map +1 -0
- package/dist/pure-function-tool/name-validator.js +244 -0
- package/dist/pure-function-tool/name-validator.js.map +1 -0
- package/dist/types/schemas.d.ts +612 -0
- package/dist/types/schemas.d.ts.map +1 -0
- package/dist/types/schemas.js +127 -0
- package/dist/types/schemas.js.map +1 -0
- package/dist/utils/color-extraction.d.ts +14 -0
- package/dist/utils/color-extraction.d.ts.map +1 -0
- package/dist/utils/color-extraction.js +45 -0
- package/dist/utils/color-extraction.js.map +1 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
# @vibe-agent-toolkit/vat-example-cat-agents
|
|
2
|
+
|
|
3
|
+
**Example agents demonstrating VAT patterns across 9 agent archetypes.**
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This package serves as a **reference implementation** for the Vibe Agent Toolkit (VAT). It demonstrates how to build portable agents that work across multiple frameworks (Vercel AI SDK, LangChain, Claude Agent SDK, n8n) using a whimsical but realistic cat breeding domain.
|
|
8
|
+
|
|
9
|
+
**Why cats?** The domain provides realistic complexity (genetics, compliance, multi-step workflows) while remaining approachable and fun. Think of it as the "TodoMVC" of agentic AI frameworks.
|
|
10
|
+
|
|
11
|
+
## Current Status
|
|
12
|
+
|
|
13
|
+
**Implementation Progress:** 4 of 9 archetypes, 8 agents
|
|
14
|
+
|
|
15
|
+
| Archetype | Status | Agents |
|
|
16
|
+
|-----------|--------|--------|
|
|
17
|
+
| 1. Pure Function Tool | ✅ Complete | 2 agents |
|
|
18
|
+
| 2. One-Shot LLM Analyzer | ✅ Complete | 4 agents |
|
|
19
|
+
| 3. Conversational Assistant | ✅ Complete | 1 agent |
|
|
20
|
+
| 4. Agentic Researcher (ReAct) | ⏸️ Planned | 0 agents |
|
|
21
|
+
| 5. Function Workflow Orchestrator | ⏸️ Planned | 0 agents |
|
|
22
|
+
| 6. LLM Intelligent Coordinator | ⏸️ Planned | 0 agents |
|
|
23
|
+
| 7. Function Event Consumer | ⏸️ Planned | 0 agents |
|
|
24
|
+
| 8. LLM Event Handler | ⏸️ Planned | 0 agents |
|
|
25
|
+
| 9. External Event Integrator | ✅ Complete | 1 agent |
|
|
26
|
+
|
|
27
|
+
**Note:** This is a living example package. Archetypes are implemented as we validate the VAT framework design.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @vibe-agent-toolkit/vat-example-cat-agents
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Result Envelopes
|
|
36
|
+
|
|
37
|
+
All VAT agents return standardized result envelopes following Railway-Oriented Programming (ROP) principles. This provides consistent error handling, type-safe result processing, and clear orchestration patterns.
|
|
38
|
+
|
|
39
|
+
### OneShotAgentOutput (Pure Functions & One-Shot LLM)
|
|
40
|
+
|
|
41
|
+
Pure function tools and one-shot LLM analyzers return `OneShotAgentOutput<TData, TError>`:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
interface OneShotAgentOutput<TData, TError> {
|
|
45
|
+
result: AgentResult<TData, TError>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type AgentResult<TData, TError> =
|
|
49
|
+
| { status: 'success'; data: TData }
|
|
50
|
+
| { status: 'error'; error: TError };
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Example:**
|
|
54
|
+
```typescript
|
|
55
|
+
const output = await haikuValidator.execute({ text, syllables, kigo, kireji });
|
|
56
|
+
|
|
57
|
+
if (output.result.status === 'success') {
|
|
58
|
+
console.log('Valid:', output.result.data.valid);
|
|
59
|
+
} else {
|
|
60
|
+
console.error('Invalid:', output.result.error);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### ConversationalAgentOutput (Multi-Turn Agents)
|
|
65
|
+
|
|
66
|
+
Conversational assistants return `ConversationalAgentOutput<TData, TError, TState>`:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
interface ConversationalAgentOutput<TData, TError, TState> {
|
|
70
|
+
reply: string; // Natural language response
|
|
71
|
+
sessionState: TState; // Updated session state
|
|
72
|
+
result: StatefulAgentResult<TData, TError, TMetadata>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type StatefulAgentResult<TData, TError, TMetadata> =
|
|
76
|
+
| { status: 'in-progress'; metadata?: TMetadata }
|
|
77
|
+
| { status: 'success'; data: TData }
|
|
78
|
+
| { status: 'error'; error: TError };
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Example:**
|
|
82
|
+
```typescript
|
|
83
|
+
const output = await breedAdvisor.execute({
|
|
84
|
+
message: 'I love classical music',
|
|
85
|
+
sessionState: { profile: { conversationPhase: 'gathering' } },
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
console.log('Agent says:', output.reply); // For user
|
|
89
|
+
const nextState = output.sessionState; // Carry to next turn
|
|
90
|
+
|
|
91
|
+
if (output.result.status === 'in-progress') {
|
|
92
|
+
console.log('Gathering info:', output.result.metadata);
|
|
93
|
+
} else if (output.result.status === 'success') {
|
|
94
|
+
console.log('Recommendation:', output.result.data);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See [Orchestration Guide](../../docs/orchestration.md) for detailed patterns and examples.
|
|
99
|
+
|
|
100
|
+
## Agent Catalog
|
|
101
|
+
|
|
102
|
+
### Archetype 1: Pure Function Tool
|
|
103
|
+
|
|
104
|
+
**Characteristics:** Stateless, synchronous, deterministic, no external dependencies
|
|
105
|
+
|
|
106
|
+
**Use Cases:** Validation, calculation, formatting, rule-based logic
|
|
107
|
+
|
|
108
|
+
#### Haiku Validator
|
|
109
|
+
|
|
110
|
+
Validates haiku structure according to traditional Japanese poetry rules.
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { validateHaiku, type Haiku } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
114
|
+
|
|
115
|
+
const haiku: Haiku = {
|
|
116
|
+
line1: 'Autumn moon rises',
|
|
117
|
+
line2: 'Silver light on quiet waves',
|
|
118
|
+
line3: 'The cat sits and waits',
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const result = validateHaiku(haiku);
|
|
122
|
+
console.log(result);
|
|
123
|
+
// {
|
|
124
|
+
// valid: true,
|
|
125
|
+
// syllables: { line1: 5, line2: 7, line3: 5 },
|
|
126
|
+
// errors: [],
|
|
127
|
+
// hasKigo: true, // Seasonal reference detected
|
|
128
|
+
// hasKireji: false // No cutting word
|
|
129
|
+
// }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Validation Rules:**
|
|
133
|
+
- 5-7-5 syllable structure (strict)
|
|
134
|
+
- Kigo detection (seasonal words: spring, autumn, winter, summer, etc.)
|
|
135
|
+
- Kireji detection (cutting words: や, かな, けり, etc.)
|
|
136
|
+
|
|
137
|
+
**Not Cat-Specific:** This is a general-purpose haiku validator, reusable for any haiku validation.
|
|
138
|
+
|
|
139
|
+
#### Name Validator
|
|
140
|
+
|
|
141
|
+
Validates cat names against whimsical characteristic-based rules.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { validateCatName, type CatCharacteristics } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
145
|
+
|
|
146
|
+
const cat: CatCharacteristics = {
|
|
147
|
+
physical: {
|
|
148
|
+
furColor: 'Orange',
|
|
149
|
+
furPattern: 'Tabby',
|
|
150
|
+
eyeColor: 'Green',
|
|
151
|
+
size: 'large',
|
|
152
|
+
},
|
|
153
|
+
behavioral: {
|
|
154
|
+
personality: ['Regal', 'Demanding'],
|
|
155
|
+
},
|
|
156
|
+
description: 'A large orange tabby who rules the household',
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const result = validateCatName('Duke Marmalade III', cat);
|
|
160
|
+
console.log(result);
|
|
161
|
+
// {
|
|
162
|
+
// status: 'valid',
|
|
163
|
+
// reason: 'Proper masculine nobility with food-related theme!'
|
|
164
|
+
// }
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Quirky Validation Rules:**
|
|
168
|
+
- Three-legged cats must have three-syllable names
|
|
169
|
+
- Black cats cannot have names containing the letter 'e'
|
|
170
|
+
- Orange cats must have food-related names (Marmalade, Pumpkin, etc.)
|
|
171
|
+
- High-energy cats need short names (≤5 letters)
|
|
172
|
+
- Fluffy cats need repeated consonants (Mittens, Fluffy, etc.)
|
|
173
|
+
|
|
174
|
+
**Purpose:** Tests feedback loops (60-70% rejection rate forces iteration patterns)
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### Archetype 2: One-Shot LLM Analyzer
|
|
179
|
+
|
|
180
|
+
**Characteristics:** Single LLM call, no iteration, stateless, classification/extraction/generation
|
|
181
|
+
|
|
182
|
+
**Use Cases:** Image analysis, text parsing, classification, structured extraction, generation
|
|
183
|
+
|
|
184
|
+
#### Photo Analyzer
|
|
185
|
+
|
|
186
|
+
Extracts structured cat characteristics from images using vision LLM.
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { analyzePhoto } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
190
|
+
|
|
191
|
+
const characteristics = await analyzePhoto('/path/to/cat-photo.jpg');
|
|
192
|
+
console.log(characteristics);
|
|
193
|
+
// {
|
|
194
|
+
// physical: {
|
|
195
|
+
// furColor: 'Orange',
|
|
196
|
+
// furPattern: 'Tabby',
|
|
197
|
+
// eyeColor: 'Green',
|
|
198
|
+
// breed: 'Domestic Shorthair',
|
|
199
|
+
// size: 'medium'
|
|
200
|
+
// },
|
|
201
|
+
// behavioral: {
|
|
202
|
+
// personality: ['Playful', 'Curious'],
|
|
203
|
+
// quirks: []
|
|
204
|
+
// },
|
|
205
|
+
// description: 'An orange tabby cat with green eyes...'
|
|
206
|
+
// }
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Mock Mode:** Default behavior extracts from EXIF metadata + filename patterns (fast, free, deterministic). Set `mockable: false` to use real vision API.
|
|
210
|
+
|
|
211
|
+
**Multi-Modal Input:** Produces same `CatCharacteristics` schema as Description Parser (interchangeable inputs).
|
|
212
|
+
|
|
213
|
+
#### Description Parser
|
|
214
|
+
|
|
215
|
+
Parses unstructured text descriptions into structured cat characteristics.
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
import { parseDescription } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
219
|
+
|
|
220
|
+
const text = "Fluffy is a large, playful orange tabby with green eyes. She's very curious and loves to explore.";
|
|
221
|
+
const characteristics = await parseDescription(text);
|
|
222
|
+
// Returns same CatCharacteristics schema as Photo Analyzer
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Multi-Modal Convergence:** Text input → same schema as image input. Enables pipelines that accept either photos or descriptions.
|
|
226
|
+
|
|
227
|
+
#### Name Generator
|
|
228
|
+
|
|
229
|
+
Generates creative cat names based on characteristics.
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { generateCatName } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
233
|
+
|
|
234
|
+
const name = await generateCatName(characteristics);
|
|
235
|
+
console.log(name);
|
|
236
|
+
// {
|
|
237
|
+
// name: 'Duke Marmalade III',
|
|
238
|
+
// reasoning: 'Orange color suggests food theme, regal personality demands nobility',
|
|
239
|
+
// alternatives: ['Sir Butterscotch', 'Lord Pumpkin']
|
|
240
|
+
// }
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**No Knowledge of Rules:** Generator does NOT know the validation rules. This is intentional - tests feedback loop patterns where generator → validator → retry.
|
|
244
|
+
|
|
245
|
+
#### Haiku Generator
|
|
246
|
+
|
|
247
|
+
Creates cat-themed haikus from characteristics.
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
import { generateHaiku } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
251
|
+
|
|
252
|
+
const haiku = await generateHaiku(characteristics);
|
|
253
|
+
console.log(haiku);
|
|
254
|
+
// {
|
|
255
|
+
// line1: 'Orange fur gleaming',
|
|
256
|
+
// line2: 'Playful paws dance in sunshine',
|
|
257
|
+
// line3: 'Green eyes watch and wait'
|
|
258
|
+
// }
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Feedback Loop:** Generated haikus can be validated with Haiku Validator. Tests iteration patterns.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### Archetype 3: Conversational Assistant
|
|
266
|
+
|
|
267
|
+
**Characteristics:** Multi-turn conversation, session state management, context accumulation, flexible dialogue
|
|
268
|
+
|
|
269
|
+
**Use Cases:** Advisory chatbots, guided workflows, interactive Q&A, personalized recommendations
|
|
270
|
+
|
|
271
|
+
#### Breed Selection Advisor
|
|
272
|
+
|
|
273
|
+
Helps users find their perfect cat breed through flexible, natural conversation. Tracks selection factors across multiple turns and provides personalized recommendations based on a whimsical music-breed compatibility theory.
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
import { breedAdvisorAgent } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
277
|
+
|
|
278
|
+
// Turn 1: Initial greeting
|
|
279
|
+
let result = await breedAdvisorAgent({
|
|
280
|
+
message: "Hi! I'm looking for a cat breed that fits my lifestyle.",
|
|
281
|
+
sessionState: undefined, // No prior state
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
console.log(result.reply);
|
|
285
|
+
// "Hello! I'd love to help you find the perfect breed! To get started, tell me..."
|
|
286
|
+
console.log(result.updatedProfile.conversationPhase); // "gathering"
|
|
287
|
+
|
|
288
|
+
// Turn 2: Provide information
|
|
289
|
+
result = await breedAdvisorAgent({
|
|
290
|
+
message: "I live in a small apartment and work from home. I listen to jazz music while coding.",
|
|
291
|
+
sessionState: {
|
|
292
|
+
profile: result.updatedProfile, // Pass updated profile from previous turn
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
console.log(result.reply);
|
|
297
|
+
// "Excellent! Jazz lovers tend to appreciate cats with..."
|
|
298
|
+
console.log(result.updatedProfile);
|
|
299
|
+
// {
|
|
300
|
+
// livingSpace: 'apartment',
|
|
301
|
+
// musicPreference: 'jazz',
|
|
302
|
+
// conversationPhase: 'gathering'
|
|
303
|
+
// }
|
|
304
|
+
|
|
305
|
+
// Turn 3: More information
|
|
306
|
+
result = await breedAdvisorAgent({
|
|
307
|
+
message: "I prefer low-maintenance grooming and I'm moderately active.",
|
|
308
|
+
sessionState: {
|
|
309
|
+
profile: result.updatedProfile,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
console.log(result.updatedProfile.conversationPhase); // "ready-to-recommend"
|
|
314
|
+
console.log(result.recommendations);
|
|
315
|
+
// [
|
|
316
|
+
// {
|
|
317
|
+
// breed: 'Siamese',
|
|
318
|
+
// matchScore: 85,
|
|
319
|
+
// reasoning: 'music preference (jazz) aligns perfectly; activity level (playful-moderate) matches well; suitable for apartment living'
|
|
320
|
+
// },
|
|
321
|
+
// {
|
|
322
|
+
// breed: 'Bengal',
|
|
323
|
+
// matchScore: 70,
|
|
324
|
+
// reasoning: 'music preference (jazz) aligns perfectly; grooming needs (minimal) match tolerance'
|
|
325
|
+
// },
|
|
326
|
+
// // ... more recommendations
|
|
327
|
+
// ]
|
|
328
|
+
|
|
329
|
+
// Turn 4: Follow-up question
|
|
330
|
+
result = await breedAdvisorAgent({
|
|
331
|
+
message: "Tell me more about the Siamese - are they vocal?",
|
|
332
|
+
sessionState: {
|
|
333
|
+
profile: result.updatedProfile,
|
|
334
|
+
},
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
console.log(result.updatedProfile.conversationPhase); // "refining"
|
|
338
|
+
// Agent provides detailed information about Siamese cats
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Selection Factors Tracked:**
|
|
342
|
+
|
|
343
|
+
1. **Living Space** - apartment, small-house, large-house, farm
|
|
344
|
+
2. **Activity Level** - couch-companion, playful-moderate, active-explorer, high-energy-athlete
|
|
345
|
+
3. **Grooming Tolerance** - minimal, weekly, daily
|
|
346
|
+
4. **Family Composition** - single, couple, young-kids, older-kids, multi-pet
|
|
347
|
+
5. **Allergies** - boolean (requires hypoallergenic breeds)
|
|
348
|
+
6. **Music Preference** - classical, jazz, rock, metal, pop, country, electronic, none (CRITICAL!)
|
|
349
|
+
|
|
350
|
+
**The Music Factor (CRITICAL!):**
|
|
351
|
+
|
|
352
|
+
This agent is built on a whimsical theory: **music preference is the MOST IMPORTANT factor** in cat breed selection!
|
|
353
|
+
|
|
354
|
+
Each music genre aligns with specific breed temperaments through "vibrational frequency compatibility":
|
|
355
|
+
|
|
356
|
+
- **Classical** → Calm, regal breeds (Persian, Ragdoll) - harmonic resonance
|
|
357
|
+
- **Jazz** → Intelligent, unpredictable breeds (Siamese, Bengal) - improvisational energy
|
|
358
|
+
- **Rock/Metal** → High-energy, bold breeds (Maine Coon, Abyssinian) - intensity matching
|
|
359
|
+
- **Pop** → Social, adaptable breeds (Domestic Shorthair) - mainstream compatibility
|
|
360
|
+
- **Electronic** → Modern, quirky breeds (Sphynx, Devon Rex) - synthetic-natural balance
|
|
361
|
+
- **Country** → Traditional, loyal breeds (American Shorthair) - heartland values
|
|
362
|
+
- **None/Silence** → Independent, mysterious breeds (Russian Blue) - zen alignment
|
|
363
|
+
|
|
364
|
+
Music preference receives **30 points (30% weight)** in the matching algorithm - more than any other factor!
|
|
365
|
+
|
|
366
|
+
**Conversation Phases:**
|
|
367
|
+
|
|
368
|
+
The agent automatically transitions through three phases based on information gathered:
|
|
369
|
+
|
|
370
|
+
1. **Gathering** (<4 factors): Asks questions to collect missing factors, prioritizes music preference
|
|
371
|
+
2. **Ready-to-Recommend** (4-6 factors): Can provide initial recommendations, still gathering more info
|
|
372
|
+
3. **Refining** (6+ factors or recommendations made): Explores alternatives, answers detailed questions
|
|
373
|
+
|
|
374
|
+
**State Management:**
|
|
375
|
+
|
|
376
|
+
Each turn receives the updated profile from the previous turn via `sessionState.profile`. The profile accumulates information across the conversation:
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
{
|
|
380
|
+
livingSpace?: 'apartment' | 'small-house' | 'large-house' | 'farm',
|
|
381
|
+
activityLevel?: 'couch-companion' | 'playful-moderate' | 'active-explorer' | 'high-energy-athlete',
|
|
382
|
+
groomingTolerance?: 'minimal' | 'weekly' | 'daily',
|
|
383
|
+
familyComposition?: 'single' | 'couple' | 'young-kids' | 'older-kids' | 'multi-pet',
|
|
384
|
+
allergies?: boolean,
|
|
385
|
+
musicPreference?: 'classical' | 'jazz' | 'rock' | 'metal' | 'pop' | 'country' | 'electronic' | 'none',
|
|
386
|
+
conversationPhase: 'gathering' | 'ready-to-recommend' | 'refining'
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**Breed Matching Algorithm:**
|
|
391
|
+
|
|
392
|
+
Scores breeds based on profile factors:
|
|
393
|
+
- Music preference: 30 points (2x weight - CRITICAL!)
|
|
394
|
+
- Activity level: 20 points
|
|
395
|
+
- Living space: 15 points
|
|
396
|
+
- Grooming tolerance: 15 points
|
|
397
|
+
- Family composition: 10 points
|
|
398
|
+
- Hard filters: Allergies require hypoallergenic, young kids require good-with-kids
|
|
399
|
+
|
|
400
|
+
Returns top 5 breeds with match scores (0-100) and reasoning.
|
|
401
|
+
|
|
402
|
+
**Knowledge Base:**
|
|
403
|
+
|
|
404
|
+
The agent uses a curated database of 12 breeds with comprehensive trait profiles:
|
|
405
|
+
- Persian, Ragdoll, Siamese, Bengal, Maine Coon, Abyssinian
|
|
406
|
+
- Sphynx, Devon Rex, Russian Blue, Domestic Shorthair, American Shorthair, Scottish Fold
|
|
407
|
+
|
|
408
|
+
Each breed profile includes: activity levels, grooming needs, apartment suitability, kid/pet compatibility, hypoallergenic status, **music alignment**, temperament, and size.
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
### Archetype 9: External Event Integrator
|
|
413
|
+
|
|
414
|
+
**Characteristics:** Emits events to external systems, blocks waiting for response, timeout handling
|
|
415
|
+
|
|
416
|
+
**Use Cases:** Human-in-the-loop approval, API callbacks, webhook handlers, external service integration
|
|
417
|
+
|
|
418
|
+
#### Human Approval Gate
|
|
419
|
+
|
|
420
|
+
Requests human approval for decisions (mockable for testing).
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
import { requestHumanApproval } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
424
|
+
|
|
425
|
+
const decision = await requestHumanApproval({
|
|
426
|
+
title: 'Breeding Permit Review',
|
|
427
|
+
description: 'Duke Marmalade III x Lady Whiskers',
|
|
428
|
+
context: { applicationId: '12345', risk: 'low' }
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
console.log(decision);
|
|
432
|
+
// { status: 'approved', approver: 'human@example.com', timestamp: '...' }
|
|
433
|
+
// OR
|
|
434
|
+
// { status: 'rejected', reason: 'Genetic coefficient too high', timestamp: '...' }
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**Mock Mode:** Default returns instant approval. Set `mockable: false` for real HITL integration (Slack, email, etc.).
|
|
438
|
+
|
|
439
|
+
**Timeout Handling:** Configurable timeout with fallback behavior (default: 24 hours for human timescale).
|
|
440
|
+
|
|
441
|
+
**Integration Agnostic:** Does not constrain HOW approval is requested (Slack, email, custom UI). Framework adapters implement integration details.
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## Planned Agents (Coming Soon)
|
|
446
|
+
|
|
447
|
+
### Archetype 4: Agentic Researcher (ReAct)
|
|
448
|
+
|
|
449
|
+
**Target:** Breed history researcher with tool-calling and iterative reasoning.
|
|
450
|
+
|
|
451
|
+
**Use Case:** Research cat breed origins using web search + document analysis tools.
|
|
452
|
+
|
|
453
|
+
### Archetype 5: Function Workflow Orchestrator
|
|
454
|
+
|
|
455
|
+
**Target:** Breeding approval pipeline with deterministic multi-agent coordination.
|
|
456
|
+
|
|
457
|
+
**Use Case:** Validate genetics → Generate name → Request approval → Update registry.
|
|
458
|
+
|
|
459
|
+
### Archetype 6: LLM Intelligent Coordinator
|
|
460
|
+
|
|
461
|
+
**Target:** Smart submission router with LLM decision-making at checkpoints.
|
|
462
|
+
|
|
463
|
+
**Use Case:** Route breeding applications based on complexity (auto-approve simple, escalate complex).
|
|
464
|
+
|
|
465
|
+
### Archetype 7: Function Event Consumer
|
|
466
|
+
|
|
467
|
+
**Target:** Pedigree file processor triggered by file upload events.
|
|
468
|
+
|
|
469
|
+
**Use Case:** Process uploaded pedigree documents and update registry.
|
|
470
|
+
|
|
471
|
+
### Archetype 8: LLM Event Handler
|
|
472
|
+
|
|
473
|
+
**Target:** Intelligent triage handler with LLM classification.
|
|
474
|
+
|
|
475
|
+
**Use Case:** Classify incoming submissions and route to appropriate queues.
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
## Running Demos
|
|
480
|
+
|
|
481
|
+
### Photo Analysis Demo
|
|
482
|
+
|
|
483
|
+
Demonstrates the photo analyzer with actual test fixture images:
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
bun run demo:photos
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
**What it does:**
|
|
490
|
+
- Loads 4 cat photos + 2 not-cat photos (bear, robot) from `test/fixtures/photos/`
|
|
491
|
+
- Analyzes each photo using **MOCK MODE** (EXIF metadata + filename patterns)
|
|
492
|
+
- Displays extracted characteristics
|
|
493
|
+
- Shows clear warning that it's not analyzing actual pixels
|
|
494
|
+
|
|
495
|
+
**Mock Mode vs Real Vision API:**
|
|
496
|
+
- **MOCK MODE** (default): Extracts from EXIF metadata and filename patterns. Fast, free, deterministic. Does NOT analyze actual pixels.
|
|
497
|
+
- **REAL MODE** (future): Set `USE_REAL_VISION=true` to call actual vision API (Claude Vision, GPT-4 Vision). Slow, costs money, analyzes actual pixels.
|
|
498
|
+
|
|
499
|
+
### Runtime Adapter Demos
|
|
500
|
+
|
|
501
|
+
To see cat agents used across different frameworks:
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
# Vercel AI SDK demo
|
|
505
|
+
cd packages/runtime-vercel-ai-sdk
|
|
506
|
+
bun run demo
|
|
507
|
+
|
|
508
|
+
# LangChain demo
|
|
509
|
+
cd packages/runtime-langchain
|
|
510
|
+
bun run demo
|
|
511
|
+
|
|
512
|
+
# OpenAI SDK demo
|
|
513
|
+
cd packages/runtime-openai
|
|
514
|
+
bun run demo
|
|
515
|
+
|
|
516
|
+
# Claude Agent SDK demo
|
|
517
|
+
cd packages/runtime-claude-agent-sdk
|
|
518
|
+
bun run demo
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
These demos show the **same cat agents** working across different runtimes, demonstrating portability.
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
## Core Schemas
|
|
526
|
+
|
|
527
|
+
All agents use shared Zod schemas for type safety:
|
|
528
|
+
|
|
529
|
+
### CatCharacteristics
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
{
|
|
533
|
+
physical: {
|
|
534
|
+
furColor: string,
|
|
535
|
+
furPattern?: string,
|
|
536
|
+
eyeColor?: string,
|
|
537
|
+
breed?: string,
|
|
538
|
+
size: 'tiny' | 'small' | 'medium' | 'large'
|
|
539
|
+
},
|
|
540
|
+
behavioral: {
|
|
541
|
+
personality: string[],
|
|
542
|
+
quirks?: string[]
|
|
543
|
+
},
|
|
544
|
+
description: string
|
|
545
|
+
}
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### Haiku
|
|
549
|
+
|
|
550
|
+
```typescript
|
|
551
|
+
{
|
|
552
|
+
line1: string, // 5 syllables
|
|
553
|
+
line2: string, // 7 syllables
|
|
554
|
+
line3: string // 5 syllables
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### NameSuggestion
|
|
559
|
+
|
|
560
|
+
```typescript
|
|
561
|
+
{
|
|
562
|
+
name: string,
|
|
563
|
+
reasoning: string,
|
|
564
|
+
alternatives: string[]
|
|
565
|
+
}
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### ValidationResult
|
|
569
|
+
|
|
570
|
+
```typescript
|
|
571
|
+
{
|
|
572
|
+
status: 'valid' | 'invalid',
|
|
573
|
+
reason: string,
|
|
574
|
+
suggestedFixes?: string[]
|
|
575
|
+
}
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
---
|
|
579
|
+
|
|
580
|
+
## Architecture Highlights
|
|
581
|
+
|
|
582
|
+
### Multi-Modal Input Convergence
|
|
583
|
+
|
|
584
|
+
Photo Analyzer and Description Parser both produce `CatCharacteristics` schema. This enables pipelines that accept **either** images **or** text descriptions interchangeably.
|
|
585
|
+
|
|
586
|
+
```typescript
|
|
587
|
+
// Pipeline works with EITHER input type
|
|
588
|
+
const characteristics = isImage(input)
|
|
589
|
+
? await analyzePhoto(input)
|
|
590
|
+
: await parseDescription(input);
|
|
591
|
+
|
|
592
|
+
const name = await generateCatName(characteristics);
|
|
593
|
+
const haiku = await generateHaiku(characteristics);
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
### Feedback Loop Testing
|
|
597
|
+
|
|
598
|
+
Name Generator → Name Validator creates a realistic feedback loop:
|
|
599
|
+
- Generator creates names without knowledge of rules
|
|
600
|
+
- Validator rejects ~60-70% of names (quirky rules)
|
|
601
|
+
- Forces retry/iteration patterns
|
|
602
|
+
- Tests multi-turn orchestration
|
|
603
|
+
|
|
604
|
+
### Framework Portability
|
|
605
|
+
|
|
606
|
+
All agents are **plain TypeScript functions** with no framework dependencies. Runtime adapters translate agents to framework-specific formats:
|
|
607
|
+
|
|
608
|
+
- **Vercel AI SDK**: Agents → Tools with `execute` functions
|
|
609
|
+
- **LangChain**: Agents → Tools with structured I/O
|
|
610
|
+
- **Claude Agent SDK**: Agents → Agent objects with tool handlers
|
|
611
|
+
- **n8n**: Agents → Custom nodes with visual wiring
|
|
612
|
+
|
|
613
|
+
**Same agents, different orchestration.**
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## Development
|
|
618
|
+
|
|
619
|
+
```bash
|
|
620
|
+
# Install dependencies
|
|
621
|
+
bun install
|
|
622
|
+
|
|
623
|
+
# Build
|
|
624
|
+
bun run build
|
|
625
|
+
|
|
626
|
+
# Run tests
|
|
627
|
+
bun run test
|
|
628
|
+
|
|
629
|
+
# Type check
|
|
630
|
+
bun run typecheck
|
|
631
|
+
|
|
632
|
+
# Lint
|
|
633
|
+
bun run lint
|
|
634
|
+
|
|
635
|
+
# Run demos
|
|
636
|
+
bun run demo:photos
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
---
|
|
640
|
+
|
|
641
|
+
## Test Fixtures
|
|
642
|
+
|
|
643
|
+
### Processing Cat Photos
|
|
644
|
+
|
|
645
|
+
This package includes git-friendly test images with embedded EXIF metadata for realistic testing.
|
|
646
|
+
|
|
647
|
+
**Strategy:**
|
|
648
|
+
- Original images: 1-9MB each (too large for git)
|
|
649
|
+
- Processed images: 13-60KB each (git-friendly)
|
|
650
|
+
- Embedded EXIF metadata contains test expectations
|
|
651
|
+
- Mock mode reads EXIF instead of calling vision API
|
|
652
|
+
|
|
653
|
+
**Processing images:**
|
|
654
|
+
|
|
655
|
+
```bash
|
|
656
|
+
# From repo root
|
|
657
|
+
cd packages/dev-tools
|
|
658
|
+
bun run process-images ~/Downloads/cat-photos ../../vat-example-cat-agents/test/fixtures/photos/cats
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
See `@vibe-agent-toolkit/dev-tools` package for the `process-test-images.ts` utility.
|
|
662
|
+
|
|
663
|
+
**Fixture structure:**
|
|
664
|
+
|
|
665
|
+
```
|
|
666
|
+
test/fixtures/photos/
|
|
667
|
+
├── cats/ # Valid cat photos (4 images)
|
|
668
|
+
├── not-cats/ # Negative test cases (bear, robot)
|
|
669
|
+
└── cat-like/ # Ambiguous cases (future: stuffed animals, statues)
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
## Contributing
|
|
675
|
+
|
|
676
|
+
This is a reference implementation that evolves with the VAT framework. Each new archetype implementation helps validate the framework design.
|
|
677
|
+
|
|
678
|
+
**Current priorities:**
|
|
679
|
+
1. Complete remaining LLM analyzer agents (conversational assistant)
|
|
680
|
+
2. Implement agentic researcher (ReAct pattern with tools)
|
|
681
|
+
3. Add workflow orchestrator (multi-agent pipelines)
|
|
682
|
+
4. Demonstrate event-driven patterns (consumers and handlers)
|
|
683
|
+
|
|
684
|
+
See [CLAUDE.md](./CLAUDE.md) for technical navigation details when contributing.
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
## Documentation
|
|
689
|
+
|
|
690
|
+
- **[STRUCTURE.md](./STRUCTURE.md)** - Package organization and conventions
|
|
691
|
+
- **[CLAUDE.md](./CLAUDE.md)** - Technical navigation for AI assistants
|
|
692
|
+
|
|
693
|
+
---
|
|
694
|
+
|
|
695
|
+
## License
|
|
696
|
+
|
|
697
|
+
MIT
|