@google/adk 0.3.0 → 0.4.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 (183) hide show
  1. package/dist/cjs/a2a/part_converter_utils.js +210 -0
  2. package/dist/cjs/agents/active_streaming_tool.js +1 -1
  3. package/dist/cjs/agents/base_agent.js +3 -3
  4. package/dist/cjs/agents/base_llm_processor.js +1 -1
  5. package/dist/cjs/agents/callback_context.js +1 -1
  6. package/dist/cjs/agents/content_processor_utils.js +1 -1
  7. package/dist/cjs/agents/functions.js +2 -1
  8. package/dist/cjs/agents/instructions.js +1 -1
  9. package/dist/cjs/agents/invocation_context.js +1 -1
  10. package/dist/cjs/agents/live_request_queue.js +1 -1
  11. package/dist/cjs/agents/llm_agent.js +58 -40
  12. package/dist/cjs/agents/loop_agent.js +1 -1
  13. package/dist/cjs/agents/parallel_agent.js +1 -1
  14. package/dist/cjs/agents/readonly_context.js +13 -1
  15. package/dist/cjs/agents/run_config.js +2 -1
  16. package/dist/cjs/agents/sequential_agent.js +1 -1
  17. package/dist/cjs/agents/transcription_entry.js +1 -1
  18. package/dist/cjs/artifacts/base_artifact_service.js +1 -1
  19. package/dist/cjs/artifacts/file_artifact_service.js +491 -0
  20. package/dist/cjs/artifacts/gcs_artifact_service.js +127 -48
  21. package/dist/cjs/artifacts/in_memory_artifact_service.js +54 -6
  22. package/dist/cjs/artifacts/registry.js +55 -0
  23. package/dist/cjs/auth/auth_credential.js +1 -1
  24. package/dist/cjs/auth/auth_handler.js +1 -1
  25. package/dist/cjs/auth/auth_schemes.js +1 -1
  26. package/dist/cjs/auth/auth_tool.js +1 -1
  27. package/dist/cjs/auth/credential_service/base_credential_service.js +1 -1
  28. package/dist/cjs/auth/credential_service/in_memory_credential_service.js +1 -1
  29. package/dist/cjs/auth/exchanger/base_credential_exchanger.js +1 -1
  30. package/dist/cjs/auth/exchanger/credential_exchanger_registry.js +1 -1
  31. package/dist/cjs/code_executors/base_code_executor.js +1 -1
  32. package/dist/cjs/code_executors/built_in_code_executor.js +1 -1
  33. package/dist/cjs/code_executors/code_execution_utils.js +1 -1
  34. package/dist/cjs/code_executors/code_executor_context.js +1 -1
  35. package/dist/cjs/common.js +14 -1
  36. package/dist/cjs/events/event.js +33 -4
  37. package/dist/cjs/events/event_actions.js +2 -2
  38. package/dist/cjs/events/structured_events.js +105 -0
  39. package/dist/cjs/examples/base_example_provider.js +1 -1
  40. package/dist/cjs/examples/example.js +1 -1
  41. package/dist/cjs/examples/example_util.js +1 -1
  42. package/dist/cjs/index.js +54 -83
  43. package/dist/cjs/index_web.js +1 -1
  44. package/dist/cjs/memory/base_memory_service.js +1 -1
  45. package/dist/cjs/memory/in_memory_memory_service.js +1 -1
  46. package/dist/cjs/memory/memory_entry.js +1 -1
  47. package/dist/cjs/models/apigee_llm.js +182 -0
  48. package/dist/cjs/models/base_llm.js +1 -1
  49. package/dist/cjs/models/base_llm_connection.js +1 -1
  50. package/dist/cjs/models/gemini_llm_connection.js +1 -1
  51. package/dist/cjs/models/google_llm.js +70 -51
  52. package/dist/cjs/models/llm_request.js +1 -1
  53. package/dist/cjs/models/llm_response.js +1 -1
  54. package/dist/cjs/models/registry.js +3 -1
  55. package/dist/cjs/plugins/base_plugin.js +1 -1
  56. package/dist/cjs/plugins/logging_plugin.js +1 -1
  57. package/dist/cjs/plugins/plugin_manager.js +1 -1
  58. package/dist/cjs/plugins/security_plugin.js +1 -1
  59. package/dist/cjs/runner/in_memory_runner.js +1 -1
  60. package/dist/cjs/runner/runner.js +32 -1
  61. package/dist/cjs/sessions/base_session_service.js +53 -3
  62. package/dist/cjs/sessions/database_session_service.js +364 -0
  63. package/dist/cjs/sessions/db/operations.js +114 -0
  64. package/dist/cjs/sessions/db/schema.js +204 -0
  65. package/dist/cjs/sessions/in_memory_session_service.js +24 -22
  66. package/dist/cjs/sessions/registry.js +49 -0
  67. package/dist/cjs/sessions/session.js +1 -1
  68. package/dist/cjs/sessions/state.js +1 -1
  69. package/dist/cjs/telemetry/google_cloud.js +1 -1
  70. package/dist/cjs/telemetry/setup.js +1 -1
  71. package/dist/cjs/telemetry/tracing.js +1 -1
  72. package/dist/cjs/tools/agent_tool.js +1 -1
  73. package/dist/cjs/tools/base_tool.js +1 -1
  74. package/dist/cjs/tools/base_toolset.js +1 -1
  75. package/dist/cjs/tools/forwarding_artifact_service.js +17 -1
  76. package/dist/cjs/tools/function_tool.js +1 -1
  77. package/dist/cjs/tools/google_search_tool.js +1 -1
  78. package/dist/cjs/tools/long_running_tool.js +1 -1
  79. package/dist/cjs/tools/mcp/mcp_session_manager.js +1 -1
  80. package/dist/cjs/tools/mcp/mcp_tool.js +1 -1
  81. package/dist/cjs/tools/mcp/mcp_toolset.js +1 -1
  82. package/dist/cjs/tools/tool_confirmation.js +1 -1
  83. package/dist/cjs/tools/tool_context.js +1 -1
  84. package/dist/cjs/utils/client_labels.js +1 -1
  85. package/dist/cjs/utils/env_aware_utils.js +10 -1
  86. package/dist/cjs/utils/gemini_schema_util.js +1 -1
  87. package/dist/cjs/utils/logger.js +1 -1
  88. package/dist/cjs/utils/model_name.js +1 -1
  89. package/dist/cjs/utils/object_notation_utils.js +78 -0
  90. package/dist/cjs/utils/simple_zod_to_json.js +1 -1
  91. package/dist/cjs/utils/variant_utils.js +3 -9
  92. package/dist/cjs/version.js +2 -2
  93. package/dist/esm/a2a/part_converter_utils.js +171 -0
  94. package/dist/esm/agents/base_agent.js +2 -2
  95. package/dist/esm/agents/functions.js +1 -0
  96. package/dist/esm/agents/llm_agent.js +58 -40
  97. package/dist/esm/agents/readonly_context.js +12 -0
  98. package/dist/esm/agents/run_config.js +1 -0
  99. package/dist/esm/artifacts/file_artifact_service.js +451 -0
  100. package/dist/esm/artifacts/gcs_artifact_service.js +126 -47
  101. package/dist/esm/artifacts/in_memory_artifact_service.js +51 -4
  102. package/dist/esm/artifacts/registry.js +28 -0
  103. package/dist/esm/common.js +9 -1
  104. package/dist/esm/events/event.js +29 -2
  105. package/dist/esm/events/event_actions.js +1 -1
  106. package/dist/esm/events/structured_events.js +74 -0
  107. package/dist/esm/index.js +18 -88
  108. package/dist/esm/models/apigee_llm.js +152 -0
  109. package/dist/esm/models/google_llm.js +67 -49
  110. package/dist/esm/models/registry.js +2 -0
  111. package/dist/esm/runner/runner.js +31 -0
  112. package/dist/esm/sessions/base_session_service.js +49 -1
  113. package/dist/esm/sessions/database_session_service.js +350 -0
  114. package/dist/esm/sessions/db/operations.js +87 -0
  115. package/dist/esm/sessions/db/schema.js +172 -0
  116. package/dist/esm/sessions/in_memory_session_service.js +23 -21
  117. package/dist/esm/sessions/registry.js +25 -0
  118. package/dist/esm/tools/forwarding_artifact_service.js +16 -0
  119. package/dist/esm/utils/env_aware_utils.js +8 -0
  120. package/dist/esm/utils/object_notation_utils.js +47 -0
  121. package/dist/esm/utils/variant_utils.js +1 -7
  122. package/dist/esm/version.js +1 -1
  123. package/dist/types/a2a/part_converter_utils.d.ts +47 -0
  124. package/dist/types/agents/llm_agent.d.ts +11 -11
  125. package/dist/types/agents/readonly_context.d.ts +8 -0
  126. package/dist/types/agents/run_config.d.ts +6 -0
  127. package/dist/types/artifacts/base_artifact_service.d.ts +31 -0
  128. package/dist/types/artifacts/file_artifact_service.d.ts +43 -0
  129. package/dist/types/artifacts/gcs_artifact_service.d.ts +3 -1
  130. package/dist/types/artifacts/in_memory_artifact_service.d.ts +5 -2
  131. package/dist/types/artifacts/registry.d.ts +7 -0
  132. package/dist/types/common.d.ts +11 -2
  133. package/dist/types/events/event.d.ts +15 -1
  134. package/dist/types/events/event_actions.d.ts +1 -1
  135. package/dist/types/events/structured_events.d.ts +106 -0
  136. package/dist/types/index.d.ts +5 -1
  137. package/dist/types/models/apigee_llm.d.ts +59 -0
  138. package/dist/types/models/google_llm.d.ts +5 -2
  139. package/dist/types/runner/runner.d.ts +15 -0
  140. package/dist/types/sessions/base_session_service.d.ts +20 -0
  141. package/dist/types/sessions/database_session_service.d.ts +31 -0
  142. package/dist/types/sessions/db/operations.d.ts +29 -0
  143. package/dist/types/sessions/db/schema.d.ts +45 -0
  144. package/dist/types/sessions/in_memory_session_service.d.ts +4 -1
  145. package/dist/types/sessions/registry.d.ts +7 -0
  146. package/dist/types/tools/forwarding_artifact_service.d.ts +3 -1
  147. package/dist/types/utils/env_aware_utils.d.ts +7 -0
  148. package/dist/types/utils/object_notation_utils.d.ts +21 -0
  149. package/dist/types/version.d.ts +1 -1
  150. package/dist/web/a2a/part_converter_utils.js +171 -0
  151. package/dist/web/agents/base_agent.js +2 -2
  152. package/dist/web/agents/functions.js +1 -0
  153. package/dist/web/agents/llm_agent.js +79 -59
  154. package/dist/web/agents/readonly_context.js +12 -0
  155. package/dist/web/agents/run_config.js +2 -1
  156. package/dist/web/artifacts/file_artifact_service.js +506 -0
  157. package/dist/web/artifacts/gcs_artifact_service.js +123 -46
  158. package/dist/web/artifacts/in_memory_artifact_service.js +51 -4
  159. package/dist/web/artifacts/registry.js +28 -0
  160. package/dist/web/common.js +9 -1
  161. package/dist/web/events/event.js +29 -2
  162. package/dist/web/events/event_actions.js +1 -1
  163. package/dist/web/events/structured_events.js +74 -0
  164. package/dist/web/index.js +18 -8
  165. package/dist/web/models/apigee_llm.js +219 -0
  166. package/dist/web/models/google_llm.js +67 -46
  167. package/dist/web/models/registry.js +2 -0
  168. package/dist/web/runner/runner.js +33 -0
  169. package/dist/web/sessions/base_session_service.js +49 -1
  170. package/dist/web/sessions/database_session_service.js +368 -0
  171. package/dist/web/sessions/db/operations.js +87 -0
  172. package/dist/web/sessions/db/schema.js +172 -0
  173. package/dist/web/sessions/in_memory_session_service.js +23 -21
  174. package/dist/web/sessions/registry.js +25 -0
  175. package/dist/web/tools/forwarding_artifact_service.js +16 -0
  176. package/dist/web/utils/env_aware_utils.js +8 -0
  177. package/dist/web/utils/object_notation_utils.js +47 -0
  178. package/dist/web/utils/variant_utils.js +1 -7
  179. package/dist/web/version.js +1 -1
  180. package/package.json +13 -4
  181. package/dist/cjs/index.js.map +0 -7
  182. package/dist/esm/index.js.map +0 -7
  183. package/dist/web/index.js.map +0 -7
