@iqai/adk 0.6.1 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @iqai/adk
2
2
 
3
+ ## 0.6.3
4
+
5
+ ### Patch Changes
6
+
7
+ - ad1b38b: Improve tracing with sequential span indices for better observability.
8
+ - Add span counters to `InvocationContext` for tracking LLM, tool, and agent invocations
9
+ - Update trace span names to include indices (e.g., `agent_run [my-agent] #1`, `execute_tool [search] #1`, `llm_generate [gpt-4] #1`)
10
+ - Include app name in invocation span for better traceability
11
+ - Disable auto instrumentation by default to reduce trace noise
12
+ - Update telemetry documentation with new span naming conventions
13
+
14
+ ## 0.6.2
15
+
16
+ ### Patch Changes
17
+
18
+ - 8f2167a: Adds a new suite of default ADK tools and refactors common tooling, including a major upgrade to the Google Search tool.
19
+ - Introduces a comprehensive set of **default tools** for the ADK (file system, shell, and web utilities) to provide a strong out-of-the-box agent experience.
20
+ - Adds a new **Tavily-powered web search tool** as part of the default toolset.
21
+ - Refactors the **Google Search tool** to use the real Google Custom Search API with Axios and Zod-based argument validation.
22
+ - Improves **type safety** across several common tools by replacing `any` return types with explicit interfaces.
23
+ - Updates the memory loading tool to return a structured result object.
24
+
25
+ This is a **non-breaking feature and refactor** that expands functionality, improves reliability, and strengthens type safety without changing existing APIs.
26
+
27
+ - f2dfa13: fix: remove unnecessary any type
28
+ - 96e9661: Add Context Caching support for ADK Apps using Gemini 2.0+ models.
29
+
30
+ This feature allows agents to reuse extended instructions or large contextual data across requests, reducing token usage and improving performance. Caching behavior is configurable at the App or Agent level via `contextCacheConfig`, with controls for minimum token threshold, cache TTL, and maximum usage intervals.
31
+
32
+ All agents within an App can benefit from shared cached context, minimizing redundant data sent to the model while preserving correctness.
33
+
3
34
  ## 0.6.1
4
35
 
5
36
  ### Patch Changes
@@ -9,7 +40,6 @@
9
40
  The PluginManager had several callback methods defined but never invoked, causing plugins implementing guardrails, logging, or error recovery to be silently ignored.
10
41
 
11
42
  This fix adds the missing calls for:
12
-
13
43
  - `beforeModelCallback` / `afterModelCallback` - intercept LLM requests/responses
14
44
  - `onModelErrorCallback` - handle/recover from LLM errors
15
45
  - `beforeToolCallback` / `afterToolCallback` - intercept tool execution
@@ -28,52 +58,44 @@
28
58
  ### ✨ New Features
29
59
 
30
60
  **Modular Architecture**
31
-
32
61
  - Refactored from monolithic to service-based design
33
62
  - Separate modules for tracing, metrics, setup, and utilities
34
63
  - Clean `telemetryService` API replacing low-level functions
35
64
 
36
65
  **Metrics Support**
37
-
38
66
  - Full metrics collection with OpenTelemetry SDK
39
67
  - Counters: agent invocations, tool executions, LLM calls
40
68
  - Histograms: duration tracking, token usage (input/output/total)
41
69
  - OTLP HTTP exporter for metrics
42
70
 
43
71
  **Privacy Controls**
44
-
45
72
  - `ADK_CAPTURE_MESSAGE_CONTENT` environment variable
46
73
  - Fine-grained control over sensitive data capture
47
74
  - Disable prompt/completion logging for production
48
75
 
49
76
  **Semantic Conventions**
50
-
51
77
  - OpenTelemetry GenAI conventions (v1.37+)
52
78
  - ADK-specific namespace (`adk.*`) for custom attributes
53
79
  - Standardized attribute names across all spans
54
80
 
55
81
  **Enhanced Tracing**
56
-
57
82
  - Automatic agent invocation tracing with status tracking
58
83
  - Tool execution spans with arguments and results
59
84
  - LLM call tracing with token usage metrics
60
85
  - Async generator support for streaming responses
61
86
 
62
87
  **Resource Auto-Detection**
63
-
64
88
  - Automatic detection of host, OS, and process information
65
89
  - Custom resource attributes support
66
90
  - Service instance identification
67
91
 
68
92
  **Configuration**
