@google/adk 0.1.2 → 0.2.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.
Files changed (57) hide show
  1. package/dist/cjs/agents/content_processor_utils.js +20 -8
  2. package/dist/cjs/agents/functions.js +23 -32
  3. package/dist/cjs/agents/llm_agent.js +1 -0
  4. package/dist/cjs/artifacts/gcs_artifact_service.js +140 -0
  5. package/dist/cjs/common.js +12 -0
  6. package/dist/cjs/index.js +5 -5
  7. package/dist/cjs/index.js.map +4 -4
  8. package/dist/cjs/models/base_llm.js +12 -3
  9. package/dist/cjs/models/google_llm.js +6 -20
  10. package/dist/cjs/models/registry.js +1 -1
  11. package/dist/cjs/telemetry/google_cloud.js +85 -0
  12. package/dist/cjs/telemetry/setup.js +97 -0
  13. package/dist/cjs/telemetry/tracing.js +231 -0
  14. package/dist/cjs/utils/client_labels.js +56 -0
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/esm/agents/content_processor_utils.js +20 -8
  17. package/dist/esm/agents/functions.js +23 -32
  18. package/dist/esm/agents/llm_agent.js +1 -0
  19. package/dist/esm/artifacts/gcs_artifact_service.js +110 -0
  20. package/dist/esm/common.js +8 -0
  21. package/dist/esm/index.js +5 -5
  22. package/dist/esm/index.js.map +4 -4
  23. package/dist/esm/models/base_llm.js +12 -3
  24. package/dist/esm/models/google_llm.js +6 -20
  25. package/dist/esm/models/registry.js +1 -1
  26. package/dist/esm/telemetry/google_cloud.js +54 -0
  27. package/dist/esm/telemetry/setup.js +67 -0
  28. package/dist/esm/telemetry/tracing.js +195 -0
  29. package/dist/esm/utils/client_labels.js +26 -0
  30. package/dist/esm/version.js +1 -1
  31. package/dist/types/artifacts/gcs_artifact_service.d.ts +16 -0
  32. package/dist/types/common.d.ts +4 -0
  33. package/dist/types/index.d.ts +3 -0
  34. package/dist/types/models/base_llm.d.ts +6 -3
  35. package/dist/types/models/google_llm.d.ts +1 -2
  36. package/dist/types/models/registry.d.ts +6 -2
  37. package/dist/types/telemetry/google_cloud.d.ts +9 -0
  38. package/dist/types/telemetry/setup.d.ts +48 -0
  39. package/dist/types/telemetry/tracing.d.ts +111 -0
  40. package/dist/types/utils/client_labels.d.ts +9 -0
  41. package/dist/types/version.d.ts +1 -1
  42. package/dist/web/agents/content_processor_utils.js +20 -8
  43. package/dist/web/agents/functions.js +23 -32
  44. package/dist/web/agents/llm_agent.js +1 -0
  45. package/dist/web/artifacts/gcs_artifact_service.js +126 -0
  46. package/dist/web/common.js +8 -0
  47. package/dist/web/index.js +1 -1
  48. package/dist/web/index.js.map +4 -4
  49. package/dist/web/models/base_llm.js +12 -3
  50. package/dist/web/models/google_llm.js +6 -20
  51. package/dist/web/models/registry.js +1 -1
  52. package/dist/web/telemetry/google_cloud.js +54 -0
  53. package/dist/web/telemetry/setup.js +67 -0
  54. package/dist/web/telemetry/tracing.js +210 -0
  55. package/dist/web/utils/client_labels.js +26 -0
  56. package/dist/web/version.js +1 -1
  57. package/package.json +20 -4