@@ -97,7 +97,7 @@ import {
97
97
  } from "../models/llm_request.js";
98
98
  import { LLMRegistry } from "../models/registry.js";
99
99
  import { State } from "../sessions/state.js";
100
- import { BaseTool } from "../tools/base_tool.js";
100
+ import { isBaseTool } from "../tools/base_tool.js";
101
101
  import { FunctionTool } from "../tools/function_tool.js";
102
102
  import { ToolConfirmation } from "../tools/tool_confirmation.js";
103
103
  import { ToolContext } from "../tools/tool_context.js";
@@ -108,6 +108,7 @@ import {
108
108
  traceCallLlm,
109
109
  tracer
110
110
  } from "../telemetry/tracing.js";
111
+ import { isZodObject, zodObjectToSchema } from "../utils/simple_zod_to_json.js";
111
112
  import { BaseAgent } from "./base_agent.js";
112
113
  import {
113
114
  BaseLlmRequestProcessor
@@ -131,7 +132,7 @@ import { ReadonlyContext } from "./readonly_context.js";
131
132
  import { StreamingMode } from "./run_config.js";
132
133
  const ADK_AGENT_NAME_LABEL_KEY = "adk_agent_name";
133
134
  async function convertToolUnionToTools(toolUnion, context2) {
134
- if (toolUnion instanceof BaseTool) {
135
+ if (isBaseTool(toolUnion)) {
135
136
  return [toolUnion];
136
137
  }
137
138
  return await toolUnion.getTools(context2);
@@ -185,7 +186,7 @@ class InstructionsLlmRequestProcessor extends BaseLlmRequestProcessor {
185
186
  runAsync(invocationContext, llmRequest) {
186
187
  return __asyncGenerator(this, null, function* () {
187
188
  const agent = invocationContext.agent;
188
- if (!(agent instanceof LlmAgent) || !(agent.rootAgent instanceof LlmAgent)) {
189
+ if (!isLlmAgent(agent) || !isLlmAgent(agent.rootAgent)) {
189
190
  return;
190
191
  }
191
192
  const rootAgent = agent.rootAgent;
@@ -267,7 +268,7 @@ class AgentTransferLlmRequestProcessor extends BaseLlmRequestProcessor {
267
268
  // eslint-disable-next-line require-yield
268
269
  runAsync(invocationContext, llmRequest) {
269
270
  return __asyncGenerator(this, null, function* () {
270
- if (!(invocationContext.agent instanceof LlmAgent)) {
271
+ if (!isLlmAgent(invocationContext.agent)) {
271
272
  return;
272
273
  }
273
274
  const transferTargets = this.getTransferTargets(invocationContext.agent);
@@ -438,7 +439,7 @@ const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR = new RequestConfirmationLlmReq
438
439
  class CodeExecutionRequestProcessor extends BaseLlmRequestProcessor {
439
440
  runAsync(invocationContext, llmRequest) {
440
441
  return __asyncGenerator(this, null, function* () {
441
- if (!(invocationContext.agent instanceof LlmAgent)) {
442
+ if (!isLlmAgent(invocationContext.agent)) {
442
443
  return;
443
444
  }
444
445
  if (!invocationContext.agent.codeExecutor) {
@@ -772,8 +773,8 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
772
773
  this.disallowTransferToParent = (_d = config.disallowTransferToParent) != null ? _d : false;
773
774
  this.disallowTransferToPeers = (_e = config.disallowTransferToPeers) != null ? _e : false;
774
775
  this.includeContents = (_f = config.includeContents) != null ? _f : "default";
775
- this.inputSchema = config.inputSchema;
776
- this.outputSchema = config.outputSchema;
776
+ this.inputSchema = isZodObject(config.inputSchema) ? zodObjectToSchema(config.inputSchema) : config.inputSchema;
777
+ this.outputSchema = isZodObject(config.outputSchema) ? zodObjectToSchema(config.outputSchema) : config.outputSchema;
777
778
  this.outputKey = config.outputKey;
778
779
  this.beforeModelCallback = config.beforeModelCallback;
779
780
  this.afterModelCallback = config.afterModelCallback;
@@ -818,16 +819,6 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
818
819
  this.disallowTransferToParent = true;
819
820
  this.disallowTransferToPeers = true;
820
821
  }
821
- if (this.subAgents && this.subAgents.length > 0) {
822
- throw new Error(
823
- "Invalid config for agent ".concat(this.name, ": if outputSchema is set, subAgents must be empty to disable agent transfer.")
824
- );
825
- }
826
- if (this.tools && this.tools.length > 0) {
827
- throw new Error(
828
- "Invalid config for agent ".concat(this.name, ": if outputSchema is set, tools must be empty")
829
- );
830
- }
831
822
  }
832
823
  }
833
824
  /**
@@ -1115,46 +1106,56 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
1115
1106
  this,
1116
1107
  function() {
1117
1108
  return __asyncGenerator(this, null, function* () {
1118
- try {
1119
- for (var iter3 = __forAwait(this.callLlmAsync(
1120
- invocationContext,
1121
- llmRequest,
1122
- modelResponseEvent
1123
- )), more3, temp3, error3; more3 = !(temp3 = yield new __await(iter3.next())).done; more3 = false) {
1124
- const llmResponse = temp3.value;
1109
+ const responsesGenerator = function() {
1110
+ return __asyncGenerator(this, null, function* () {
1125
1111
  try {
1126
- for (var iter2 = __forAwait(this.postprocess(
1112
+ for (var iter3 = __forAwait(this.callLlmAsync(
1127
1113
  invocationContext,
1128
1114
  llmRequest,
1129
- llmResponse,
1130
1115
  modelResponseEvent
1131
- )), more2, temp2, error2; more2 = !(temp2 = yield new __await(iter2.next())).done; more2 = false) {
1132
- const event = temp2.value;
1133
- modelResponseEvent.id = createNewEventId();
1134
- modelResponseEvent.timestamp = (/* @__PURE__ */ new Date()).getTime();
1135
- yield event;
1116
+ )), more3, temp3, error3; more3 = !(temp3 = yield new __await(iter3.next())).done; more3 = false) {
1117
+ const llmResponse = temp3.value;
1118
+ try {
1119
+ for (var iter2 = __forAwait(this.postprocess(
1120
+ invocationContext,
1121
+ llmRequest,
1122
+ llmResponse,
1123
+ modelResponseEvent
1124
+ )), more2, temp2, error2; more2 = !(temp2 = yield new __await(iter2.next())).done; more2 = false) {
1125
+ const event = temp2.value;
1126
+ modelResponseEvent.id = createNewEventId();
1127
+ modelResponseEvent.timestamp = (/* @__PURE__ */ new Date()).getTime();
1128
+ yield event;
1129
+ }
1130
+ } catch (temp2) {
1131
+ error2 = [temp2];
1132
+ } finally {
1133
+ try {
1134
+ more2 && (temp2 = iter2.return) && (yield new __await(temp2.call(iter2)));
1135
+ } finally {
1136
+ if (error2)
1137
+ throw error2[0];
1138
+ }
1139
+ }
1136
1140
  }
1137
- } catch (temp2) {
1138
- error2 = [temp2];
1141
+ } catch (temp3) {
1142
+ error3 = [temp3];
1139
1143
  } finally {
1140
1144
  try {
1141
- more2 && (temp2 = iter2.return) && (yield new __await(temp2.call(iter2)));
1145
+ more3 && (temp3 = iter3.return) && (yield new __await(temp3.call(iter3)));
1142
1146
  } finally {
1143
- if (error2)
1144
- throw error2[0];
1147
+ if (error3)
1148
+ throw error3[0];
1145
1149
  }
1146
1150
  }
1147
- }
1148
- } catch (temp3) {
1149
- error3 = [temp3];
1150
- } finally {
1151
- try {
1152
- more3 && (temp3 = iter3.return) && (yield new __await(temp3.call(iter3)));
1153
- } finally {
1154
- if (error3)
1155
- throw error3[0];
1156
- }
1157
- }
1151
+ });
1152
+ };
1153
+ yield* __yieldStar(this.runAndHandleError(
1154
+ responsesGenerator.call(this),
1155
+ invocationContext,
1156
+ llmRequest,
1157
+ modelResponseEvent
1158
+ ));
1158
1159
  });
1159
1160
  }
1160
1161
  ));
@@ -1163,7 +1164,7 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
1163
1164
  }