69
-
70
93
  - Comprehensive initialization options
71
94
  - Sampling ratio control for production
72
95
  - Configurable metric export intervals
73
96
  - Custom OTLP headers for authentication
74
97
 
75
98
  ### 🔧 Breaking Changes
76
-
77
99
  - `initializeTelemetry()` → `telemetryService.initialize()`
78
100
  - `shutdownTelemetry()` → `telemetryService.shutdown()`
79
101
  - Legacy `telemetry.ts` now wraps new service for backward compatibility
@@ -81,13 +103,11 @@
81
103
  ### 📊 Integration
82
104
 
83
105
  All core components now automatically report metrics:
84
-
85
106
  - `BaseAgent.runAsyncInternal()`: Agent metrics
86
107
  - `functions.ts`: Tool execution metrics
87
108
  - `base-llm-flow.ts`: LLM token and duration metrics
88
109
 
89
110
  ### 📚 Documentation
90
-
91
111
  - Comprehensive README in `src/telemetry/`
92
112
  - Updated observability example with Jaeger + Langfuse
93
113
  - Practical examples demonstrating all features
@@ -95,12 +115,10 @@
95
115
  ### 🛠️ Technical Details
96
116
 
97
117
  **Dependencies Added**:
98
-
99
118
  - `@opentelemetry/sdk-metrics@^2.1.0`
100
119
  - `@opentelemetry/exporter-metrics-otlp-http@^0.205.0`
101
120
 
102
121
  **Supported Backends**:
103
-
104
122
  - Jaeger (local development)
105
123
  - Langfuse
106
124
  - Datadog
@@ -123,14 +141,12 @@
123
141
  The ADK telemetry system has been updated to fully comply with the latest OpenTelemetry GenAI semantic conventions. This ensures better interoperability with industry-standard observability platforms and provides richer, more standardized telemetry data.
124
142
 
125
143
  **Breaking Changes:**
126
-
127
144
  - `gen_ai.system` → `gen_ai.provider.name` (automatic provider detection from model names)
128
145
  - `gen_ai.usage.total_tokens` removed (compute client-side: input + output)
129
146
  - `call_llm` operation deprecated in favor of standard `chat`, `text_completion`, `generate_content`
130
147
  - `traceCallback` signature changed: removed unused `targetName` parameter
131
148
 
132
149
  **New Features:**
133
-
134
150
  - Automatic provider detection (OpenAI, Anthropic, Google, AWS Bedrock, Mistral, Groq, Cohere, etc.)
135
151
  - Enhanced LLM attributes: `response.id`, `response.model`, `output.type`, `top_k`, `frequency_penalty`, `presence_penalty`, `stop_sequences`, `seed`
136
152
  - Structured content capture: `system_instructions`, `input.messages`, `output.messages`, `tool.definitions`
@@ -140,7 +156,6 @@
140
156
  - Error type tracking: `error.type` attribute for low-cardinality error identification
141
157
 
142
158
  **Backward Compatibility:**
143
-
144
159
  - Deprecated constants are still available but will be removed in v1.0.0
145
160
  - All `adk.*` namespace attributes remain unchanged
146
161
  - Legacy content events preserved for one release cycle
@@ -152,7 +167,6 @@
152
167
  ### Patch Changes
153
168
 
154
169
  - 27d6bd9: Refactored MCP sampling parameters to align with the official protocol specification by moving from direct model assertions to the `modelPreferences` hint system.
155
-
156
170
  - **Protocol Alignment**
157
171
  Removed the invalid `mcpParams.model` type assertion, as the MCP spec does not define a top-level string for the model in sampling requests.
158
172
 
@@ -177,7 +191,6 @@
177
191
  - Improved event naming with descriptive suffixes (`.function_call`, `.final_response`, `.event`).
178
192
  - Included `finishReason` in event metadata for enhanced execution context and observability.
179
193
  - 0ada268: Added full plugin support across the agent lifecycle, enabling interception and extension of agent behavior during execution, model calls, and tool invocations.
180
-
181
194
  - Integrated plugin manager into `BaseAgent`, giving plugins priority over canonical callbacks.
182
195
  - Added `plugins` configuration to `AgentBuilder` and introduced `withPlugins()` API.
183
196
  - Updated `LlmAgent` and `BaseAgent` flows to run plugin lifecycle hooks (`before/after agent`, `before/after model`, `before/after tool`, error hooks, etc.).
