agentnet 0.0.1 → 0.0.3
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 +317 -364
- package/_OLD_README.md +554 -0
- package/assets/network01.png +0 -0
- package/examples/customer-support/README.md +66 -0
- package/examples/customer-support/agents.yaml +457 -0
- package/examples/customer-support/index.js +408 -0
- package/examples/event-planner/README.md +69 -0
- package/examples/event-planner/agents.yaml +318 -0
- package/examples/event-planner/index.js +547 -0
- package/{src/examples → examples/simple}/simple.js +2 -2
- package/{src/examples → examples/smartness}/agents-smartness.yaml +8 -17
- package/{src/examples/def3.js → examples/smartness/index.js} +9 -9
- package/jest.config.js +1 -0
- package/package.json +6 -3
- package/src/agent/agent-loader.js +75 -12
- package/src/agent/agent.js +13 -3
- package/src/agent/runtime.js +9 -6
- package/src/llm/base.js +131 -0
- package/src/llm/gemini.js +137 -117
- package/src/llm/gpt.js +131 -104
- package/src/store/store.js +82 -48
- package/src/tests/agent.test.js +350 -0
- package/src/tools/migrate-version.js +250 -0
- package/src/transport/README.md +123 -0
- package/src/transport/base.js +237 -0
- package/src/transport/index.js +89 -0
- package/src/transport/kafka.js +474 -0
- package/src/transport/nats.js +521 -0
- package/src/transport/rabbitmq.js +722 -0
- package/src/transport/redis.js +532 -0
- package/src/utils/version.js +212 -0
- package/src/agent/runtimes/nats.js +0 -379
- package/src/examples/agents.yaml +0 -394
- package/src/examples/def.js +0 -74
- package/src/examples/def2.js +0 -65
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { AgentLoaderFile, Message, Bindings, NatsIO, MemoryStore, AgentClient } from "../../src/index.js";
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
+
|
|
4
|
+
// Mock database for demonstration purposes
|
|
5
|
+
const mockDatabase = {
|
|
6
|
+
products: {
|
|
7
|
+
"prod-001": {
|
|
8
|
+
name: "SuperWidget Pro",
|
|
9
|
+
features: "Advanced automation, Smart connectivity, Voice control",
|
|
10
|
+
specs: "Dimensions: 10x5x2cm, Weight: 200g, Battery life: 48 hours",
|
|
11
|
+
compatibility: "Works with iOS 14+, Android 10+, Windows 10"
|
|
12
|
+
},
|
|
13
|
+
"prod-002": {
|
|
14
|
+
name: "MegaGadget Plus",
|
|
15
|
+
features: "Touch display, Water-resistant, Motion sensing",
|
|
16
|
+
specs: "Dimensions: 15x8x3cm, Weight: 350g, Battery life: 36 hours",
|
|
17
|
+
compatibility: "Works with iOS 13+, Android 9+, MacOS 11+"
|
|
18
|
+
},
|
|
19
|
+
"prod-003": {
|
|
20
|
+
name: "TechTool Ultimate",
|
|
21
|
+
features: "Remote diagnostics, Predictive maintenance, Cloud backup",
|
|
22
|
+
specs: "Dimensions: 20x12x5cm, Weight: 500g, Power: 110-240V",
|
|
23
|
+
compatibility: "Compatible with all major operating systems and smart home hubs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
customers: {
|
|
27
|
+
"cust-001": {
|
|
28
|
+
name: "Jane Smith",
|
|
29
|
+
email: "jane.smith@example.com",
|
|
30
|
+
accountType: "Premium",
|
|
31
|
+
subscriptionStatus: "Active",
|
|
32
|
+
paymentHistory: [
|
|
33
|
+
{ date: "2023-09-15", amount: "$49.99", status: "Paid" },
|
|
34
|
+
{ date: "2023-08-15", amount: "$49.99", status: "Paid" }
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"cust-002": {
|
|
38
|
+
name: "John Doe",
|
|
39
|
+
email: "john.doe@example.com",
|
|
40
|
+
accountType: "Basic",
|
|
41
|
+
subscriptionStatus: "Trial",
|
|
42
|
+
paymentHistory: [
|
|
43
|
+
{ date: "2023-09-10", amount: "$0.00", status: "Trial" }
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
knownIssues: [
|
|
48
|
+
{
|
|
49
|
+
id: "KI-001",
|
|
50
|
+
productId: "prod-001",
|
|
51
|
+
symptoms: ["won't power on", "battery drain", "charging issue"],
|
|
52
|
+
solution: "Check charging cable and ensure battery is properly seated. If problem persists, try a factory reset by holding power + volume down for 10 seconds."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "KI-002",
|
|
56
|
+
productId: "prod-002",
|
|
57
|
+
symptoms: ["screen flickering", "display issues", "touch not responsive"],
|
|
58
|
+
solution: "Update to the latest firmware version. If problem persists, perform a soft reset by holding power for 5 seconds."
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
supportCases: {
|
|
62
|
+
"case-001": {
|
|
63
|
+
customerId: "cust-001",
|
|
64
|
+
productId: "prod-001",
|
|
65
|
+
status: "resolved",
|
|
66
|
+
issue: "Device won't connect to WiFi",
|
|
67
|
+
resolution: "Guided customer through network reset procedure",
|
|
68
|
+
agentNotes: "Customer was satisfied with the resolution"
|
|
69
|
+
},
|
|
70
|
+
"case-002": {
|
|
71
|
+
customerId: "cust-002",
|
|
72
|
+
productId: "prod-003",
|
|
73
|
+
status: "pending",
|
|
74
|
+
issue: "Software crashes during data backup",
|
|
75
|
+
resolution: null,
|
|
76
|
+
agentNotes: "Escalated to technical team for investigation"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Set up the NATS instance for inter-agent communication
|
|
82
|
+
const natsIO = NatsIO();
|
|
83
|
+
|
|
84
|
+
// Helper function to generate a unique case ID
|
|
85
|
+
function generateCaseId() {
|
|
86
|
+
return `case-${uuidv4().substring(0, 6)}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Main function to set up and demonstrate the customer support system
|
|
90
|
+
async function main() {
|
|
91
|
+
console.log("Loading customer support agents...");
|
|
92
|
+
|
|
93
|
+
// Load all agents from the YAML file
|
|
94
|
+
const agents = await AgentLoaderFile('./examples/customer-support/agents.yaml', {
|
|
95
|
+
bindings: { [Bindings.NatsIO]: natsIO, [Bindings.Memory]: MemoryStore() }
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Bind tool implementations for Triage Agent
|
|
99
|
+
agents.triageAgent.tools.categorizeQuery.bind(async (state, input) => {
|
|
100
|
+
const query = input.query.toLowerCase();
|
|
101
|
+
|
|
102
|
+
if (query.includes("price") || query.includes("subscription") || query.includes("refund") || query.includes("payment")) {
|
|
103
|
+
return { category: "billing" };
|
|
104
|
+
} else if (query.includes("not working") || query.includes("error") || query.includes("broken") || query.includes("issue")) {
|
|
105
|
+
return { category: "technical" };
|
|
106
|
+
} else if (query.includes("feature") || query.includes("compatible") || query.includes("specs") || query.includes("model")) {
|
|
107
|
+
return { category: "product" };
|
|
108
|
+
} else {
|
|
109
|
+
return { category: "complex" };
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
agents.triageAgent.tools.routeToAgent.bind(async (state, input) => {
|
|
114
|
+
const { category, queryId } = input;
|
|
115
|
+
const routingMap = {
|
|
116
|
+
"product": "productAgent",
|
|
117
|
+
"technical": "technicalAgent",
|
|
118
|
+
"billing": "billingAgent",
|
|
119
|
+
"complex": "escalationAgent"
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const targetAgent = routingMap[category] || "escalationAgent";
|
|
123
|
+
|
|
124
|
+
console.log(`Routing query ${queryId} to ${targetAgent} (category: ${category})`);
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
success: true,
|
|
128
|
+
routedTo: targetAgent,
|
|
129
|
+
message: `Your query has been routed to our ${category} specialist.`
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Bind tool implementations for Product Agent
|
|
134
|
+
agents.productAgent.tools.getProductInfo.bind(async (state, input) => {
|
|
135
|
+
const { productId, infoType } = input;
|
|
136
|
+
const product = mockDatabase.products[productId];
|
|
137
|
+
|
|
138
|
+
if (!product) {
|
|
139
|
+
return { error: "Product not found" };
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (infoType && product[infoType]) {
|
|
143
|
+
return {
|
|
144
|
+
productName: product.name,
|
|
145
|
+
[infoType]: product[infoType]
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return product;
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
agents.productAgent.tools.compareProducts.bind(async (state, input) => {
|
|
153
|
+
const { productIds } = input;
|
|
154
|
+
const comparisonResults = {};
|
|
155
|
+
|
|
156
|
+
for (const productId of productIds) {
|
|
157
|
+
const product = mockDatabase.products[productId];
|
|
158
|
+
if (product) {
|
|
159
|
+
comparisonResults[productId] = {
|
|
160
|
+
name: product.name,
|
|
161
|
+
features: product.features,
|
|
162
|
+
specs: product.specs
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return { comparison: comparisonResults };
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Bind tool implementations for Technical Agent
|
|
171
|
+
agents.technicalAgent.tools.troubleshootIssue.bind(async (state, input) => {
|
|
172
|
+
const { issueDescription, productId } = input;
|
|
173
|
+
|
|
174
|
+
// Simple troubleshooting logic based on keywords
|
|
175
|
+
if (issueDescription.toLowerCase().includes("won't power on")) {
|
|
176
|
+
return {
|
|
177
|
+
steps: [
|
|
178
|
+
"Ensure the device is charged or has fresh batteries",
|
|
179
|
+
"Try a different power outlet or charging cable",
|
|
180
|
+
"Press and hold the power button for 10 seconds",
|
|
181
|
+
"If none of these work, the device may need servicing"
|
|
182
|
+
]
|
|
183
|
+
};
|
|
184
|
+
} else if (issueDescription.toLowerCase().includes("connection") || issueDescription.toLowerCase().includes("wifi")) {
|
|
185
|
+
return {
|
|
186
|
+
steps: [
|
|
187
|
+
"Restart your router and the device",
|
|
188
|
+
"Make sure the device is within range of the WiFi signal",
|
|
189
|
+
"Check if other devices can connect to the same network",
|
|
190
|
+
"Reset network settings on the device"
|
|
191
|
+
]
|
|
192
|
+
};
|
|
193
|
+
} else {
|
|
194
|
+
return {
|
|
195
|
+
steps: [
|
|
196
|
+
"Restart the device",
|
|
197
|
+
"Check for software updates",
|
|
198
|
+
"Reset to factory settings if problems persist",
|
|
199
|
+
"Contact technical support for further assistance"
|
|
200
|
+
]
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
agents.technicalAgent.tools.checkKnownIssues.bind(async (state, input) => {
|
|
206
|
+
const { symptoms, productId } = input;
|
|
207
|
+
|
|
208
|
+
const matchedIssues = mockDatabase.knownIssues.filter(issue => {
|
|
209
|
+
if (productId && issue.productId !== productId) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Check if any of the symptoms match
|
|
214
|
+
return issue.symptoms.some(symptom =>
|
|
215
|
+
symptoms.some(s => symptom.includes(s.toLowerCase()))
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
if (matchedIssues.length > 0) {
|
|
220
|
+
return {
|
|
221
|
+
matchFound: true,
|
|
222
|
+
issues: matchedIssues.map(issue => ({
|
|
223
|
+
id: issue.id,
|
|
224
|
+
solution: issue.solution
|
|
225
|
+
}))
|
|
226
|
+
};
|
|
227
|
+
} else {
|
|
228
|
+
return {
|
|
229
|
+
matchFound: false,
|
|
230
|
+
message: "No known issues match the described symptoms."
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// Bind tool implementations for Billing Agent
|
|
236
|
+
agents.billingAgent.tools.getAccountInfo.bind(async (state, input) => {
|
|
237
|
+
const { customerId, infoType } = input;
|
|
238
|
+
const customer = mockDatabase.customers[customerId];
|
|
239
|
+
|
|
240
|
+
if (!customer) {
|
|
241
|
+
return { error: "Customer not found" };
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (infoType === "paymentHistory") {
|
|
245
|
+
return { paymentHistory: customer.paymentHistory };
|
|
246
|
+
} else if (infoType === "subscription") {
|
|
247
|
+
return {
|
|
248
|
+
accountType: customer.accountType,
|
|
249
|
+
subscriptionStatus: customer.subscriptionStatus
|
|
250
|
+
};
|
|
251
|
+
} else {
|
|
252
|
+
// Return safe information, omitting sensitive details
|
|
253
|
+
return {
|
|
254
|
+
name: customer.name,
|
|
255
|
+
email: customer.email,
|
|
256
|
+
accountType: customer.accountType,
|
|
257
|
+
subscriptionStatus: customer.subscriptionStatus
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
agents.billingAgent.tools.processRefund.bind(async (state, input) => {
|
|
263
|
+
const { orderId, reason, fullRefund } = input;
|
|
264
|
+
|
|
265
|
+
// This would connect to payment processor in real implementation
|
|
266
|
+
return {
|
|
267
|
+
refundId: `ref-${Date.now().toString().substr(-6)}`,
|
|
268
|
+
status: "processed",
|
|
269
|
+
amount: fullRefund ? "Full amount" : "Partial amount",
|
|
270
|
+
estimatedCompletion: "3-5 business days"
|
|
271
|
+
};
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
// Bind tool implementations for Escalation Agent
|
|
275
|
+
agents.escalationAgent.tools.analyzeComplexIssue.bind(async (state, input) => {
|
|
276
|
+
const { issueDescription, previousAttempts } = input;
|
|
277
|
+
|
|
278
|
+
return {
|
|
279
|
+
analysisResult: "Complex issue identified and logged for specialized handling",
|
|
280
|
+
priority: "High",
|
|
281
|
+
estimatedResolutionTime: "24-48 hours",
|
|
282
|
+
caseId: `esc-${Date.now().toString().substr(-6)}`
|
|
283
|
+
};
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
agents.escalationAgent.tools.createSpecializedSolution.bind(async (state, input) => {
|
|
287
|
+
const { issueId, approachType } = input;
|
|
288
|
+
|
|
289
|
+
return {
|
|
290
|
+
solution: "Custom solution plan created for your specific issue",
|
|
291
|
+
steps: [
|
|
292
|
+
"Schedule a dedicated technical specialist session",
|
|
293
|
+
"Perform advanced diagnostics on your device",
|
|
294
|
+
"Apply customized fixes based on your specific configuration",
|
|
295
|
+
"Follow up to ensure complete resolution"
|
|
296
|
+
],
|
|
297
|
+
supportContact: "escalation@example.com"
|
|
298
|
+
};
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
// Bind tool implementations for Follow-up Agent
|
|
302
|
+
agents.followupAgent.tools.checkResolutionStatus.bind(async (state, input) => {
|
|
303
|
+
const { caseId } = input;
|
|
304
|
+
const supportCase = mockDatabase.supportCases[caseId];
|
|
305
|
+
|
|
306
|
+
if (!supportCase) {
|
|
307
|
+
return {
|
|
308
|
+
found: false,
|
|
309
|
+
message: "Case not found in our records"
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return {
|
|
314
|
+
found: true,
|
|
315
|
+
status: supportCase.status,
|
|
316
|
+
resolution: supportCase.resolution
|
|
317
|
+
};
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
agents.followupAgent.tools.recordFeedback.bind(async (state, input) => {
|
|
321
|
+
const { caseId, feedbackType, feedbackContent } = input;
|
|
322
|
+
|
|
323
|
+
// In a real implementation, this would store the feedback in a database
|
|
324
|
+
console.log(`Feedback recorded for case ${caseId}: ${feedbackType} - ${feedbackContent}`);
|
|
325
|
+
|
|
326
|
+
return {
|
|
327
|
+
success: true,
|
|
328
|
+
message: "Thank you for your feedback. It helps us improve our service."
|
|
329
|
+
};
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
// Compile all agents
|
|
333
|
+
console.log("Compiling agents...");
|
|
334
|
+
await Promise.all(Object.values(agents).map(agent => agent.compile()));
|
|
335
|
+
|
|
336
|
+
// Wait for agent discovery to complete
|
|
337
|
+
console.log("Waiting for agent discovery...");
|
|
338
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
339
|
+
|
|
340
|
+
console.log("Customer support network ready!");
|
|
341
|
+
|
|
342
|
+
// Example usage scenario
|
|
343
|
+
const customerQuery = "My SuperWidget Pro won't turn on after charging it overnight.";
|
|
344
|
+
console.log(`\nProcessing customer query: "${customerQuery}"`);
|
|
345
|
+
|
|
346
|
+
// Generate a case ID for this interaction
|
|
347
|
+
const caseId = generateCaseId();
|
|
348
|
+
console.log(`Generated case ID: ${caseId}`);
|
|
349
|
+
|
|
350
|
+
// Start with the triage agent
|
|
351
|
+
const client = AgentClient();
|
|
352
|
+
const res = await client.queryIo(natsIO, 'triageAgent', new Message({
|
|
353
|
+
content: customerQuery,
|
|
354
|
+
session: {
|
|
355
|
+
id: caseId,
|
|
356
|
+
customerId: "cust-001",
|
|
357
|
+
productId: "prod-001"
|
|
358
|
+
}
|
|
359
|
+
}))
|
|
360
|
+
|
|
361
|
+
console.log("\nTriage Agent Response:");
|
|
362
|
+
console.log(res.getContent());
|
|
363
|
+
|
|
364
|
+
// For demonstration purposes, let's simulate a complete flow through the technical agent
|
|
365
|
+
console.log("\nRouting to Technical Agent...");
|
|
366
|
+
const res2 = await client.queryIo(natsIO, 'technicalAgent', new Message({
|
|
367
|
+
content: customerQuery,
|
|
368
|
+
session: {
|
|
369
|
+
id: caseId,
|
|
370
|
+
customerId: "cust-001",
|
|
371
|
+
productId: "prod-001"
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
console.log("Technical Agent Response:");
|
|
377
|
+
console.log(res2.getContent());
|
|
378
|
+
|
|
379
|
+
// Simulate storing the case resolution
|
|
380
|
+
mockDatabase.supportCases[caseId] = {
|
|
381
|
+
customerId: "cust-001",
|
|
382
|
+
productId: "prod-001",
|
|
383
|
+
status: "resolved",
|
|
384
|
+
issue: customerQuery,
|
|
385
|
+
resolution: "Guided customer through power cycle and battery check",
|
|
386
|
+
agentNotes: "Issue resolved successfully"
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
// Now follow up with the customer
|
|
390
|
+
console.log("\nFollowing up with customer after resolution...");
|
|
391
|
+
const res3 = await client.queryIo(natsIO, 'followupAgent', new Message({
|
|
392
|
+
content: `Please follow up on case ${caseId}`,
|
|
393
|
+
session: {
|
|
394
|
+
id: caseId
|
|
395
|
+
}
|
|
396
|
+
})
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
console.log("Follow-up Agent Response:");
|
|
400
|
+
console.log(res3.getContent());
|
|
401
|
+
|
|
402
|
+
console.log("\nCustomer support workflow complete!");
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Execute the demo
|
|
406
|
+
main().catch(error => {
|
|
407
|
+
console.error("Error running customer support demo:", error);
|
|
408
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Event Planner Multiagent System
|
|
2
|
+
|
|
3
|
+
This example demonstrates a calendar management and event planning system built with multiple agents that collaborate to help users manage their schedules.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The system consists of two specialized agents:
|
|
8
|
+
|
|
9
|
+
1. **Planner Agent**: Handles calendar event management (create, read, update, delete) and availability checking.
|
|
10
|
+
2. **Event Finder Agent**: Specializes in searching for events, identifying scheduling conflicts, and suggesting optimal meeting times.
|
|
11
|
+
|
|
12
|
+
## Architecture
|
|
13
|
+
|
|
14
|
+
- Agents are defined declaratively in YAML with specialized system instructions, tools, and discovery schemas.
|
|
15
|
+
- Agents communicate with each other through NATS as the transport mechanism.
|
|
16
|
+
- The system maintains a shared session context to track user interactions.
|
|
17
|
+
- Tool implementations provide the actual calendar functionality with mock data.
|
|
18
|
+
|
|
19
|
+
## Key Features
|
|
20
|
+
|
|
21
|
+
The event planner system demonstrates several important capabilities:
|
|
22
|
+
|
|
23
|
+
### Planner Agent Features:
|
|
24
|
+
- Creating new calendar events with titles, dates, times, descriptions, locations, and participants
|
|
25
|
+
- Listing events within a specified date range
|
|
26
|
+
- Retrieving detailed information about specific events
|
|
27
|
+
- Updating existing events (changing title, time, location, etc.)
|
|
28
|
+
- Deleting events from the calendar
|
|
29
|
+
- Checking availability for potential time slots
|
|
30
|
+
|
|
31
|
+
### Event Finder Agent Features:
|
|
32
|
+
- Searching for events based on various criteria (keywords, dates, participants, locations)
|
|
33
|
+
- Finding scheduling conflicts between events
|
|
34
|
+
- Suggesting optimal meeting times based on participant availability
|
|
35
|
+
- Providing free/busy information for participants
|
|
36
|
+
|
|
37
|
+
## Mock Data
|
|
38
|
+
|
|
39
|
+
For demonstration purposes, this example includes mock data for:
|
|
40
|
+
- Calendar events with details like title, time, location, participants
|
|
41
|
+
- User information including working hours and time zones
|
|
42
|
+
|
|
43
|
+
In a production environment, these would be connected to real calendar APIs and databases.
|
|
44
|
+
|
|
45
|
+
## Running the Example
|
|
46
|
+
|
|
47
|
+
To run this example:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
node examples/event-planner/index.js
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Example Workflows
|
|
54
|
+
|
|
55
|
+
The code demonstrates several workflow scenarios:
|
|
56
|
+
|
|
57
|
+
1. **Creating a new event**: The user requests to schedule a meeting, and the planner agent creates the appropriate calendar entry.
|
|
58
|
+
2. **Searching for events**: The user asks to find events matching specific criteria, and the event finder agent returns relevant results.
|
|
59
|
+
3. **Updating an event**: The user requests a change to an existing event, and the planner agent makes the appropriate updates.
|
|
60
|
+
4. **Finding scheduling conflicts**: The user asks about potential conflicts, and the event finder agent identifies and reports them.
|
|
61
|
+
|
|
62
|
+
## Extending the Example
|
|
63
|
+
|
|
64
|
+
You can extend this example by:
|
|
65
|
+
- Adding more specialized agents (e.g., a reminder agent, a travel planning agent)
|
|
66
|
+
- Implementing real calendar API connections (Google Calendar, Microsoft Outlook, etc.)
|
|
67
|
+
- Enhancing the scheduling algorithm to better account for time zones and working hours
|
|
68
|
+
- Adding natural language processing capabilities for more flexible date/time inputs
|
|
69
|
+
- Creating a user interface for calendar visualization
|