@iqai/adk 0.5.6 → 0.5.9

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,50 @@
1
1
  # @iqai/adk
2
2
 
3
+ ## 0.5.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 27d6bd9: Refactored MCP sampling parameters to align with the official protocol specification by moving from direct model assertions to the `modelPreferences` hint system.
8
+
9
+ - **Protocol Alignment**
10
+ Removed the invalid `mcpParams.model` type assertion, as the MCP spec does not define a top-level string for the model in sampling requests.
11
+
12
+ - **Preference Logic**
13
+ Implemented support for `modelPreferences.hints`, allowing the server to interpret model suggestions via the `name` property within the hints array.
14
+
15
+ - **Resilience**
16
+ Added optional chaining across the parameter parsing logic to prevent runtime errors when `modelPreferences` or `hints` are undefined.
17
+
18
+ - **Fallback Strategy**
19
+ Established `gemini-2.0-flash` as the default model if the client provides no specific hints or valid preferences.
20
+
21
+ ## 0.5.8
22
+
23
+ ### Patch Changes
24
+
25
+ - d92892c: - Added aggregated token usage tracking (input, output, total) across agents, nested agents, and LLM generations.
26
+ - Introduced model usage tracking per agent and invocation for improved model attribution.
27
+ - Embedded aggregated token and model usage data into Langfuse agent spans and root trace metadata.
28
+ - Ensured compatibility with nested agents without modifying the existing span hierarchy.
29
+ - Implemented cleanup of internal token and model tracking maps after each invocation to prevent memory leaks.
30
+ - Improved event naming with descriptive suffixes (`.function_call`, `.final_response`, `.event`).
31
+ - Included `finishReason` in event metadata for enhanced execution context and observability.
32
+ - 0ada268: Added full plugin support across the agent lifecycle, enabling interception and extension of agent behavior during execution, model calls, and tool invocations.
33
+
34
+ - Integrated plugin manager into `BaseAgent`, giving plugins priority over canonical callbacks.
35
+ - Added `plugins` configuration to `AgentBuilder` and introduced `withPlugins()` API.
36
+ - Updated `LlmAgent` and `BaseAgent` flows to run plugin lifecycle hooks (`before/after agent`, `before/after model`, `before/after tool`, error hooks, etc.).
37
+ - Plugins can now override or modify behavior at multiple stages.
38
+
39
+ - Fully backward compatible (optional chaining, canonical callbacks still work).
40
+ - Enables custom logging, monitoring, request rewriting, caching, rate limiting, and more via plugins.
41
+
42
+ ## 0.5.7
43
+
44
+ ### Patch Changes
45
+
46
+ - b938be4: fix: underlying type errors with Model Context Protocol versioning
47
+
3
48
  ## 0.5.6
4
49
 
5
50
  ### Patch Changes
package/README.md CHANGED
@@ -88,7 +88,7 @@ import dotenv from 'dotenv';
88
88
  dotenv.config();
89
89
 
90
90
  // Instantiate the agent
91
- const myAgent = new Agent({
91
+ const myAgent = new LlmAgent({
92
92
  name: "simple_query_assistant",
93
93
  model: "gemini-2.5-flash", // Or "gpt-4-turbo", "claude-3-opus"
94
94
  description: "A basic assistant to answer questions.",
@@ -229,7 +229,7 @@ class CalculatorTool extends BaseTool {
229
229
  }
230
230
 
231
231
  // Create an agent equipped with the calculator tool
232
- const mathAgent = new Agent({
232
+ const mathAgent = new LlmAgent({
233
233
  name: "math_assistant_agent",
234
234
  model: "gpt-4-turbo", // Choose a model proficient with tool usage
235
235
  instructions:
@@ -276,7 +276,7 @@ const parallelAnalysis = await AgentBuilder
276
276
  ```typescript
277
277
  import { Agent, InMemorySessionService } from '@iqai/adk';
278
278
 
279
- const agent = new Agent({
279
+ const agent = new LlmAgent({
280
280
  name: "persistent_assistant",
281
281
  model: "gpt-4-turbo",
282
282
  sessionService: new InMemorySessionService(),