@@ -236,7 +249,6 @@
236
249
  ### Minor Changes
237
250
 
238
251
  - 9c8441c: Enhanced CoinGecko MCP server support with remote endpoints
239
-
240
252
  - **Enhanced createMcpConfig function**: Now automatically detects URLs and uses `mcp-remote` for remote MCP endpoints while maintaining backward compatibility with npm packages
241
253
  - **Updated McpCoinGecko**: Now uses the remote CoinGecko MCP API endpoint (`https://mcp.api.coingecko.com/mcp`) instead of the npm package
242
254
  - **Added McpCoinGeckoPro**: New function for accessing the professional CoinGecko MCP API endpoint (`https://mcp.pro-api.coingecko.com/mcp`) with enhanced features and higher rate limits
@@ -256,7 +268,6 @@
256
268
  ### Minor Changes
257
269
 
258
270
  - c538a1a: feat(adk): align before/after model callback signatures with runtime (single object arg) and wire before/after tool callbacks into tool execution.
259
-
260
271
  - beforeModelCallback/afterModelCallback now receive `{ callbackContext, llmRequest|llmResponse }` to match runtime invocation; removes need for casts in examples.
261
272
  - beforeToolCallback/afterToolCallback are now invoked around tool execution; allow argument mutation and result override.
262
273
  - tracing updated to include final args and the produced event.
@@ -297,21 +308,17 @@
297
308
  ### Patch Changes
298
309
 
299
310
  - 2da690a: - **Dependency Updates:**
300
-
301
311
  - Upgraded dependencies and devDependencies across multiple packages ensuring compatibility with the latest library versions.
302
312
 
303
313
  - **Schema Handling:**
304
-
305
314
  - Transitioned schema conversion to use `z.toJSONSchema`, reducing dependencies.
306
315
  - Enhanced type safety in the workflow tool's schema handling.
307
316
 
308
317
  - **Error Reporting and Validation:**
309
-
310
318
  - Improved error messages in `AgentBuilder` for better debugging.
311
319
  - Enhanced output validation for LLM.
312
320
 
313
321
  - **AI SDK and Model Integration:**
314
-
315
322
  - Refined model ID handling in `AiSdkLlm`.
316
323
  - Updated field references to align with AI SDK changes.
317
324
 
@@ -331,17 +338,14 @@
331
338
  ### Minor Changes
332
339
 
333
340
  - 3561208: ## Features
334
-
335
341
  - Introduced conditional typing for multi-agent responses in `EnhancedRunner`, `BuiltAgent`, and `AgentBuilderWithSchema`. The ask() method now returns appropriate response type based on agent configuration.
336
342
  - Improved `AgentBuilder` methods (asSequential, asParallel, and related build methods) for better type propagation and correct return types for multi-agent aggregators.
337
343
  - Output schemas can no longer be set directly on multi-agent aggregators. Schemas must now be defined on individual sub-agents.
338
344
 
339
345
  ## Fixes
340
-
341
346
  - Bugfix in mergeAgentRun that caused incorrect removal of resolved promises.
342
347
 
343
348
  ## Changes
344
-
345
349
  - `ask()` implementation tailored to aggregate and return per-agent responses for multi-agent setups while maintaining schema validation for single-agent cases.
346
350
  - Now, `AgentBuilder` and `BuiltAgent` are being re-exported explicitly from the ADK entrypoint for type preservation in bundled declarations.
347
351
 
@@ -392,7 +396,6 @@
392
396
  This major enhancement improves the ADK CLI server's agent loading capabilities and adds new features to the core framework:
393
397
 
394
398
  **CLI Server Improvements:**
395
-
396
399
  - **Modular Architecture**: Refactored monolithic server file into organized modules (`server/index.ts`, `server/routes.ts`, `server/services.ts`, `server/types.ts`)
397
400
  - **Enhanced Agent Resolution**: New `resolveAgentExport` method supports multiple export patterns:
398
401
  - Direct agent exports: `export const agent = new LlmAgent(...)`
@@ -403,13 +406,11 @@
403
406
  - **Improved TypeScript Import Handling**: Better project root detection and module resolution for TypeScript files
404
407
 
405
408
  **Core Framework Enhancements:**
406
-
407
409
  - **New AgentBuilder Method**: Added `withAgent()` method to directly provide existing agent instances with definition locking to prevent accidental configuration overwrites
