@intentsolutionsio/ai-sdk-agents 1.0.0
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/.claude-plugin/plugin.json +27 -0
- package/LICENSE +21 -0
- package/README.md +951 -0
- package/agents/multi-agent-orchestrator.md +363 -0
- package/commands/ai-agent-create.md +501 -0
- package/commands/ai-agents-setup.md +429 -0
- package/commands/ai-agents-test.md +529 -0
- package/package.json +49 -0
- package/skills/orchestrating-multi-agent-systems/SKILL.md +81 -0
- package/skills/orchestrating-multi-agent-systems/assets/README.md +7 -0
- package/skills/orchestrating-multi-agent-systems/assets/agent_template.ts +110 -0
- package/skills/orchestrating-multi-agent-systems/assets/example_coordinator.ts +100 -0
- package/skills/orchestrating-multi-agent-systems/assets/example_workflow.json +143 -0
- package/skills/orchestrating-multi-agent-systems/references/README.md +4 -0
- package/skills/orchestrating-multi-agent-systems/references/errors.md +26 -0
- package/skills/orchestrating-multi-agent-systems/references/examples.md +418 -0
- package/skills/orchestrating-multi-agent-systems/references/implementation.md +39 -0
- package/skills/orchestrating-multi-agent-systems/scripts/README.md +11 -0
- package/skills/orchestrating-multi-agent-systems/scripts/agent_setup.sh +94 -0
- package/skills/orchestrating-multi-agent-systems/scripts/dependency_installer.sh +100 -0
- package/skills/orchestrating-multi-agent-systems/scripts/env_setup.sh +94 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
# Examples ā Orchestrating Multi-Agent Systems (AI SDK v5)
|
|
2
|
+
|
|
3
|
+
## Example 1: Customer Support Triage System
|
|
4
|
+
|
|
5
|
+
A coordinator agent classifies incoming support tickets and hands off to specialist agents.
|
|
6
|
+
|
|
7
|
+
### Setup
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
// package.json dependencies
|
|
11
|
+
// "ai": "^5.0.0", "@ai-sdk/openai": "^1.0.0", "@ai-sdk/anthropic": "^1.0.0", "zod": "^3.23.0"
|
|
12
|
+
|
|
13
|
+
import { openai } from "@ai-sdk/openai";
|
|
14
|
+
import { anthropic } from "@ai-sdk/anthropic";
|
|
15
|
+
import { generateText, tool } from "ai";
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Agent Definitions
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// agents/triage-agent.ts
|
|
23
|
+
import { generateText, tool } from "ai";
|
|
24
|
+
import { openai } from "@ai-sdk/openai";
|
|
25
|
+
import { z } from "zod";
|
|
26
|
+
|
|
27
|
+
const classifyTicket = tool({
|
|
28
|
+
description: "Classify a support ticket into a category",
|
|
29
|
+
parameters: z.object({
|
|
30
|
+
ticket: z.string().describe("The support ticket text"),
|
|
31
|
+
}),
|
|
32
|
+
execute: async ({ ticket }) => {
|
|
33
|
+
const { text } = await generateText({
|
|
34
|
+
model: openai("gpt-4o-mini"),
|
|
35
|
+
prompt: `Classify this ticket into exactly one category: billing, technical, general.\n\nTicket: ${ticket}\n\nRespond with only the category name.`,
|
|
36
|
+
});
|
|
37
|
+
return { category: text.trim().toLowerCase() };
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export async function triageTicket(ticket: string) {
|
|
42
|
+
const result = await classifyTicket.execute({ ticket }, { toolCallId: "triage", messages: [] });
|
|
43
|
+
return result.category;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// agents/billing-agent.ts
|
|
49
|
+
import { generateText, tool } from "ai";
|
|
50
|
+
import { anthropic } from "@ai-sdk/anthropic";
|
|
51
|
+
import { z } from "zod";
|
|
52
|
+
|
|
53
|
+
const lookupInvoice = tool({
|
|
54
|
+
description: "Look up a customer invoice by ID",
|
|
55
|
+
parameters: z.object({
|
|
56
|
+
customerId: z.string(),
|
|
57
|
+
}),
|
|
58
|
+
execute: async ({ customerId }) => {
|
|
59
|
+
// Simulated Stripe lookup
|
|
60
|
+
return {
|
|
61
|
+
customerId,
|
|
62
|
+
lastInvoice: "INV-2024-1234",
|
|
63
|
+
amount: 99.00,
|
|
64
|
+
status: "paid",
|
|
65
|
+
date: "2024-12-01",
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export async function handleBillingQuery(ticket: string, customerId: string) {
|
|
71
|
+
const { text } = await generateText({
|
|
72
|
+
model: anthropic("claude-sonnet-4-20250514"),
|
|
73
|
+
system: `You are a billing support specialist. Use the invoice lookup tool to answer billing questions. Be concise and helpful.`,
|
|
74
|
+
prompt: `Customer ${customerId} asks: ${ticket}`,
|
|
75
|
+
tools: { lookupInvoice },
|
|
76
|
+
maxSteps: 3,
|
|
77
|
+
});
|
|
78
|
+
return text;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// agents/technical-agent.ts
|
|
84
|
+
import { generateText, tool } from "ai";
|
|
85
|
+
import { openai } from "@ai-sdk/openai";
|
|
86
|
+
import { z } from "zod";
|
|
87
|
+
|
|
88
|
+
const searchDocs = tool({
|
|
89
|
+
description: "Search technical documentation",
|
|
90
|
+
parameters: z.object({
|
|
91
|
+
query: z.string(),
|
|
92
|
+
}),
|
|
93
|
+
execute: async ({ query }) => {
|
|
94
|
+
// Simulated doc search
|
|
95
|
+
return {
|
|
96
|
+
results: [
|
|
97
|
+
{ title: "API Rate Limits", content: "Default rate limit is 100 req/min..." },
|
|
98
|
+
{ title: "Authentication Guide", content: "Use Bearer tokens for API auth..." },
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export async function handleTechnicalQuery(ticket: string) {
|
|
105
|
+
const { text } = await generateText({
|
|
106
|
+
model: openai("gpt-4o"),
|
|
107
|
+
system: `You are a technical support engineer. Search docs to find solutions. Provide step-by-step fixes.`,
|
|
108
|
+
prompt: ticket,
|
|
109
|
+
tools: { searchDocs },
|
|
110
|
+
maxSteps: 5,
|
|
111
|
+
});
|
|
112
|
+
return text;
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Coordinator Orchestration
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
// orchestrator.ts
|
|
120
|
+
import { triageTicket } from "./agents/triage-agent";
|
|
121
|
+
import { handleBillingQuery } from "./agents/billing-agent";
|
|
122
|
+
import { handleTechnicalQuery } from "./agents/technical-agent";
|
|
123
|
+
import { generateText } from "ai";
|
|
124
|
+
import { openai } from "@ai-sdk/openai";
|
|
125
|
+
|
|
126
|
+
interface TicketResult {
|
|
127
|
+
ticketId: string;
|
|
128
|
+
category: string;
|
|
129
|
+
resolution: string;
|
|
130
|
+
handoffDepth: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export async function processTicket(
|
|
134
|
+
ticketId: string,
|
|
135
|
+
ticketText: string,
|
|
136
|
+
customerId: string,
|
|
137
|
+
maxHandoffDepth: number = 3
|
|
138
|
+
): Promise<TicketResult> {
|
|
139
|
+
let handoffDepth = 0;
|
|
140
|
+
|
|
141
|
+
// Step 1: Classify the ticket
|
|
142
|
+
const category = await triageTicket(ticketText);
|
|
143
|
+
handoffDepth++;
|
|
144
|
+
|
|
145
|
+
// Step 2: Route to specialist
|
|
146
|
+
let resolution: string;
|
|
147
|
+
switch (category) {
|
|
148
|
+
case "billing":
|
|
149
|
+
resolution = await handleBillingQuery(ticketText, customerId);
|
|
150
|
+
handoffDepth++;
|
|
151
|
+
break;
|
|
152
|
+
case "technical":
|
|
153
|
+
resolution = await handleTechnicalQuery(ticketText);
|
|
154
|
+
handoffDepth++;
|
|
155
|
+
break;
|
|
156
|
+
default:
|
|
157
|
+
// General queries handled by a simple generation
|
|
158
|
+
const { text } = await generateText({
|
|
159
|
+
model: openai("gpt-4o-mini"),
|
|
160
|
+
prompt: `Answer this customer question helpfully: ${ticketText}`,
|
|
161
|
+
});
|
|
162
|
+
resolution = text;
|
|
163
|
+
handoffDepth++;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return { ticketId, category, resolution, handoffDepth };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Usage
|
|
170
|
+
const result = await processTicket(
|
|
171
|
+
"TK-5678",
|
|
172
|
+
"I was charged twice for my subscription last month",
|
|
173
|
+
"CUST-1234"
|
|
174
|
+
);
|
|
175
|
+
console.log(result);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Expected Output
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"ticketId": "TK-5678",
|
|
183
|
+
"category": "billing",
|
|
184
|
+
"resolution": "I found your last invoice INV-2024-1234 for $99.00 dated 2024-12-01, which shows as paid. Let me look into the duplicate charge. I recommend contacting your payment processor to dispute the second charge, or I can escalate this to our billing team for a refund.",
|
|
185
|
+
"handoffDepth": 2
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Example 2: Research Pipeline (Sequential Workflow)
|
|
192
|
+
|
|
193
|
+
A sequential chain of agents: web search, summarization, and report writing.
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// pipeline/research-pipeline.ts
|
|
197
|
+
import { generateText, tool } from "ai";
|
|
198
|
+
import { openai } from "@ai-sdk/openai";
|
|
199
|
+
import { z } from "zod";
|
|
200
|
+
|
|
201
|
+
// Schema for structured data passing between agents
|
|
202
|
+
const ResearchResultSchema = z.object({
|
|
203
|
+
query: z.string(),
|
|
204
|
+
sources: z.array(z.object({
|
|
205
|
+
title: z.string(),
|
|
206
|
+
url: z.string(),
|
|
207
|
+
snippet: z.string(),
|
|
208
|
+
})),
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const SummarySchema = z.object({
|
|
212
|
+
query: z.string(),
|
|
213
|
+
keyFindings: z.array(z.string()),
|
|
214
|
+
themes: z.array(z.string()),
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// Agent 1: Web Search Agent
|
|
218
|
+
async function searchAgent(query: string) {
|
|
219
|
+
const webSearch = tool({
|
|
220
|
+
description: "Search the web for information",
|
|
221
|
+
parameters: z.object({ query: z.string() }),
|
|
222
|
+
execute: async ({ query }) => ({
|
|
223
|
+
sources: [
|
|
224
|
+
{ title: "AI Trends 2025", url: "https://example.com/ai-trends", snippet: "Key developments in AI..." },
|
|
225
|
+
{ title: "LLM Benchmarks", url: "https://example.com/benchmarks", snippet: "Latest model comparisons..." },
|
|
226
|
+
{ title: "Enterprise AI Adoption", url: "https://example.com/enterprise", snippet: "82% of enterprises now use AI..." },
|
|
227
|
+
],
|
|
228
|
+
}),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const { text } = await generateText({
|
|
232
|
+
model: openai("gpt-4o-mini"),
|
|
233
|
+
system: "You are a research assistant. Search for relevant sources and return structured results as JSON.",
|
|
234
|
+
prompt: `Find sources about: ${query}. Return JSON with query and sources array.`,
|
|
235
|
+
tools: { webSearch },
|
|
236
|
+
maxSteps: 3,
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
return JSON.parse(text);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Agent 2: Summarization Agent
|
|
243
|
+
async function summarizeAgent(researchResults: z.infer<typeof ResearchResultSchema>) {
|
|
244
|
+
const { text } = await generateText({
|
|
245
|
+
model: openai("gpt-4o"),
|
|
246
|
+
system: "You are an expert summarizer. Extract key findings and themes from research sources. Return JSON.",
|
|
247
|
+
prompt: `Summarize these research results:\n${JSON.stringify(researchResults, null, 2)}\n\nReturn JSON with keyFindings (array of strings) and themes (array of strings).`,
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
return JSON.parse(text);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Agent 3: Report Writer Agent
|
|
254
|
+
async function reportAgent(summary: z.infer<typeof SummarySchema>) {
|
|
255
|
+
const { text } = await generateText({
|
|
256
|
+
model: openai("gpt-4o"),
|
|
257
|
+
system: "You are a professional report writer. Create a concise executive summary from the provided analysis.",
|
|
258
|
+
prompt: `Write a 200-word executive report based on:\nFindings: ${summary.keyFindings.join("; ")}\nThemes: ${summary.themes.join(", ")}`,
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
return text;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Sequential pipeline orchestrator
|
|
265
|
+
async function runResearchPipeline(query: string) {
|
|
266
|
+
console.time("pipeline");
|
|
267
|
+
|
|
268
|
+
const sources = await searchAgent(query);
|
|
269
|
+
console.log(`[Search] Found ${sources.sources.length} sources`);
|
|
270
|
+
|
|
271
|
+
const summary = await summarizeAgent(sources);
|
|
272
|
+
console.log(`[Summary] Extracted ${summary.keyFindings.length} findings`);
|
|
273
|
+
|
|
274
|
+
const report = await reportAgent(summary);
|
|
275
|
+
console.log(`[Report] Generated ${report.split(" ").length} word report`);
|
|
276
|
+
|
|
277
|
+
console.timeEnd("pipeline");
|
|
278
|
+
|
|
279
|
+
return { sources, summary, report };
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Usage
|
|
283
|
+
const pipeline = await runResearchPipeline("AI agent frameworks 2025");
|
|
284
|
+
console.log(pipeline.report);
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Expected Output
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
[Search] Found 3 sources
|
|
291
|
+
[Summary] Extracted 4 findings
|
|
292
|
+
[Report] Generated 195 word report
|
|
293
|
+
pipeline: 8.2s
|
|
294
|
+
|
|
295
|
+
Executive Report: AI Agent Frameworks 2025
|
|
296
|
+
|
|
297
|
+
The landscape of AI agent frameworks has matured significantly in 2025...
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Example 3: Code Review Multi-Agent with Supervisor
|
|
303
|
+
|
|
304
|
+
Parallel specialist reviewers aggregated by a supervisor.
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
// review/code-review-system.ts
|
|
308
|
+
import { generateText } from "ai";
|
|
309
|
+
import { openai } from "@ai-sdk/openai";
|
|
310
|
+
import { z } from "zod";
|
|
311
|
+
|
|
312
|
+
interface ReviewFinding {
|
|
313
|
+
file: string;
|
|
314
|
+
line: number;
|
|
315
|
+
severity: "critical" | "warning" | "info";
|
|
316
|
+
category: string;
|
|
317
|
+
message: string;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Specialist: Security Reviewer
|
|
321
|
+
async function securityReview(diff: string): Promise<ReviewFinding[]> {
|
|
322
|
+
const { text } = await generateText({
|
|
323
|
+
model: openai("gpt-4o"),
|
|
324
|
+
system: `You are a security code reviewer. Analyze diffs for vulnerabilities: SQL injection, XSS, hardcoded secrets, insecure crypto, SSRF. Return JSON array of findings with file, line, severity, category, message.`,
|
|
325
|
+
prompt: `Review this diff for security issues:\n\n${diff}`,
|
|
326
|
+
});
|
|
327
|
+
return JSON.parse(text);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Specialist: Performance Reviewer
|
|
331
|
+
async function performanceReview(diff: string): Promise<ReviewFinding[]> {
|
|
332
|
+
const { text } = await generateText({
|
|
333
|
+
model: openai("gpt-4o"),
|
|
334
|
+
system: `You are a performance code reviewer. Analyze diffs for N+1 queries, missing indexes, unbounded loops, memory leaks, blocking I/O. Return JSON array of findings.`,
|
|
335
|
+
prompt: `Review this diff for performance issues:\n\n${diff}`,
|
|
336
|
+
});
|
|
337
|
+
return JSON.parse(text);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Specialist: Style Reviewer
|
|
341
|
+
async function styleReview(diff: string): Promise<ReviewFinding[]> {
|
|
342
|
+
const { text } = await generateText({
|
|
343
|
+
model: openai("gpt-4o-mini"),
|
|
344
|
+
system: `You are a code style reviewer. Check naming conventions, function length, complexity, documentation. Return JSON array of findings.`,
|
|
345
|
+
prompt: `Review this diff for style issues:\n\n${diff}`,
|
|
346
|
+
});
|
|
347
|
+
return JSON.parse(text);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Supervisor: Aggregate and prioritize
|
|
351
|
+
async function supervisorAggregate(allFindings: ReviewFinding[]): Promise<string> {
|
|
352
|
+
const { text } = await generateText({
|
|
353
|
+
model: openai("gpt-4o"),
|
|
354
|
+
system: `You are a senior engineering lead. Aggregate code review findings into a unified report. Prioritize critical items first. Deduplicate similar findings. Format as a clear, actionable review comment.`,
|
|
355
|
+
prompt: `Create a unified code review from these findings:\n${JSON.stringify(allFindings, null, 2)}`,
|
|
356
|
+
});
|
|
357
|
+
return text;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// Orchestrator: parallel fan-out, fan-in
|
|
361
|
+
export async function reviewPullRequest(diff: string) {
|
|
362
|
+
// Fan out to specialists in parallel
|
|
363
|
+
const [security, performance, style] = await Promise.all([
|
|
364
|
+
securityReview(diff),
|
|
365
|
+
performanceReview(diff),
|
|
366
|
+
styleReview(diff),
|
|
367
|
+
]);
|
|
368
|
+
|
|
369
|
+
const allFindings = [...security, ...performance, ...style];
|
|
370
|
+
const criticalCount = allFindings.filter(f => f.severity === "critical").length;
|
|
371
|
+
|
|
372
|
+
// Fan in to supervisor
|
|
373
|
+
const unifiedReview = await supervisorAggregate(allFindings);
|
|
374
|
+
|
|
375
|
+
return {
|
|
376
|
+
totalFindings: allFindings.length,
|
|
377
|
+
criticalCount,
|
|
378
|
+
breakdown: {
|
|
379
|
+
security: security.length,
|
|
380
|
+
performance: performance.length,
|
|
381
|
+
style: style.length,
|
|
382
|
+
},
|
|
383
|
+
review: unifiedReview,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Usage
|
|
388
|
+
const review = await reviewPullRequest(`
|
|
389
|
+
diff --git a/src/api/users.ts b/src/api/users.ts
|
|
390
|
+
+ const user = await db.query(\`SELECT * FROM users WHERE id = \${req.params.id}\`);
|
|
391
|
+
+ const password = "admin123";
|
|
392
|
+
`);
|
|
393
|
+
|
|
394
|
+
console.log(`Findings: ${review.totalFindings} (${review.criticalCount} critical)`);
|
|
395
|
+
console.log(review.review);
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Expected Output
|
|
399
|
+
|
|
400
|
+
```
|
|
401
|
+
Findings: 5 (2 critical)
|
|
402
|
+
|
|
403
|
+
## Code Review Summary
|
|
404
|
+
|
|
405
|
+
### Critical Issues
|
|
406
|
+
1. **SQL Injection** (src/api/users.ts:1) ā String interpolation in SQL query. Use parameterized queries: `db.query('SELECT * FROM users WHERE id = $1', [req.params.id])`
|
|
407
|
+
2. **Hardcoded Secret** (src/api/users.ts:2) ā Password "admin123" is hardcoded. Move to environment variable or secret manager.
|
|
408
|
+
|
|
409
|
+
### Warnings
|
|
410
|
+
3. **SELECT *** (src/api/users.ts:1) ā Avoid SELECT *; specify only needed columns for performance.
|
|
411
|
+
|
|
412
|
+
### Suggestions
|
|
413
|
+
4. Input validation missing for `req.params.id` ā add Zod schema validation.
|
|
414
|
+
5. Consider adding rate limiting to this endpoint.
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Implementation Guide
|
|
2
|
+
|
|
3
|
+
### Step 1: Initialize Project Structure
|
|
4
|
+
Set up the foundation for your multi-agent system:
|
|
5
|
+
1. Create project directory with necessary subdirectories
|
|
6
|
+
2. Initialize npm project with TypeScript configuration
|
|
7
|
+
3. Install AI SDK v5 and provider-specific packages
|
|
8
|
+
4. Set up configuration files for agent orchestration
|
|
9
|
+
|
|
10
|
+
### Step 2: Define Agent Roles
|
|
11
|
+
Identify and specify specialized agents needed:
|
|
12
|
+
- Determine agent responsibilities and capabilities
|
|
13
|
+
- Define agent system prompts with clear instructions
|
|
14
|
+
- Specify tools each agent can access
|
|
15
|
+
- Establish agent communication protocols
|
|
16
|
+
|
|
17
|
+
### Step 3: Implement Agents
|
|
18
|
+
Create individual agent files with proper configuration:
|
|
19
|
+
1. Write agent initialization code with AI SDK
|
|
20
|
+
2. Configure system prompts for agent behavior
|
|
21
|
+
3. Define tool functions for agent capabilities
|
|
22
|
+
4. Implement handoff rules for inter-agent delegation
|
|
23
|
+
|
|
24
|
+
### Step 4: Configure Orchestration
|
|
25
|
+
Set up coordination between agents:
|
|
26
|
+
- Define workflow sequences for task processing
|
|
27
|
+
- Implement routing logic for task distribution
|
|
28
|
+
- Configure handoff mechanisms between agents
|
|
29
|
+
- Set up state management for multi-step workflows
|
|
30
|
+
|
|
31
|
+
### Step 5: Test and Refine
|
|
32
|
+
Validate the multi-agent system functionality:
|
|
33
|
+
- Test individual agent responses and behaviors
|
|
34
|
+
- Verify handoff execution between agents
|
|
35
|
+
- Validate routing logic with different input scenarios
|
|
36
|
+
- Monitor coordination and identify bottlenecks
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Scripts
|
|
2
|
+
|
|
3
|
+
Bundled resources for ai-sdk-agents skill
|
|
4
|
+
|
|
5
|
+
- [x] agent_setup.sh: Automates the creation of agent files and configuration based on user input.
|
|
6
|
+
- [x] dependency_installer.sh: Installs necessary npm packages for the agents.
|
|
7
|
+
- [x] env_setup.sh: Creates and populates .env file with API keys based on user input.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Auto-Generated
|
|
11
|
+
Scripts generated on 2025-12-10 03:48:17
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
ai-sdk-agents - Initialization Script
|
|
4
|
+
Automates the creation of agent files and configuration based on user input.
|
|
5
|
+
Generated: 2025-12-10 03:48:17
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import json
|
|
10
|
+
import argparse
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
def create_project_structure(project_name: str, output_dir: str = "."):
|
|
14
|
+
"""Create project structure for ai-sdk-agents."""
|
|
15
|
+
base_path = Path(output_dir) / project_name
|
|
16
|
+
|
|
17
|
+
# Create directories
|
|
18
|
+
directories = [
|
|
19
|
+
base_path,
|
|
20
|
+
base_path / "config",
|
|
21
|
+
base_path / "data",
|
|
22
|
+
base_path / "output",
|
|
23
|
+
base_path / "logs"
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
for dir_path in directories:
|
|
27
|
+
dir_path.mkdir(parents=True, exist_ok=True)
|
|
28
|
+
print(f"ā Created {dir_path}")
|
|
29
|
+
|
|
30
|
+
# Create configuration file
|
|
31
|
+
config = {
|
|
32
|
+
"project": project_name,
|
|
33
|
+
"version": "1.0.0",
|
|
34
|
+
"skill": "ai-sdk-agents",
|
|
35
|
+
"category": "ai-ml",
|
|
36
|
+
"created": time.strftime('%Y-%m-%d %H:%M:%S'),
|
|
37
|
+
"settings": {
|
|
38
|
+
"debug": False,
|
|
39
|
+
"verbose": True,
|
|
40
|
+
"max_workers": 4
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
config_file = base_path / "config" / "settings.json"
|
|
45
|
+
with open(config_file, 'w') as f:
|
|
46
|
+
json.dump(config, f, indent=2)
|
|
47
|
+
print(f"ā Created configuration: {config_file}")
|
|
48
|
+
|
|
49
|
+
# Create README
|
|
50
|
+
readme_content = f"""# {project_name}
|
|
51
|
+
|
|
52
|
+
Initialized with ai-sdk-agents skill
|
|
53
|
+
|
|
54
|
+
## Structure
|
|
55
|
+
- config/ - Configuration files
|
|
56
|
+
- data/ - Input data
|
|
57
|
+
- output/ - Generated output
|
|
58
|
+
- logs/ - Application logs
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
See skill documentation for usage instructions.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
readme_file = base_path / "README.md"
|
|
65
|
+
readme_file.write_text(readme_content)
|
|
66
|
+
print(f"ā Created README: {readme_file}")
|
|
67
|
+
|
|
68
|
+
return base_path
|
|
69
|
+
|
|
70
|
+
def main():
|
|
71
|
+
parser = argparse.ArgumentParser(description="Automates the creation of agent files and configuration based on user input.")
|
|
72
|
+
parser.add_argument('--project', '-p', required=True, help='Project name')
|
|
73
|
+
parser.add_argument('--output', '-o', default='.', help='Output directory')
|
|
74
|
+
parser.add_argument('--config', '-c', help='Configuration file')
|
|
75
|
+
|
|
76
|
+
args = parser.parse_args()
|
|
77
|
+
|
|
78
|
+
print(f"š Initializing {args.project}...")
|
|
79
|
+
project_path = create_project_structure(args.project, args.output)
|
|
80
|
+
|
|
81
|
+
if args.config:
|
|
82
|
+
# Load additional configuration
|
|
83
|
+
if Path(args.config).exists():
|
|
84
|
+
with open(args.config) as f:
|
|
85
|
+
extra_config = json.load(f)
|
|
86
|
+
print(f"ā Loaded configuration from {args.config}")
|
|
87
|
+
|
|
88
|
+
print(f"\nā
Project initialized successfully at {project_path}")
|
|
89
|
+
return 0
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
import sys
|
|
93
|
+
import time
|
|
94
|
+
sys.exit(main())
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
ai-sdk-agents - dependency_installer.sh
|
|
4
|
+
Installs necessary npm packages for the agents.
|
|
5
|
+
Generated: 2025-12-10 03:48:17
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
import json
|
|
11
|
+
import argparse
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from datetime import datetime
|
|
14
|
+
|
|
15
|
+
def process_file(file_path: Path) -> bool:
|
|
16
|
+
"""Process individual file."""
|
|
17
|
+
if not file_path.exists():
|
|
18
|
+
print(f"ā File not found: {file_path}")
|
|
19
|
+
return False
|
|
20
|
+
|
|
21
|
+
print(f"š Processing: {file_path}")
|
|
22
|
+
|
|
23
|
+
# Add processing logic here based on skill requirements
|
|
24
|
+
# This is a template that can be customized
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
if file_path.suffix == '.json':
|
|
28
|
+
with open(file_path) as f:
|
|
29
|
+
data = json.load(f)
|
|
30
|
+
print(f" ā Valid JSON with {len(data)} keys")
|
|
31
|
+
else:
|
|
32
|
+
size = file_path.stat().st_size
|
|
33
|
+
print(f" ā File size: {size:,} bytes")
|
|
34
|
+
|
|
35
|
+
return True
|
|
36
|
+
except Exception as e:
|
|
37
|
+
print(f" ā Error: {e}")
|
|
38
|
+
return False
|
|
39
|
+
|
|
40
|
+
def process_directory(dir_path: Path) -> int:
|
|
41
|
+
"""Process all files in directory."""
|
|
42
|
+
processed = 0
|
|
43
|
+
failed = 0
|
|
44
|
+
|
|
45
|
+
for file_path in dir_path.rglob('*'):
|
|
46
|
+
if file_path.is_file():
|
|
47
|
+
if process_file(file_path):
|
|
48
|
+
processed += 1
|
|
49
|
+
else:
|
|
50
|
+
failed += 1
|
|
51
|
+
|
|
52
|
+
return processed, failed
|
|
53
|
+
|
|
54
|
+
def main():
|
|
55
|
+
parser = argparse.ArgumentParser(
|
|
56
|
+
description="Installs necessary npm packages for the agents."
|
|
57
|
+
)
|
|
58
|
+
parser.add_argument('input', help='Input file or directory')
|
|
59
|
+
parser.add_argument('--output', '-o', help='Output directory')
|
|
60
|
+
parser.add_argument('--verbose', '-v', action='store_true', help='Verbose output')
|
|
61
|
+
parser.add_argument('--config', '-c', help='Configuration file')
|
|
62
|
+
|
|
63
|
+
args = parser.parse_args()
|
|
64
|
+
|
|
65
|
+
input_path = Path(args.input)
|
|
66
|
+
|
|
67
|
+
print(f"š ai-sdk-agents - dependency_installer.sh")
|
|
68
|
+
print(f" Category: ai-ml")
|
|
69
|
+
print(f" Plugin: ai-sdk-agents")
|
|
70
|
+
print(f" Input: {input_path}")
|
|
71
|
+
|
|
72
|
+
if args.config:
|
|
73
|
+
if Path(args.config).exists():
|
|
74
|
+
with open(args.config) as f:
|
|
75
|
+
config = json.load(f)
|
|
76
|
+
print(f" Config: {args.config}")
|
|
77
|
+
|
|
78
|
+
# Process input
|
|
79
|
+
if input_path.is_file():
|
|
80
|
+
success = process_file(input_path)
|
|
81
|
+
result = 0 if success else 1
|
|
82
|
+
elif input_path.is_dir():
|
|
83
|
+
processed, failed = process_directory(input_path)
|
|
84
|
+
print(f"\nš SUMMARY")
|
|
85
|
+
print(f" ā
Processed: {processed}")
|
|
86
|
+
print(f" ā Failed: {failed}")
|
|
87
|
+
result = 0 if failed == 0 else 1
|
|
88
|
+
else:
|
|
89
|
+
print(f"ā Invalid input: {input_path}")
|
|
90
|
+
result = 1
|
|
91
|
+
|
|
92
|
+
if result == 0:
|
|
93
|
+
print("\nā
Completed successfully")
|
|
94
|
+
else:
|
|
95
|
+
print("\nā Completed with errors")
|
|
96
|
+
|
|
97
|
+
return result
|
|
98
|
+
|
|
99
|
+
if __name__ == "__main__":
|
|
100
|
+
sys.exit(main())
|