@@ -3,16 +3,25 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { getClientLabels } from "../utils/client_labels.js";
6
7
  class BaseLlm {
7
8
  /**
8
9
  * Creates an instance of BaseLLM.
9
- *
10
- * @param model The name of the LLM, e.g. gemini-1.5-flash or
10
+ * @param params The parameters for creating a BaseLlm instance.
11
+ * @param params.model The name of the LLM, e.g. gemini-1.5-flash or
11
12
  * gemini-1.5-flash-001.
12
13
  */
13
- constructor(model) {
14
+ constructor({ model }) {
14
15
  this.model = model;
15
16
  }
17
+ get trackingHeaders() {
18
+ const labels = getClientLabels();
19
+ const headerValue = labels.join(" ");
20
+ return {
21
+ "x-goog-api-client": headerValue,
22
+ "user-agent": headerValue
23
+ };
24
+ }
16
25
  /**
17
26
  * Appends a user content, so that model can continue to output.
18
27
  *
@@ -37,10 +37,8 @@ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")])
37
37
  * SPDX-License-Identifier: Apache-2.0
38
38
  */
39
39
  import { createPartFromText, FinishReason, GoogleGenAI } from "@google/genai";
40
- import { isBrowser } from "../utils/env_aware_utils.js";
41
40
  import { logger } from "../utils/logger.js";
42
41
  import { GoogleLLMVariant } from "../utils/variant_utils.js";
43
- import { version } from "../version.js";
44
42
  import { BaseLlm } from "./base_llm.js";
45
43
  import { GeminiLlmConnection } from "./gemini_llm_connection.js";
46
44
  import { createLlmResponse } from "./llm_response.js";
@@ -51,14 +49,17 @@ class Gemini extends BaseLlm {
51
49
  * @param params The parameters for creating a Gemini instance.
52
50
  */
53
51
  constructor({
54
- model = "gemini-2.5-flash",
52
+ model,
55
53
  apiKey,
56
54
  vertexai,
57
55
  project,
58
56
  location,
59
57
  headers
60
- } = {}) {
61
- super(model);
58
+ }) {
59
+ if (!model) {
60
+ model = "gemini-2.5-flash";
61
+ }
62
+ super({ model });
62
63
  this.project = project;
63
64
  this.location = location;
64
65
  this.apiKey = apiKey;
@@ -223,21 +224,6 @@ class Gemini extends BaseLlm {
223
224
  }
224
225
  return this._apiBackend;
225
226
  }
226
- get trackingHeaders() {
227
- if (!this._trackingHeaders) {
228
- let frameworkLabel = "google-adk/".concat(version);
229
- if (!isBrowser() && process.env[AGENT_ENGINE_TELEMETRY_ENV_VARIABLE_NAME]) {
230
- frameworkLabel = "".concat(frameworkLabel, "+").concat(AGENT_ENGINE_TELEMETRY_TAG);
231
- }
232
- const languageLabel = "gl-typescript/".concat(isBrowser() ? window.navigator.userAgent : process.version);
233
- const versionHeaderValue = "".concat(frameworkLabel, " ").concat(languageLabel);
234
- this._trackingHeaders = {
235
- "x-goog-api-client": versionHeaderValue,
236
- "user-agent": versionHeaderValue
237
- };
238
- }
239
- return this._trackingHeaders;
240
- }
241
227
  get liveApiVersion() {
242
228
  if (!this._liveApiVersion) {
243
229
  this._liveApiVersion = this.apiBackend === GoogleLLMVariant.VERTEX_AI ? "v1beta1" : "v1alpha";
@@ -35,7 +35,7 @@ const _LLMRegistry = class _LLMRegistry {
35
35
  * @returns The LLM instance.
36
36
  */
37
37
  static newLlm(model) {
38
- return new (_LLMRegistry.resolve(model))(model);
38
+ return new (_LLMRegistry.resolve(model))({ model });
39
39
  }
40
40
  static _register(modelNameRegex, llmCls) {
41
41
  if (_LLMRegistry.llmRegistryDict.has(modelNameRegex)) {
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { GoogleAuth } from "google-auth-library";
7
+ import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
8
+ import { detectResources } from "@opentelemetry/resources";
9
+ import { gcpDetector } from "@opentelemetry/resource-detector-gcp";
10
+ import { TraceExporter } from "@google-cloud/opentelemetry-cloud-trace-exporter";
11
+ import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
12
+ import { MetricExporter } from "@google-cloud/opentelemetry-cloud-monitoring-exporter";
13
+ import { logger } from "../utils/logger.js";
14
+ const GCP_PROJECT_ERROR_MESSAGE = "Cannot determine GCP Project. OTel GCP Exporters cannot be set up. Please make sure to log into correct GCP Project.";
15
+ async function getGcpProjectId() {
16
+ try {
17
+ const auth = new GoogleAuth();
18
+ const projectId = await auth.getProjectId();
19
+ return projectId || void 0;
20
+ } catch (error) {
21
+ return void 0;
22
+ }
23
+ }
24
+ async function getGcpExporters(config = {}) {
25
+ const {
26
+ enableTracing = false,
27
+ enableMetrics = false
28
+ // enableCloudLogging = false,
29
+ } = config;
30
+ const projectId = await getGcpProjectId();
31
+ if (!projectId) {
32
+ logger.warn(GCP_PROJECT_ERROR_MESSAGE);
33
+ return {};
34
+ }
35
+ return {
36
+ spanProcessors: enableTracing ? [
37
+ new BatchSpanProcessor(new TraceExporter({ projectId }))
38
+ ] : [],
39
+ metricReaders: enableMetrics ? [
40
+ new PeriodicExportingMetricReader({
41
+ exporter: new MetricExporter({ projectId }),
42
+ exportIntervalMillis: 5e3
43
+ })
44
+ ] : [],
45
+ logRecordProcessors: []
46
+ };
47
+ }
48
+ function getGcpResource() {
49
+ return detectResources({ detectors: [gcpDetector] });
50
+ }
51
+ export {
52
+ getGcpExporters,
53
+ getGcpResource
54
+ };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { trace, metrics } from "@opentelemetry/api";
7
+ import { logs } from "@opentelemetry/api-logs";
8
+ import { LoggerProvider, BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
9
+ import { MeterProvider, PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
10
+ import { detectResources } from "@opentelemetry/resources";
11
+ import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
12
+ import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
13
+ import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
14
+ import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
15
+ import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
16
+ function maybeSetOtelProviders(otelHooksToSetup = [], otelResource) {
17
+ const resource = otelResource || getOtelResource();
18
+ const allHooks = [...otelHooksToSetup, getOtelExporters()];
19
+ const spanProcessors = allHooks.flatMap((hooks) => hooks.spanProcessors || []);
20
+ const metricReaders = allHooks.flatMap((hooks) => hooks.metricReaders || []);
21
+ const logRecordProcessors = allHooks.flatMap((hooks) => hooks.logRecordProcessors || []);
22
+ if (spanProcessors.length > 0) {
23
+ const tracerProvider = new NodeTracerProvider({
24
+ resource,
25
+ spanProcessors
26
+ });
27
+ tracerProvider.register();
28
+ trace.setGlobalTracerProvider(tracerProvider);
29
+ }
30
+ if (metricReaders.length > 0) {
31
+ const meterProvider = new MeterProvider({
32
+ readers: metricReaders,
33
+ resource
34
+ });
35
+ metrics.setGlobalMeterProvider(meterProvider);
36
+ }
37
+ if (logRecordProcessors.length > 0) {
38
+ const loggerProvider = new LoggerProvider({
39
+ resource,
40
+ processors: logRecordProcessors
41
+ });
42
+ logs.setGlobalLoggerProvider(loggerProvider);
43
+ }
44
+ }
45
+ function getOtelResource() {
46
+ return detectResources({
47
+ detectors: []
48
+ });
49
+ }
50
+ function getOtelExportersConfig() {
51
+ return {
52
+ enableTracing: !!(process.env.OTEL_EXPORTER_OTLP_ENDPOINT || process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT),
53
+ enableMetrics: !!(process.env.OTEL_EXPORTER_OTLP_ENDPOINT || process.env.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT),
54
+ enableLogging: !!(process.env.OTEL_EXPORTER_OTLP_ENDPOINT || process.env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT)
55
+ };
56
+ }
57
+ function getOtelExporters(config = getOtelExportersConfig()) {
58
+ const { enableTracing, enableMetrics, enableLogging } = config;
59
+ return {
60
+ spanProcessors: enableTracing ? [new BatchSpanProcessor(new OTLPTraceExporter())] : [],
61
+ metricReaders: enableMetrics ? [new PeriodicExportingMetricReader({ exporter: new OTLPMetricExporter() })] : [],
62
+ logRecordProcessors: enableLogging ? [new BatchLogRecordProcessor(new OTLPLogExporter())] : []
63
+ };
64
+ }
65
+ export {
66
+ maybeSetOtelProviders
67
+ };
@@ -0,0 +1,210 @@
1
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
4
+ var __objRest = (source, exclude) => {
5
+ var target = {};
6
+ for (var prop in source)
7
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
8
+ target[prop] = source[prop];
9
+ if (source != null && __getOwnPropSymbols)
10
+ for (var prop of __getOwnPropSymbols(source)) {
11
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
12
+ target[prop] = source[prop];
13
+ }
14
+ return target;
15
+ };
16
+ /**
17
+ * @license
18
+ * Copyright 2025 Google LLC
19
+ * SPDX-License-Identifier: Apache-2.0
20
+ */
21
+ import { trace, context } from "@opentelemetry/api";
22
+ import { version } from "../version.js";
23
+ const GEN_AI_AGENT_DESCRIPTION = "gen_ai.agent.description";
24
+ const GEN_AI_AGENT_NAME = "gen_ai.agent.name";
25
+ const GEN_AI_CONVERSATION_ID = "gen_ai.conversation.id";
26
+ const GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
27
+ const GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id";
28
+ const GEN_AI_TOOL_DESCRIPTION = "gen_ai.tool.description";
29
+ const GEN_AI_TOOL_NAME = "gen_ai.tool.name";
30
+ const GEN_AI_TOOL_TYPE = "gen_ai.tool.type";
31
+ const tracer = trace.getTracer(
32
+ "gcp.vertex.agent",
33
+ version
34
+ );
35
+ function safeJsonSerialize(obj) {
36
+ try {
37
+ return JSON.stringify(obj);
38
+ } catch (error) {
39
+ return "<not serializable>";
40
+ }
41
+ }
42
+ function traceAgentInvocation({
43
+ agent,
44
+ invocationContext
45
+ }) {
46
+ const span = trace.getActiveSpan();
47
+ if (!span) return;
48
+ span.setAttributes({
49
+ [GEN_AI_OPERATION_NAME]: "invoke_agent",
50
+ // Conditionally Required
51
+ [GEN_AI_AGENT_DESCRIPTION]: agent.description,
52
+ [GEN_AI_AGENT_NAME]: agent.name,
53
+ [GEN_AI_CONVERSATION_ID]: invocationContext.session.id
54
+ });
55
+ }
56
+ function traceToolCall({
57
+ tool,
58
+ args,
59
+ functionResponseEvent
60
+ }) {
61
+ var _a, _b;
62
+ const span = trace.getActiveSpan();
63
+ if (!span) return;
64
+ span.setAttributes({
65
+ [GEN_AI_OPERATION_NAME]: "execute_tool",
66
+ [GEN_AI_TOOL_DESCRIPTION]: tool.description || "",
67
+ [GEN_AI_TOOL_NAME]: tool.name,
68
+ // e.g. FunctionTool
69
+ [GEN_AI_TOOL_TYPE]: tool.constructor.name,
70
+ // Setting empty llm request and response (as UI expect these) while not
71
+ // applicable for tool_response.
72
+ "gcp.vertex.agent.llm_request": "{}",
73
+ "gcp.vertex.agent.llm_response": "{}",
74
+ "gcp.vertex.agent.tool_call_args": shouldAddRequestResponseToSpans() ? safeJsonSerialize(args) : "{}"
75
+ });
76
+ let toolCallId = "<not specified>";
77
+ let toolResponse = "<not specified>";
78
+ if ((_a = functionResponseEvent.content) == null ? void 0 : _a.parts) {
79
+ const responseParts = functionResponseEvent.content.parts;
80
+ const functionResponse = (_b = responseParts[0]) == null ? void 0 : _b.functionResponse;
81
+ if (functionResponse == null ? void 0 : functionResponse.id) {
82
+ toolCallId = functionResponse.id;
83
+ }
84
+ if (functionResponse == null ? void 0 : functionResponse.response) {
85
+ toolResponse = functionResponse.response;
86
+ }
87
+ }
88
+ if (typeof toolResponse !== "object" || toolResponse === null) {
89
+ toolResponse = { result: toolResponse };
90
+ }
91
+ span.setAttributes({
92
+ [GEN_AI_TOOL_CALL_ID]: toolCallId,
93
+ "gcp.vertex.agent.event_id": functionResponseEvent.id,
94
+ "gcp.vertex.agent.tool_response": shouldAddRequestResponseToSpans() ? safeJsonSerialize(toolResponse) : "{}"
95
+ });
96
+ }
97
+ function traceMergedToolCalls({
98
+ responseEventId,
99
+ functionResponseEvent
100
+ }) {
101
+ const span = trace.getActiveSpan();
102
+ if (!span) return;
103
+ span.setAttributes({
104
+ [GEN_AI_OPERATION_NAME]: "execute_tool",
105
+ [GEN_AI_TOOL_NAME]: "(merged tools)",
106
+ [GEN_AI_TOOL_DESCRIPTION]: "(merged tools)",
107
+ [GEN_AI_TOOL_CALL_ID]: responseEventId,
108
+ "gcp.vertex.agent.tool_call_args": "N/A",
109
+ "gcp.vertex.agent.event_id": responseEventId,
110
+ // Setting empty llm request and response (as UI expect these) while not
111
+ // applicable for tool_response.
112
+ "gcp.vertex.agent.llm_request": "{}",
113
+ "gcp.vertex.agent.llm_response": "{}"
114
+ });
115
+ span.setAttribute("gcp.vertex.agent.tool_response", shouldAddRequestResponseToSpans() ? safeJsonSerialize(functionResponseEvent) : "{}");
116
+ }
117
+ function traceCallLlm({
118
+ invocationContext,
119
+ eventId,
120
+ llmRequest,
121
+ llmResponse
122
+ }) {
123
+ var _a, _b, _c;
124
+ const span = trace.getActiveSpan();
125
+ if (!span) return;
126
+ span.setAttributes({
127
+ "gen_ai.system": "gcp.vertex.agent",
128
+ "gen_ai.request.model": llmRequest.model,
129
+ "gcp.vertex.agent.invocation_id": invocationContext.invocationId,
130
+ "gcp.vertex.agent.session_id": invocationContext.session.id,
131
+ "gcp.vertex.agent.event_id": eventId,
132
+ // Consider removing once GenAI SDK provides a way to record this info.
133
+ "gcp.vertex.agent.llm_request": shouldAddRequestResponseToSpans() ? safeJsonSerialize(buildLlmRequestForTrace(llmRequest)) : "{}"
134
+ });
135
+ if ((_a = llmRequest.config) == null ? void 0 : _a.topP) {
136
+ span.setAttribute("gen_ai.request.top_p", llmRequest.config.topP);
137
+ }
138
+ if (((_b = llmRequest.config) == null ? void 0 : _b.maxOutputTokens) !== void 0) {
139
+ span.setAttribute("gen_ai.request.max_tokens", llmRequest.config.maxOutputTokens);
140
+ }
141
+ span.setAttribute("gcp.vertex.agent.llm_response", shouldAddRequestResponseToSpans() ? safeJsonSerialize(llmResponse) : "{}");
142
+ if (llmResponse.usageMetadata) {
143
+ span.setAttribute("gen_ai.usage.input_tokens", llmResponse.usageMetadata.promptTokenCount || 0);
144
+ }
145
+ if ((_c = llmResponse.usageMetadata) == null ? void 0 : _c.candidatesTokenCount) {
146
+ span.setAttribute("gen_ai.usage.output_tokens", llmResponse.usageMetadata.candidatesTokenCount);
147
+ }
148
+ if (llmResponse.finishReason) {
149
+ const finishReasonValue = typeof llmResponse.finishReason === "string" ? llmResponse.finishReason.toLowerCase() : String(llmResponse.finishReason).toLowerCase();
150
+ span.setAttribute("gen_ai.response.finish_reasons", [finishReasonValue]);
151
+ }
152
+ }
153
+ function traceSendData({
154
+ invocationContext,
155
+ eventId,
156
+ data
157
+ }) {
158
+ const span = trace.getActiveSpan();
159
+ if (!span) return;
160
+ span.setAttributes({
161
+ "gcp.vertex.agent.invocation_id": invocationContext.invocationId,
162
+ "gcp.vertex.agent.event_id": eventId
163
+ });
164
+ span.setAttribute("gcp.vertex.agent.data", shouldAddRequestResponseToSpans() ? safeJsonSerialize(data) : "{}");
165
+ }
166
+ function buildLlmRequestForTrace(llmRequest) {
167
+ const result = {
168
+ model: llmRequest.model,
169
+ contents: []
170
+ };
171
+ if (llmRequest.config) {
172
+ const _a = llmRequest.config, { responseSchema } = _a, cleanConfig = __objRest(_a, ["responseSchema"]);
173
+ result.config = cleanConfig;
174
+ }
175
+ result.contents = llmRequest.contents.map((content) => {
176
+ var _a2;
177
+ return {
178
+ role: content.role,
179
+ parts: ((_a2 = content.parts) == null ? void 0 : _a2.filter((part) => !part.inlineData)) || []
180
+ };
181
+ });
182
+ return result;
183
+ }
184
+ function bindAsyncGenerator(ctx, generator) {
185
+ return {
186
+ // Bind the next() method to execute within the provided context
187
+ next: context.bind(ctx, generator.next.bind(generator)),
188
+ // Bind the return() method to execute within the provided context
189
+ return: context.bind(ctx, generator.return.bind(generator)),
190
+ // Bind the throw() method to execute within the provided context
191
+ throw: context.bind(ctx, generator.throw.bind(generator)),
192
+ // Ensure the async iterator symbol also returns a context-bound generator
193
+ [Symbol.asyncIterator]() {
194
+ return bindAsyncGenerator(ctx, generator[Symbol.asyncIterator]());
195
+ }
196
+ };
197
+ }
198
+ function shouldAddRequestResponseToSpans() {
199
+ const envValue = process.env.ADK_CAPTURE_MESSAGE_CONTENT_IN_SPANS || "true";
200
+ return envValue === "true" || envValue === "1";
201
+ }
202
+ export {
203
+ bindAsyncGenerator,
204
+ traceAgentInvocation,
205
+ traceCallLlm,
206
+ traceMergedToolCalls,
207
+ traceSendData,
208
+ traceToolCall,
209
+ tracer
210
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { version } from "../version.js";
7
+ import { isBrowser } from "./env_aware_utils.js";
8
+ const ADK_LABEL = "google-adk";
9
+ const LANGUAGE_LABEL = "gl-typescript";
10
+ const AGENT_ENGINE_TELEMETRY_TAG = "remote_reasoning_engine";
11
+ const AGENT_ENGINE_TELEMETRY_ENV_VARIABLE_NAME = "GOOGLE_CLOUD_AGENT_ENGINE_ID";
12
+ function _getDefaultLabels() {
13
+ let frameworkLabel = "".concat(ADK_LABEL, "/").concat(version);
14
+ if (!isBrowser() && process.env[AGENT_ENGINE_TELEMETRY_ENV_VARIABLE_NAME]) {
15
+ frameworkLabel = "".concat(frameworkLabel, "+").concat(AGENT_ENGINE_TELEMETRY_TAG);
16
+ }
17
+ const languageLabel = "".concat(LANGUAGE_LABEL, "/").concat(isBrowser() ? window.navigator.userAgent : process.version);
18
+ return [frameworkLabel, languageLabel];
19
+ }
20
+ function getClientLabels() {
21
+ const labels = _getDefaultLabels();
22
+ return labels;
23
+ }
24
+ export {
25
+ getClientLabels
26
+ };
@@ -3,7 +3,7 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- const version = "0.1.0";
6
+ const version = "0.2.0";
7
7
  export {
8
8
  version
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/adk",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Google ADK JS",
5
5
  "author": "Google",
6
6
  "license": "Apache-2.0",
@@ -38,13 +38,29 @@
38
38
  "format": "prettier --write 'src/**/*.ts'",
39
39
  "prepublishOnly": "npm run build:bundle"
40
40
  },
41
+ "dependencies": {
42
+ "@google/genai": "1.32.0",
43
+ "@modelcontextprotocol/sdk": "^1.24.0",
44
+ "google-auth-library": "^10.3.0",
45
+ "zod": "3.25.76"
46
+ },
41
47
  "devDependencies": {
42
48
  "openapi-types": "^12.1.3"
43
49
  },
44
50
  "peerDependencies": {
45
- "@google/genai": "1.14.0",
46
- "@modelcontextprotocol/sdk": "1.17.5",
51
+ "@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.21.0",
52
+ "@google-cloud/opentelemetry-cloud-trace-exporter": "^3.0.0",
53
+ "@google-cloud/storage": "^7.17.1",
47
54
  "@opentelemetry/api": "1.9.0",
48
- "zod": "3.25.76"
55
+ "@opentelemetry/api-logs": "^0.205.0",
56
+ "@opentelemetry/exporter-logs-otlp-http": "^0.205.0",
57
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.205.0",
58
+ "@opentelemetry/exporter-trace-otlp-http": "^0.205.0",
59
+ "@opentelemetry/resource-detector-gcp": "^0.40.0",
60
+ "@opentelemetry/resources": "^2.1.0",
61
+ "@opentelemetry/sdk-logs": "^0.205.0",
62
+ "@opentelemetry/sdk-metrics": "^2.1.0",
63
+ "@opentelemetry/sdk-trace-base": "^2.1.0",
64
+ "@opentelemetry/sdk-trace-node": "^2.1.0"
49
65
  }
50
66
  }