408
410
  - **Two-Tier Tool Deduplication**: Implemented robust deduplication logic to prevent duplicate function declarations that cause errors with LLM providers (especially Google)
409
411
  - **Better Type Safety**: Improved type definitions and replaced `any[]` usage with proper typed interfaces
410
412
 
411
413
  **Testing & Reliability:**
412
-
413
414
  - **Comprehensive Test Coverage**: New `agent-resolution.test.ts` with extensive fixtures testing various agent export patterns
414
415
  - **Multiple Test Fixtures**: Added 6 different agent export pattern examples for validation
415
416
  - **Edge Case Handling**: Improved error handling and logging throughout the agent loading pipeline
@@ -419,7 +420,6 @@
419
420
  - 1564b7b: Port Python evaluation framework to TypeScript
420
421
 
421
422
  This change introduces a comprehensive evaluation framework for testing AI agent performance. Key features include:
422
-
423
423
  - **Core evaluation engine** with agent-evaluator and local evaluation service
424
424
  - **Built-in evaluators** for response matching, trajectory analysis, LLM-as-judge, and safety checks
425
425
  - **Metrics system** with ROUGE scoring and tool trajectory analysis
@@ -552,14 +552,12 @@
552
552
  This release introduces integration with Vercel's AI SDK, expanding the platform's capabilities to support a wider range of large language models without requiring manual maintenance of model synchronization.
553
553
 
554
554
  ## Key Features
555
-
556
555
  - **AI-SDK Integration**: New `AiSdkLlm` class that integrates with Vercel AI SDK, supporting multiple providers (Google, OpenAI, Anthropic)
557
556
  - **Tool Calling Support**: Robust tool calling capabilities with automatic transformation of ADK function declarations to AI SDK tool definitions using Zod schemas
558
557
  - **Agent Builder Support**: Enhanced agent builder with AI-SDK model support
559
558
  - **Example Implementation**: Complete weather agent example demonstrating AI-SDK usage with tool calling
560
559
 
561
560
  ## Technical Details
562
-
563
561
  - Adds `ai-sdk.ts` model implementation with streaming support
564
562
  - Implements message format conversion between ADK and AI SDK formats
565
563
  - Supports both streaming and non-streaming model interactions
package/LICENSE.md CHANGED
@@ -6,4 +6,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
 
7
7
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
8
 
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -50,11 +50,11 @@ npm install @iqai/adk
50
50
  ### Simple Example
51
51
 
52
52
  ```typescript
53
- import { AgentBuilder } from '@iqai/adk';
53
+ import { AgentBuilder } from "@iqai/adk";
54
54
 
55
- const response = await AgentBuilder
56
- .withModel("gpt-4.1")
57
- .ask("What is the primary function of an AI agent?");
55
+ const response = await AgentBuilder.withModel("gpt-4.1").ask(
56
+ "What is the primary function of an AI agent?",
57
+ );
58
58
 
59
59
  console.log(response);
60
60
  ```
@@ -76,8 +76,8 @@ The library uses `dotenv` to load these variables automatically if `dotenv.confi
76
76
  Here's a fundamental example of creating and running an agent:
77
77
 
78
78
  ```typescript
79
- import { Agent } from '@iqai/adk';
80
- import dotenv from 'dotenv';
79
+ import { Agent } from "@iqai/adk";
80
+ import dotenv from "dotenv";
81
81
 
82
82
  // Load environment variables
83
83
  dotenv.config();
@@ -87,7 +87,7 @@ const myAgent = new LlmAgent({
87
87
  name: "simple_query_assistant",
88
88
  model: "gemini-2.5-flash", // Or "gpt-4-turbo", "claude-3-opus"
89
89
  description: "A basic assistant to answer questions.",
90
- instructions: "You are a helpful AI. Respond clearly and concisely."
90
+ instructions: "You are a helpful AI. Respond clearly and concisely.",
91
91
  });
92
92
 
93
93
  // Asynchronously run the agent