1164
1165
  postprocess(invocationContext, llmRequest, llmResponse, modelResponseEvent) {
1165
1166
  return __asyncGenerator(this, null, function* () {
1166
- var _a2;
1167
+ var _a2, _b2;
1167
1168
  for (const processor of this.responseProcessors) {
1168
1169
  try {
1169
1170
  for (var iter = __forAwait(processor.runAsync(
@@ -1201,6 +1202,10 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
1201
1202
  if (!((_a2 = getFunctionCalls(mergedEvent)) == null ? void 0 : _a2.length)) {
1202
1203
  return;
1203
1204
  }
1205
+ if ((_b2 = invocationContext.runConfig) == null ? void 0 : _b2.pauseOnToolCalls) {
1206
+ invocationContext.endInvocation = true;
1207
+ return;
1208
+ }
1204
1209
  const functionResponseEvent = yield new __await(handleFunctionCallsAsync({
1205
1210
  invocationContext,
1206
1211
  functionCallEvent: mergedEvent,
@@ -1225,6 +1230,8 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
1225
1230
  });
1226
1231
  if (toolConfirmationEvent) {
1227
1232
  yield toolConfirmationEvent;
1233
+ invocationContext.endInvocation = true;
1234
+ return;
1228
1235
  }
1229
1236
  yield functionResponseEvent;
1230
1237
  const nextAgentName = functionResponseEvent.actions.transferToAgent;
@@ -1296,12 +1303,7 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
1296
1303
  ((_e = invocationContext.runConfig) == null ? void 0 : _e.streamingMode) === StreamingMode.SSE
1297
1304
  );
1298
1305
  try {
1299
- for (var iter = __forAwait(this.runAndHandleError(
1300
- responsesGenerator,
1301
- invocationContext,
1302
- llmRequest,
1303
- modelResponseEvent
1304
- )), more, temp, error; more = !(temp = yield new __await(iter.next())).done; more = false) {
1306
+ for (var iter = __forAwait(responsesGenerator), more, temp, error; more = !(temp = yield new __await(iter.next())).done; more = false) {
1305
1307
  const llmResponse = temp.value;
1306
1308
  traceCallLlm({
1307
1309
  invocationContext,
@@ -1407,11 +1409,29 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
1407
1409
  if (onModelErrorCallbackResponse) {
1408
1410
  yield onModelErrorCallbackResponse;
1409
1411
  } else {
1410
- const errorResponse = JSON.parse(modelError.message);
1411
- yield {
1412
- errorCode: String(errorResponse.error.code),
1413
- errorMessage: errorResponse.error.message
1414
- };
1412
+ let errorCode = "UNKNOWN_ERROR";
1413
+ let errorMessage = modelError.message;
1414
+ try {
1415
+ const errorResponse = JSON.parse(modelError.message);
1416
+ if (errorResponse == null ? void 0 : errorResponse.error) {
1417
+ errorCode = String(errorResponse.error.code || "UNKNOWN_ERROR");
1418
+ errorMessage = errorResponse.error.message || errorMessage;
1419
+ }
1420
+ } catch (e) {
1421
+ }
1422
+ if (modelResponseEvent.actions) {
1423
+ yield createEvent({
1424
+ invocationId: invocationContext.invocationId,
1425
+ author: this.name,
1426
+ errorCode,
1427
+ errorMessage
1428
+ });
1429
+ } else {
1430
+ yield {
1431
+ errorCode,
1432
+ errorMessage
1433
+ };
1434
+ }
1415
1435
  }
1416
1436
  } else {
1417
1437
  logger.error("Unknown error during response generation", modelError);
@@ -20,6 +20,18 @@ class ReadonlyContext {
20
20
  get invocationId() {
21
21
  return this.invocationContext.invocationId;
22
22
  }
23
+ /**
24
+ * The user ID of the current session.
25
+ */
26
+ get userId() {
27
+ return this.invocationContext.userId;
28
+ }
29
+ /**
30
+ * The ID of the current session.
31
+ */
32
+ get sessionId() {
33
+ return this.invocationContext.session.id;
34
+ }
23
35
  /**
24
36
  * The current agent name.
25
37
  */
@@ -32,7 +32,8 @@ function createRunConfig(params = {}) {
32
32
  supportCfc: false,
33
33
  enableAffectiveDialog: false,
34
34
  streamingMode: "none" /* NONE */,
35
- maxLlmCalls: validateMaxLlmCalls(params.maxLlmCalls || 500)
35
+ maxLlmCalls: validateMaxLlmCalls(params.maxLlmCalls || 500),
36
+ pauseOnToolCalls: false
36
37
  }, params);
37
38
  }
38
39
  function validateMaxLlmCalls(value) {