@iqai/adk 0.5.7 → 0.6.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/CHANGELOG.md +169 -0
- package/README.md +25 -30
- package/dist/index.d.mts +4315 -3447
- package/dist/index.d.ts +4315 -3447
- package/dist/index.js +8982 -6130
- package/dist/index.mjs +8767 -5915
- package/package.json +15 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,174 @@
|
|
|
1
1
|
# @iqai/adk
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c2f9b02: ## Comprehensive Telemetry System Overhaul
|
|
8
|
+
|
|
9
|
+
This release introduces a complete redesign of the telemetry system with extensive features for observability and monitoring.
|
|
10
|
+
|
|
11
|
+
### ✨ New Features
|
|
12
|
+
|
|
13
|
+
**Modular Architecture**
|
|
14
|
+
|
|
15
|
+
- Refactored from monolithic to service-based design
|
|
16
|
+
- Separate modules for tracing, metrics, setup, and utilities
|
|
17
|
+
- Clean `telemetryService` API replacing low-level functions
|
|
18
|
+
|
|
19
|
+
**Metrics Support**
|
|
20
|
+
|
|
21
|
+
- Full metrics collection with OpenTelemetry SDK
|
|
22
|
+
- Counters: agent invocations, tool executions, LLM calls
|
|
23
|
+
- Histograms: duration tracking, token usage (input/output/total)
|
|
24
|
+
- OTLP HTTP exporter for metrics
|
|
25
|
+
|
|
26
|
+
**Privacy Controls**
|
|
27
|
+
|
|
28
|
+
- `ADK_CAPTURE_MESSAGE_CONTENT` environment variable
|
|
29
|
+
- Fine-grained control over sensitive data capture
|
|
30
|
+
- Disable prompt/completion logging for production
|
|
31
|
+
|
|
32
|
+
**Semantic Conventions**
|
|
33
|
+
|
|
34
|
+
- OpenTelemetry GenAI conventions (v1.37+)
|
|
35
|
+
- ADK-specific namespace (`adk.*`) for custom attributes
|
|
36
|
+
- Standardized attribute names across all spans
|
|
37
|
+
|
|
38
|
+
**Enhanced Tracing**
|
|
39
|
+
|
|
40
|
+
- Automatic agent invocation tracing with status tracking
|
|
41
|
+
- Tool execution spans with arguments and results
|
|
42
|
+
- LLM call tracing with token usage metrics
|
|
43
|
+
- Async generator support for streaming responses
|
|
44
|
+
|
|
45
|
+
**Resource Auto-Detection**
|
|
46
|
+
|
|
47
|
+
- Automatic detection of host, OS, and process information
|
|
48
|
+
- Custom resource attributes support
|
|
49
|
+
- Service instance identification
|
|
50
|
+
|
|
51
|
+
**Configuration**
|
|
52
|
+
|
|
53
|
+
- Comprehensive initialization options
|
|
54
|
+
- Sampling ratio control for production
|
|
55
|
+
- Configurable metric export intervals
|
|
56
|
+
- Custom OTLP headers for authentication
|
|
57
|
+
|
|
58
|
+
### 🔧 Breaking Changes
|
|
59
|
+
|
|
60
|
+
- `initializeTelemetry()` → `telemetryService.initialize()`
|
|
61
|
+
- `shutdownTelemetry()` → `telemetryService.shutdown()`
|
|
62
|
+
- Legacy `telemetry.ts` now wraps new service for backward compatibility
|
|
63
|
+
|
|
64
|
+
### 📊 Integration
|
|
65
|
+
|
|
66
|
+
All core components now automatically report metrics:
|
|
67
|
+
|
|
68
|
+
- `BaseAgent.runAsyncInternal()`: Agent metrics
|
|
69
|
+
- `functions.ts`: Tool execution metrics
|
|
70
|
+
- `base-llm-flow.ts`: LLM token and duration metrics
|
|
71
|
+
|
|
72
|
+
### 📚 Documentation
|
|
73
|
+
|
|
74
|
+
- Comprehensive README in `src/telemetry/`
|
|
75
|
+
- Updated observability example with Jaeger + Langfuse
|
|
76
|
+
- Practical examples demonstrating all features
|
|
77
|
+
|
|
78
|
+
### 🛠️ Technical Details
|
|
79
|
+
|
|
80
|
+
**Dependencies Added**:
|
|
81
|
+
|
|
82
|
+
- `@opentelemetry/sdk-metrics@^2.1.0`
|
|
83
|
+
- `@opentelemetry/exporter-metrics-otlp-http@^0.205.0`
|
|
84
|
+
|
|
85
|
+
**Supported Backends**:
|
|
86
|
+
|
|
87
|
+
- Jaeger (local development)
|
|
88
|
+
- Langfuse
|
|
89
|
+
- Datadog
|
|
90
|
+
- New Relic
|
|
91
|
+
- Any OTLP-compatible backend
|
|
92
|
+
|
|
93
|
+
This release provides a production-ready observability foundation for AI applications built with ADK.
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- 7186de5: Fix: Convert Zod schemas to JSON Schema in BasicLlmRequestProcessor
|
|
98
|
+
- 1387333: Improvements to telementry
|
|
99
|
+
|
|
100
|
+
## Unreleased
|
|
101
|
+
|
|
102
|
+
### Major Changes
|
|
103
|
+
|
|
104
|
+
- **BREAKING: Telemetry aligned with OpenTelemetry GenAI Semantic Conventions v1.38.0**
|
|
105
|
+
|
|
106
|
+
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.
|
|
107
|
+
|
|
108
|
+
**Breaking Changes:**
|
|
109
|
+
|
|
110
|
+
- `gen_ai.system` → `gen_ai.provider.name` (automatic provider detection from model names)
|
|
111
|
+
- `gen_ai.usage.total_tokens` removed (compute client-side: input + output)
|
|
112
|
+
- `call_llm` operation deprecated in favor of standard `chat`, `text_completion`, `generate_content`
|
|
113
|
+
- `traceCallback` signature changed: removed unused `targetName` parameter
|
|
114
|
+
|
|
115
|
+
**New Features:**
|
|
116
|
+
|
|
117
|
+
- Automatic provider detection (OpenAI, Anthropic, Google, AWS Bedrock, Mistral, Groq, Cohere, etc.)
|
|
118
|
+
- Enhanced LLM attributes: `response.id`, `response.model`, `output.type`, `top_k`, `frequency_penalty`, `presence_penalty`, `stop_sequences`, `seed`
|
|
119
|
+
- Structured content capture: `system_instructions`, `input.messages`, `output.messages`, `tool.definitions`
|
|
120
|
+
- Agent ID tracking: `gen_ai.agent.id` for unique agent identification
|
|
121
|
+
- Tool argument/result capture: `gen_ai.tool.call.arguments`, `gen_ai.tool.call.result`
|
|
122
|
+
- Standard metrics constants: `gen_ai.client.operation.duration`, `gen_ai.client.token.usage`
|
|
123
|
+
- Error type tracking: `error.type` attribute for low-cardinality error identification
|
|
124
|
+
|
|
125
|
+
**Backward Compatibility:**
|
|
126
|
+
|
|
127
|
+
- Deprecated constants are still available but will be removed in v1.0.0
|
|
128
|
+
- All `adk.*` namespace attributes remain unchanged
|
|
129
|
+
- Legacy content events preserved for one release cycle
|
|
130
|
+
|
|
131
|
+
See [TELEMETRY_MIGRATION.md](./TELEMETRY_MIGRATION.md) for detailed migration guide.
|
|
132
|
+
|
|
133
|
+
## 0.5.9
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- 27d6bd9: Refactored MCP sampling parameters to align with the official protocol specification by moving from direct model assertions to the `modelPreferences` hint system.
|
|
138
|
+
|
|
139
|
+
- **Protocol Alignment**
|
|
140
|
+
Removed the invalid `mcpParams.model` type assertion, as the MCP spec does not define a top-level string for the model in sampling requests.
|
|
141
|
+
|
|
142
|
+
- **Preference Logic**
|
|
143
|
+
Implemented support for `modelPreferences.hints`, allowing the server to interpret model suggestions via the `name` property within the hints array.
|
|
144
|
+
|
|
145
|
+
- **Resilience**
|
|
146
|
+
Added optional chaining across the parameter parsing logic to prevent runtime errors when `modelPreferences` or `hints` are undefined.
|
|
147
|
+
|
|
148
|
+
- **Fallback Strategy**
|
|
149
|
+
Established `gemini-2.0-flash` as the default model if the client provides no specific hints or valid preferences.
|
|
150
|
+
|
|
151
|
+
## 0.5.8
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- d92892c: - Added aggregated token usage tracking (input, output, total) across agents, nested agents, and LLM generations.
|
|
156
|
+
- Introduced model usage tracking per agent and invocation for improved model attribution.
|
|
157
|
+
- Embedded aggregated token and model usage data into Langfuse agent spans and root trace metadata.
|
|
158
|
+
- Ensured compatibility with nested agents without modifying the existing span hierarchy.
|
|
159
|
+
- Implemented cleanup of internal token and model tracking maps after each invocation to prevent memory leaks.
|
|
160
|
+
- Improved event naming with descriptive suffixes (`.function_call`, `.final_response`, `.event`).
|
|
161
|
+
- Included `finishReason` in event metadata for enhanced execution context and observability.
|
|
162
|
+
- 0ada268: Added full plugin support across the agent lifecycle, enabling interception and extension of agent behavior during execution, model calls, and tool invocations.
|
|
163
|
+
|
|
164
|
+
- Integrated plugin manager into `BaseAgent`, giving plugins priority over canonical callbacks.
|
|
165
|
+
- Added `plugins` configuration to `AgentBuilder` and introduced `withPlugins()` API.
|
|
166
|
+
- Updated `LlmAgent` and `BaseAgent` flows to run plugin lifecycle hooks (`before/after agent`, `before/after model`, `before/after tool`, error hooks, etc.).
|
|
167
|
+
- Plugins can now override or modify behavior at multiple stages.
|
|
168
|
+
|
|
169
|
+
- Fully backward compatible (optional chaining, canonical callbacks still work).
|
|
170
|
+
- Enables custom logging, monitoring, request rewriting, caching, rate limiting, and more via plugins.
|
|
171
|
+
|
|
3
172
|
## 0.5.7
|
|
4
173
|
|
|
5
174
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</
|
|
23
|
-
|
|
24
|
-
<img src="https://img.shields.io/github/stars/IQAIcom/adk-ts?style=social" alt="GitHub Stars" />
|
|
25
|
-
</a>
|
|
26
|
-
</p>
|
|
2
|
+
<img src="https://files.catbox.moe/vumztw.png" alt="ADK-TS Logo" width="100" />
|
|
3
|
+
<br/>
|
|
4
|
+
<h1>@iqai/adk</h1>
|
|
5
|
+
<b>The core TypeScript library for building sophisticated AI agents with multi-LLM support, advanced tools, and flexible conversation flows.</b>
|
|
6
|
+
<br/>
|
|
7
|
+
<i>Production-ready • Multi-Agent Systems • Extensible Architecture</i>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@iqai/adk">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/@iqai/adk" alt="NPM Version" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@iqai/adk">
|
|
14
|
+
<img src="https://img.shields.io/npm/dm/@iqai/adk" alt="NPM Downloads" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://github.com/IQAIcom/adk-ts/blob/main/LICENSE.md">
|
|
17
|
+
<img src="https://img.shields.io/npm/l/@iqai/adk" alt="License" />
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://github.com/IQAIcom/adk-ts">
|
|
20
|
+
<img src="https://img.shields.io/github/stars/IQAIcom/adk-ts?style=social" alt="GitHub Stars" />
|
|
21
|
+
</a>
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
27
24
|
|
|
28
25
|
---
|
|
29
26
|
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
27
|
## 🌟 Overview
|
|
33
28
|
|
|
34
29
|
`@iqai/adk` is the core TypeScript library for the Agent Development Kit, providing the foundational tools and abstractions to build sophisticated AI agents. It enables seamless integration with multiple Large Language Models (LLMs), advanced tool usage, and persistent memory capabilities.
|
|
@@ -88,7 +83,7 @@ import dotenv from 'dotenv';
|
|
|
88
83
|
dotenv.config();
|
|
89
84
|
|
|
90
85
|
// Instantiate the agent
|
|
91
|
-
const myAgent = new
|
|
86
|
+
const myAgent = new LlmAgent({
|
|
92
87
|
name: "simple_query_assistant",
|
|
93
88
|
model: "gemini-2.5-flash", // Or "gpt-4-turbo", "claude-3-opus"
|
|
94
89
|
description: "A basic assistant to answer questions.",
|
|
@@ -229,7 +224,7 @@ class CalculatorTool extends BaseTool {
|
|
|
229
224
|
}
|
|
230
225
|
|
|
231
226
|
// Create an agent equipped with the calculator tool
|
|
232
|
-
const mathAgent = new
|
|
227
|
+
const mathAgent = new LlmAgent({
|
|
233
228
|
name: "math_assistant_agent",
|
|
234
229
|
model: "gpt-4-turbo", // Choose a model proficient with tool usage
|
|
235
230
|
instructions:
|
|
@@ -276,7 +271,7 @@ const parallelAnalysis = await AgentBuilder
|
|
|
276
271
|
```typescript
|
|
277
272
|
import { Agent, InMemorySessionService } from '@iqai/adk';
|
|
278
273
|
|
|
279
|
-
const agent = new
|
|
274
|
+
const agent = new LlmAgent({
|
|
280
275
|
name: "persistent_assistant",
|
|
281
276
|
model: "gpt-4-turbo",
|
|
282
277
|
sessionService: new InMemorySessionService(),
|