@@ -97,7 +97,7 @@ async function runQuery() {
97
97
  console.log(`User: ${query}`);
98
98
 
99
99
  const response = await myAgent.run({
100
- messages: [{ role: 'user', content: query }]
100
+ messages: [{ role: "user", content: query }],
101
101
  });
102
102
 
103
103
  console.log(`Agent: ${response.content}`);
@@ -114,15 +114,14 @@ runQuery();
114
114
  The `AgentBuilder` provides a fluent interface for creating agents with minimal boilerplate. It's perfect for rapid prototyping and reduces the complexity of agent setup.
115
115
 
116
116
  ```typescript
117
- import { AgentBuilder } from '@iqai/adk';
118
- import dotenv from 'dotenv';
117
+ import { AgentBuilder } from "@iqai/adk";
118
+ import dotenv from "dotenv";
119
119
 
120
120
  dotenv.config();
121
121
 
122
122
  // Simple agent creation and execution in one fluent chain
123
123
  async function quickQuery() {
124
- const response = await AgentBuilder
125
- .create("query_assistant")
124
+ const response = await AgentBuilder.create("query_assistant")
126
125
  .withModel("gemini-2.5-flash")
127
126
  .withInstruction("You are a helpful AI. Respond clearly and concisely.")
128
127
  .ask("What is the capital of France?");
@@ -132,11 +131,14 @@ async function quickQuery() {
132
131
 
133
132
  // For more complex scenarios, build the agent and get full control
134
133
  async function advancedSetup() {
135
- const { agent, runner, session } = await AgentBuilder
136
- .create("research_assistant")
134
+ const { agent, runner, session } = await AgentBuilder.create(
135
+ "research_assistant",
136
+ )
137
137
  .withModel("gpt-4-turbo")
138
138
  .withDescription("An advanced research assistant")
139
- .withInstruction("You are a research assistant with access to various tools")
139
+ .withInstruction(
140
+ "You are a research assistant with access to various tools",
141
+ )
140
142
  .withTools(new GoogleSearchTool(), new FileOperationsTool())
141
143
  .withQuickSession("research-app", "researcher-456")
142
144
  .build();
@@ -148,15 +150,13 @@ async function advancedSetup() {
148
150
  // Specialized agent types for orchestration
149
151
  async function createWorkflowAgent() {
150
152
  // Sequential execution of multiple agents
151
- const workflow = await AgentBuilder
152
- .create("data_pipeline")
153
+ const workflow = await AgentBuilder.create("data_pipeline")
153
154
  .asSequential([dataCollector, dataProcessor, dataAnalyzer])
154
155
  .withQuickSession("pipeline-app", "admin")
155
156
  .build();
156
157
 
157
158
  // Parallel execution for concurrent tasks
158
- const parallelAnalysis = await AgentBuilder
159
- .create("multi_analysis")
159
+ const parallelAnalysis = await AgentBuilder.create("multi_analysis")
160
160
  .asParallel([sentimentAnalyzer, topicExtractor, summaryGenerator])
161
161
  .build();
162
162
  }
@@ -176,8 +176,8 @@ async function createWorkflowAgent() {
176
176
  Extend your agent's capabilities by defining and integrating custom tools.
177
177
 
178
178
  ```typescript
179
- import { Agent, BaseTool } from '@iqai/adk';
180
- import dotenv from 'dotenv';
179
+ import { Agent, BaseTool } from "@iqai/adk";
180
+ import dotenv from "dotenv";
181
181
 
182
182
  dotenv.config();
183
183
 
@@ -185,8 +185,9 @@ dotenv.config();
185
185
  class CalculatorTool extends BaseTool {
186
186
  constructor() {
187
187
  super({
188
- name: 'calculator',
189
- description: 'Performs basic arithmetic operations: add, subtract, multiply, divide.'
188
+ name: "calculator",
189
+ description:
190
+ "Performs basic arithmetic operations: add, subtract, multiply, divide.",
190
191
  });
191
192
  }
192
193
 
@@ -195,30 +196,38 @@ class CalculatorTool extends BaseTool {
195
196
  name: this.name,
196
197
  description: this.description,
197
198
  parameters: {
198
- type: 'object',
199
+ type: "object",
199
200
  properties: {
200
201
  operation: {
201
- type: 'string',
202
- enum: ['add', 'subtract', 'multiply', 'divide']
202
+ type: "string",
203
+ enum: ["add", "subtract", "multiply", "divide"],
203
204
  },
204
- operand1: { type: 'number' },
205
- operand2: { type: 'number' }
205
+ operand1: { type: "number" },
206
+ operand2: { type: "number" },
206
207
  },
207
- required: ['operation', 'operand1', 'operand2']
208
- }
208
+ required: ["operation", "operand1", "operand2"],
209
+ },
209
210
  };
210
211
  }
211
212
 
