agentnet 0.0.1 → 0.0.2

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.
@@ -1,394 +0,0 @@
1
- ---
2
- apiVersion: smartagent.io/v1alpha1
3
- kind: AgentDefinition
4
- metadata:
5
- name: advancedTravelAgent
6
- namespace: smartchat
7
- spec:
8
- io:
9
- - type: NatsIO
10
- config:
11
- servers:
12
- - nats://localhost:4222
13
- bindings:
14
- discoveryTopic: smartness.discovery
15
- doHandoffsTo:
16
- - "location.weather.*"
17
-
18
- llm:
19
- provider: Gemini
20
- model: gemini-2.0-flash
21
- systemInstruction: |
22
- You are a highly advanced travel concierge.
23
- Prioritize clarity and helpfulness.
24
- Use tools effectively to gather information.
25
- config:
26
- temperature: 0.5
27
- toolConfig:
28
- functionCallingConfig:
29
- mode: 'auto'
30
-
31
- tools:
32
- - name: flightSearchTool
33
- description: Searches for available flights based on criteria.
34
- parameters:
35
- type: object
36
- properties:
37
- origin:
38
- type: string
39
- description: The origin city.
40
- destination:
41
- type: string
42
- description: The destination city.
43
- required:
44
- - origin
45
- - destination
46
-
47
- - name: hotelBookingTool
48
- description: Books a hotel room.
49
- parameters:
50
- type: object
51
- properties:
52
- checkin:
53
- type: string
54
- description: The check-in date.
55
- required:
56
- - checkin
57
-
58
- ---
59
- apiVersion: smartagent.io/v1alpha1
60
- kind: AgentDefinition
61
- metadata:
62
- name: weatherAgent
63
- namespace: smartchat
64
- spec:
65
- io:
66
- - type: NatsIO
67
- config:
68
- servers:
69
- - nats://localhost:4222
70
- bindings:
71
- discoveryTopic: smartness.discovery
72
- llm:
73
- provider: Gemini
74
- model: gemini-2.0-flash
75
- systemInstruction: |
76
- You are a highly advanced weather agent.
77
- Prioritize clarity and helpfulness.
78
- Use tools effectively to gather information.
79
- config:
80
- temperature: 0.5
81
- toolConfig:
82
- functionCallingConfig:
83
- mode: 'auto'
84
-
85
- tools:
86
- - name: weatherSearchTool
87
- description: Searches for available weather based on criteria.
88
- parameters:
89
- type: object
90
- properties:
91
- location:
92
- type: string
93
- description: The location to search for weather.
94
- required:
95
- - location
96
-
97
- requiredStateKeys:
98
- - sessionId
99
-
100
- discoverySchemas:
101
- - name: weather_agent_query
102
- #type: function
103
- description: Ask a general weather question to the weather agent.
104
- parameters:
105
- type: object
106
- properties:
107
- location:
108
- type: string
109
- description: The location to search for weather.
110
- required:
111
- - location
112
- ---
113
- apiVersion: smartagent.io/v1alpha1
114
- kind: AgentDefinition
115
- metadata:
116
- name: newsAgent
117
- namespace: smartchat
118
- spec:
119
- io:
120
- - type: NatsIO
121
- config:
122
- servers:
123
- - nats://localhost:4222
124
- bindings:
125
- discoveryTopic: smartness.discovery
126
- llm:
127
- provider: Gemini
128
- model: gemini-2.0-flash
129
- systemInstruction: |
130
- You are a helpful news agent.
131
- Provide concise and relevant news updates.
132
- config:
133
- temperature: 0.7
134
- toolConfig:
135
- functionCallingConfig:
136
- mode: 'auto'
137
- tools:
138
- - name: newsSearchTool
139
- description: Searches for news articles based on keywords or topics.
140
- parameters:
141
- type: object
142
- properties:
143
- query:
144
- type: string
145
- description: The news topic or keywords to search for.
146
- required:
147
- - query
148
- discoverySchemas:
149
- - name: news_agent_query
150
- description: Ask for news updates.
151
- parameters:
152
- type: object
153
- properties:
154
- topic:
155
- type: string
156
- description: The topic to get news about.
157
- required:
158
- - topic
159
- ---
160
- apiVersion: smartagent.io/v1alpha1
161
- kind: AgentDefinition
162
- metadata:
163
- name: calculatorAgent
164
- namespace: smartchat
165
- spec:
166
- io:
167
- - type: NatsIO
168
- config:
169
- servers:
170
- - nats://localhost:4222
171
- bindings:
172
- discoveryTopic: smartness.discovery
173
- llm:
174
- provider: Gemini
175
- model: gemini-2.0-flash
176
- systemInstruction: |
177
- You are a precise calculator agent.
178
- Perform calculations accurately.
179
- config:
180
- temperature: 0.2
181
- toolConfig:
182
- functionCallingConfig:
183
- mode: 'auto'
184
- tools:
185
- - name: calculationTool
186
- description: Performs mathematical calculations.
187
- parameters:
188
- type: object
189
- properties:
190
- expression:
191
- type: string
192
- description: The mathematical expression to evaluate.
193
- required:
194
- - expression
195
- discoverySchemas:
196
- - name: calculator_agent_query
197
- description: Perform a calculation.
198
- parameters:
199
- type: object
200
- properties:
201
- expression:
202
- type: string
203
- description: The mathematical expression.
204
- required:
205
- - expression
206
- ---
207
- apiVersion: smartagent.io/v1alpha1
208
- kind: AgentDefinition
209
- metadata:
210
- name: translationAgent
211
- namespace: smartchat
212
- spec:
213
- io:
214
- - type: NatsIO
215
- config:
216
- servers:
217
- - nats://localhost:4222
218
- bindings:
219
- discoveryTopic: smartness.discovery
220
- llm:
221
- provider: Gemini
222
- model: gemini-2.0-flash
223
- systemInstruction: |
224
- You are an accurate translation agent.
225
- Translate text between specified languages.
226
- config:
227
- temperature: 0.5
228
- toolConfig:
229
- functionCallingConfig:
230
- mode: 'auto'
231
- tools:
232
- - name: translationTool
233
- description: Translates text from a source language to a target language.
234
- parameters:
235
- type: object
236
- properties:
237
- text:
238
- type: string
239
- description: The text to translate.
240
- sourceLanguage:
241
- type: string
242
- description: The language of the input text (e.g., en, es, fr).
243
- targetLanguage:
244
- type: string
245
- description: The language to translate the text to (e.g., en, es, fr).
246
- required:
247
- - text
248
- - targetLanguage
249
- discoverySchemas:
250
- - name: translation_agent_query
251
- description: Translate text.
252
- parameters:
253
- type: object
254
- properties:
255
- textToTranslate:
256
- type: string
257
- description: The text content to be translated.
258
- targetLang:
259
- type: string
260
- description: The target language for translation.
261
- required:
262
- - textToTranslate
263
- - targetLang
264
- ---
265
- apiVersion: smartagent.io/v1alpha1
266
- kind: AgentDefinition
267
- metadata:
268
- name: calendarAgent
269
- namespace: smartchat
270
- spec:
271
- io:
272
- - type: NatsIO
273
- config:
274
- servers:
275
- - nats://localhost:4222
276
- bindings:
277
- discoveryTopic: smartness.discovery
278
- llm:
279
- provider: Gemini
280
- model: gemini-2.0-flash
281
- systemInstruction: |
282
- You are an organized calendar agent.
283
- Help manage schedules and appointments.
284
- config:
285
- temperature: 0.6
286
- toolConfig:
287
- functionCallingConfig:
288
- mode: 'auto'
289
- tools:
290
- - name: createEventTool
291
- description: Creates a new calendar event.
292
- parameters:
293
- type: object
294
- properties:
295
- title:
296
- type: string
297
- description: The title of the event.
298
- startTime:
299
- type: string
300
- description: The start date and time of the event.
301
- endTime:
302
- type: string
303
- description: The end date and time of the event.
304
- description:
305
- type: string
306
- description: A description of the event.
307
- required:
308
- - title
309
- - startTime
310
- - name: listEventsTool
311
- description: Lists calendar events for a given period.
312
- parameters:
313
- type: object
314
- properties:
315
- startDate:
316
- type: string
317
- description: The start date of the period.
318
- endDate:
319
- type: string
320
- description: The end date of the period.
321
- required:
322
- - startDate
323
- discoverySchemas:
324
- - name: calendar_agent_create_event_query
325
- description: Create a new calendar event.
326
- parameters:
327
- type: object
328
- properties:
329
- eventTitle:
330
- type: string
331
- description: Title of the event.
332
- eventStartTime:
333
- type: string
334
- description: Start time for the event.
335
- required:
336
- - eventTitle
337
- - eventStartTime
338
- - name: calendar_agent_list_events_query
339
- description: List calendar events.
340
- parameters:
341
- type: object
342
- properties:
343
- periodStartDate:
344
- type: string
345
- description: Start date for listing events.
346
- required:
347
- - periodStartDate
348
- ---
349
- apiVersion: smartagent.io/v1alpha1
350
- kind: AgentDefinition
351
- metadata:
352
- name: stockTickerAgent
353
- namespace: smartchat
354
- spec:
355
- io:
356
- - type: NatsIO
357
- config:
358
- servers:
359
- - nats://localhost:4222
360
- bindings:
361
- discoveryTopic: smartness.discovery
362
- llm:
363
- provider: Gemini
364
- model: gemini-2.0-flash
365
- systemInstruction: |
366
- You are a knowledgeable stock ticker agent.
367
- Provide current stock prices and market information.
368
- config:
369
- temperature: 0.4
370
- toolConfig:
371
- functionCallingConfig:
372
- mode: 'auto'
373
- tools:
374
- - name: stockPriceTool
375
- description: Gets the current price for a stock symbol.
376
- parameters:
377
- type: object
378
- properties:
379
- symbol:
380
- type: string
381
- description: The stock symbol (e.g., GOOGL, AAPL).
382
- required:
383
- - symbol
384
- discoverySchemas:
385
- - name: stock_agent_query
386
- description: Get stock information.
387
- parameters:
388
- type: object
389
- properties:
390
- stockSymbol:
391
- type: string
392
- description: The stock symbol.
393
- required:
394
- - stockSymbol
@@ -1,74 +0,0 @@
1
- import { Agent, NatsIO, Gemini } from "../index.js"
2
-
3
- const basicAgent = await Agent()
4
- .addIO(NatsIO({
5
- servers: ['nats://localhost:4222']
6
- }), {
7
- tasks: ['basicagent'],
8
- handoffs: ['mathagents.*']
9
- })
10
- .withLLM(Gemini, {
11
- model: 'gemini-2.0-flash',
12
- systemInstruction: `
13
- You are an traveler agency agent.
14
- Your role is to answer about the traveler (user) reservation.
15
- `,
16
- config: {
17
- temperature: 0,
18
- toolConfig: {
19
- functionCallingConfig: {
20
- mode: 'auto'
21
- }
22
- }
23
- }
24
- })
25
- .on('prompt', async (state, input) => {
26
- return input
27
- })
28
- .compile()
29
-
30
- const mathAgent = await Agent()
31
- .addIO(NatsIO({
32
- servers: ['nats://localhost:4222']
33
- }), {
34
- tasks: ['mathagents.v1']
35
- })
36
- .withLLM(Gemini, {
37
- model: 'gemini-2.0-flash',
38
- systemInstruction: `
39
- You are an traveler agency agent.
40
- Your role is to answer about the traveler (user) reservation.
41
- `,
42
- config: {
43
- temperature: 0,
44
- toolConfig: {
45
- functionCallingConfig: {
46
- mode: 'auto'
47
- }
48
- }
49
- }
50
- })
51
- .addDiscoverySchema({
52
- name: 'math_agent',
53
- type: 'function',
54
- description: 'Solve the math problem',
55
- parameters: {
56
- type: 'object',
57
- properties: {
58
- question: {
59
- type: 'string',
60
- description: 'Math problem to solve',
61
- }
62
- },
63
- required: ['question']
64
- }
65
- })
66
- .on('prompt', async (state, input) => {
67
- return input
68
- })
69
- .compile()
70
-
71
- const result = await basicAgent.query("How 2 + 2 is?")
72
- console.log(result)
73
-
74
-
@@ -1,65 +0,0 @@
1
- import { AgentLoader, AgentClient, NatsIO } from "../index.js"
2
-
3
- const agents = await AgentLoader('./src/examples/agents.yaml')
4
-
5
- const agentTravel = await agents.advancedTravelAgent
6
- agentTravel.tools.flightSearchTool.bind(async (state, input) => {
7
- return { answer: "The fly is from New York to Los Angeles at 10:00 AM" }
8
- })
9
- await agentTravel.compile()
10
-
11
- const agentWeather = await agents.weatherAgent
12
- agentWeather.tools.weatherSearchTool.bind(async (state, input) => {
13
- return { answer: "The weather in New York is sunny" }
14
- })
15
- await agentWeather.compile()
16
-
17
- const agentNews = await agents.newsAgent
18
- agentNews.tools.newsSearchTool.bind(async (state, input) => {
19
- return { answer: "Latest news: AI is taking over!" }
20
- })
21
- await agentNews.compile()
22
-
23
- const agentCalculator = await agents.calculatorAgent
24
- agentCalculator.tools.calculationTool.bind(async (state, input) => {
25
- return { answer: `The result of ${input.expression} is 42` }
26
- })
27
- await agentCalculator.compile()
28
-
29
- const agentTranslation = await agents.translationAgent
30
- agentTranslation.tools.translationTool.bind(async (state, input) => {
31
- return { answer: `'${input.text}' translated to ${input.targetLanguage} is 'Hola Mundo'` }
32
- })
33
- await agentTranslation.compile()
34
-
35
- const agentCalendar = await agents.calendarAgent
36
- agentCalendar.tools.createEventTool.bind(async (state, input) => {
37
- return { answer: `Event '${input.title}' created for ${input.startTime}` }
38
- })
39
- agentCalendar.tools.listEventsTool.bind(async (state, input) => {
40
- return { answer: `Events for ${input.startDate}: Meeting at 10 AM` }
41
- })
42
- await agentCalendar.compile()
43
-
44
- const agentStockTicker = await agents.stockTickerAgent
45
- agentStockTicker.tools.stockPriceTool.bind(async (state, input) => {
46
- return { answer: `The price of ${input.symbol} is $100` }
47
- })
48
- await agentStockTicker.compile()
49
-
50
- const io = NatsIO({
51
- servers: ['nats://localhost:4222']
52
- })
53
-
54
- const agentClient = AgentClient()
55
- //const res = await agentClient.queryAgent(agentTravelInstance, "Find me a flight from New York to Los Angeles")
56
- //console.log(res)
57
-
58
- // Wait for 2 seconds before proceeding
59
- await new Promise(resolve => setTimeout(resolve, 2000));
60
-
61
- const res = await agentClient.queryIo(io, 'advancedTravelAgent', "Find me a flight from New York to Los Angeles. How is the weather in New York? Give me some news. Also create the birthday event for my friend tomorrow 09-05-2025. RETURN TO ME THE RESULTS")
62
- console.log(res)
63
-
64
- //const res = await agent.query("Find me a flight from New York to Los Angeles")
65
- //console.log(res)
File without changes