212
- async runAsync(args: { operation: string; operand1: number; operand2: number }) {
213
+ async runAsync(args: {
214
+ operation: string;
215
+ operand1: number;
216
+ operand2: number;
217
+ }) {
213
218
  const { operation, operand1, operand2 } = args;
214
219
  switch (operation) {
215
- case 'add': return { result: operand1 + operand2 };
216
- case 'subtract': return { result: operand1 - operand2 };
217
- case 'multiply': return { result: operand1 * operand2 };
218
- case 'divide':
219
- if (operand2 === 0) return { error: 'Cannot divide by zero.' };
220
+ case "add":
221
+ return { result: operand1 + operand2 };
222
+ case "subtract":
223
+ return { result: operand1 - operand2 };
224
+ case "multiply":
225
+ return { result: operand1 * operand2 };
226
+ case "divide":
227
+ if (operand2 === 0) return { error: "Cannot divide by zero." };
220
228
  return { result: operand1 / operand2 };
221
- default: return { error: `Unknown operation: ${operation}` };
229
+ default:
230
+ return { error: `Unknown operation: ${operation}` };
222
231
  }
223
232
  }
224
233
  }
@@ -229,14 +238,12 @@ const mathAgent = new LlmAgent({
229
238
  model: "gpt-4-turbo", // Choose a model proficient with tool usage
230
239
  instructions:
231
240
  "You are a helpful assistant. Use the calculator tool for any mathematical calculations requested.",
232
- tools: [new CalculatorTool()]
241
+ tools: [new CalculatorTool()],
233
242
  });
234
243
 
235
244
  async function performCalculation() {
236
245
  const response = await mathAgent.run({
237
- messages: [
238
- { role: 'user', content: 'What is 15 multiplied by 4?' }
239
- ]
246
+ messages: [{ role: "user", content: "What is 15 multiplied by 4?" }],
240
247
  });
241
248
  // The response.content will likely include the thought process and the tool's output.
242
249
  console.log(JSON.stringify(response, null, 2));
@@ -250,18 +257,16 @@ performCalculation().catch(console.error);
250
257
  ### Multi-Agent Systems
251
258
 
252
259
  ```typescript
253
- import { AgentBuilder } from '@iqai/adk';
260
+ import { AgentBuilder } from "@iqai/adk";
254
261
 
255
262
  // Sequential workflow
256
- const workflow = await AgentBuilder
257
- .create("data_pipeline")
263
+ const workflow = await AgentBuilder.create("data_pipeline")
258
264
  .asSequential([dataCollector, dataProcessor, dataAnalyzer])
259
265
  .withQuickSession("pipeline-app", "admin")
260
266
  .build();
261
267
 
262
268
  // Parallel execution
263
- const parallelAnalysis = await AgentBuilder
264
- .create("multi_analysis")
269
+ const parallelAnalysis = await AgentBuilder.create("multi_analysis")
265
270
  .asParallel([sentimentAnalyzer, topicExtractor, summaryGenerator])
266
271
  .build();
267
272
  ```
@@ -269,32 +274,32 @@ const parallelAnalysis = await AgentBuilder
269
274
  ### Memory & Sessions
270
275
 
271
276
  ```typescript
272
- import { Agent, InMemorySessionService } from '@iqai/adk';
277
+ import { Agent, InMemorySessionService } from "@iqai/adk";
273
278
 
274
279
  const agent = new LlmAgent({
275
280
  name: "persistent_assistant",
276
281
  model: "gpt-4-turbo",
277
282
  sessionService: new InMemorySessionService(),
278
- instructions: "Remember our conversation history."
283
+ instructions: "Remember our conversation history.",
279
284
  });
280
285
  ```
281
286
 
282
287
  ### Custom Tools
283
288
 
284
289
  ```typescript
285
- import { BaseTool } from '@iqai/adk';
290
+ import { BaseTool } from "@iqai/adk";
286
291
 
287
292
  class WeatherTool extends BaseTool {
288
293
  constructor() {
289
294
  super({
290
- name: 'weather',
291
- description: 'Get current weather information'
295
+ name: "weather",
296
+ description: "Get current weather information",
292
297
  });
293
298
  }
294
299
 
295
300
  async runAsync(args: { location: string }) {
296
301
  // Implementation here
297
- return { temperature: 72, condition: 'sunny' };
302
+ return { temperature: 72, condition: "sunny" };
298
303
  }
299
304
  }
300
305
  ```