@google/adk 2.2.0 → 2.3.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 (241) hide show
  1. package/dist/cjs/a2a/a2a_remote_agent.js +4 -1
  2. package/dist/cjs/a2a/agent_card.js +102 -26
  3. package/dist/cjs/a2a/agent_to_a2a.js +1 -1
  4. package/dist/cjs/a2a/event_converter_utils.js +5 -1
  5. package/dist/cjs/a2a/metadata_converter_utils.js +2 -1
  6. package/dist/cjs/agents/functions.js +199 -25
  7. package/dist/cjs/agents/instructions.js +4 -1
  8. package/dist/cjs/agents/invocation_context.js +26 -4
  9. package/dist/cjs/agents/langgraph_agent.js +152 -0
  10. package/dist/cjs/agents/llm_agent.js +175 -101
  11. package/dist/cjs/agents/processors/code_execution_request_processor.js +10 -6
  12. package/dist/cjs/agents/remote_agent.js +187 -0
  13. package/dist/cjs/artifacts/in_memory_artifact_service.js +14 -0
  14. package/dist/cjs/auth/auth_handler.js +37 -5
  15. package/dist/cjs/auth/auth_schemes.js +9 -0
  16. package/dist/cjs/cli/cli_eval.js +532 -0
  17. package/dist/cjs/cli/utils/envs.js +116 -0
  18. package/dist/cjs/cli/utils/evals.js +137 -0
  19. package/dist/cjs/cli/utils/logs.js +150 -0
  20. package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +7 -2
  21. package/dist/cjs/code_executors/code_execution_utils.js +48 -16
  22. package/dist/cjs/code_executors/code_executor_context.js +6 -2
  23. package/dist/cjs/common.js +90 -0
  24. package/dist/cjs/context/summarizers/llm_summarizer.js +12 -10
  25. package/dist/cjs/context/token_based_context_compactor.js +2 -1
  26. package/dist/cjs/events/abort_events.js +135 -0
  27. package/dist/cjs/events/event.js +4 -2
  28. package/dist/cjs/events/internal_metadata.js +131 -0
  29. package/dist/cjs/examples/example_util.js +23 -2
  30. package/dist/cjs/flows/llm_flows/audio_transcriber.js +170 -0
  31. package/dist/cjs/index.js +97 -1
  32. package/dist/cjs/integrations/agent_registry/helpers.js +1 -1
  33. package/dist/cjs/models/gemini_llm_connection.js +16 -8
  34. package/dist/cjs/models/google_llm.js +13 -16
  35. package/dist/cjs/models/llm_response.js +9 -1
  36. package/dist/cjs/models/registry.js +1 -1
  37. package/dist/cjs/models/routed_llm.js +9 -8
  38. package/dist/cjs/planners/plan_re_act_planner.js +1 -1
  39. package/dist/cjs/plugins/debug_logging_plugin.js +653 -0
  40. package/dist/cjs/plugins/plugin_manager.js +1 -1
  41. package/dist/cjs/plugins/tool_call_integrity_plugin.js +364 -0
  42. package/dist/cjs/runner/in_memory_runner.js +6 -11
  43. package/dist/cjs/runner/runner.js +121 -35
  44. package/dist/cjs/sessions/db/operations.js +1 -1
  45. package/dist/cjs/sessions/in_memory_session_service.js +3 -1
  46. package/dist/cjs/sessions/state.js +8 -4
  47. package/dist/cjs/sessions/vertex_ai_session_service.js +34 -15
  48. package/dist/cjs/telemetry/tracing.js +97 -66
  49. package/dist/cjs/tools/agent_tool.js +44 -0
  50. package/dist/cjs/tools/apihub_tool/apihub_toolset.js +142 -0
  51. package/dist/cjs/tools/apihub_tool/clients/apihub_client.js +272 -0
  52. package/dist/cjs/tools/apihub_tool/clients/secret_client.js +148 -0
  53. package/dist/cjs/tools/apihub_tool/clients/service_account.js +48 -0
  54. package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +185 -0
  55. package/dist/cjs/tools/application_integration_tool/clients/cloud_request.js +133 -0
  56. package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +603 -0
  57. package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +219 -0
  58. package/dist/cjs/tools/crewai_tool.js +132 -0
  59. package/dist/cjs/tools/example_tool.js +10 -0
  60. package/dist/cjs/tools/function_tool.js +319 -0
  61. package/dist/cjs/tools/google_api_tool/google_api_tool.js +97 -0
  62. package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +226 -0
  63. package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +58 -0
  64. package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +440 -0
  65. package/dist/cjs/tools/google_api_tool/index.js +64 -0
  66. package/dist/cjs/tools/langchain_tool.js +172 -0
  67. package/dist/cjs/tools/mcp/index.js +12 -0
  68. package/dist/cjs/tools/mcp/mcp_session_manager.js +25 -0
  69. package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +1 -2
  70. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +46 -2
  71. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
  72. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
  73. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +14 -2
  74. package/dist/cjs/tools/retrieval/base_retrieval_tool.js +18 -3
  75. package/dist/cjs/tools/toolbox_tool.js +108 -0
  76. package/dist/cjs/utils/env_aware_utils.js +6 -8
  77. package/dist/cjs/utils/error_utils.js +11 -11
  78. package/dist/cjs/utils/file_extension_utils.js +11 -0
  79. package/dist/cjs/utils/file_utils.js +2 -24
  80. package/dist/cjs/utils/gemini_schema_util.js +4 -1
  81. package/dist/cjs/utils/json_utils.js +49 -0
  82. package/dist/cjs/utils/live_connection_utils.js +4 -5
  83. package/dist/cjs/utils/logger_node.js +7 -1
  84. package/dist/cjs/utils/object_notation_utils.js +6 -3
  85. package/dist/cjs/utils/streaming_utils.js +12 -12
  86. package/dist/cjs/version.js +1 -1
  87. package/dist/esm/a2a/a2a_remote_agent.js +4 -1
  88. package/dist/esm/a2a/agent_card.js +103 -27
  89. package/dist/esm/a2a/agent_to_a2a.js +5 -2
  90. package/dist/esm/a2a/event_converter_utils.js +5 -1
  91. package/dist/esm/a2a/metadata_converter_utils.js +2 -1
  92. package/dist/esm/agents/functions.js +198 -25
  93. package/dist/esm/agents/instructions.js +4 -1
  94. package/dist/esm/agents/invocation_context.js +24 -4
  95. package/dist/esm/agents/langgraph_agent.js +123 -0
  96. package/dist/esm/agents/llm_agent.js +185 -104
  97. package/dist/esm/agents/processors/code_execution_request_processor.js +13 -8
  98. package/dist/esm/agents/remote_agent.js +164 -0
  99. package/dist/esm/artifacts/in_memory_artifact_service.js +14 -0
  100. package/dist/esm/auth/auth_handler.js +37 -5
  101. package/dist/esm/auth/auth_schemes.js +8 -0
  102. package/dist/esm/cli/cli_eval.js +510 -0
  103. package/dist/esm/cli/utils/envs.js +78 -0
  104. package/dist/esm/cli/utils/evals.js +109 -0
  105. package/dist/esm/cli/utils/logs.js +111 -0
  106. package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +7 -2
  107. package/dist/esm/code_executors/code_execution_utils.js +46 -16
  108. package/dist/esm/code_executors/code_executor_context.js +5 -2
  109. package/dist/esm/common.js +87 -3
  110. package/dist/esm/context/summarizers/llm_summarizer.js +12 -10
  111. package/dist/esm/context/token_based_context_compactor.js +2 -1
  112. package/dist/esm/events/abort_events.js +110 -0
  113. package/dist/esm/events/event.js +4 -2
  114. package/dist/esm/events/internal_metadata.js +97 -0
  115. package/dist/esm/examples/example_util.js +21 -1
  116. package/dist/esm/flows/llm_flows/audio_transcriber.js +142 -0
  117. package/dist/esm/index.js +99 -1
  118. package/dist/esm/integrations/agent_registry/helpers.js +1 -1
  119. package/dist/esm/models/gemini_llm_connection.js +16 -8
  120. package/dist/esm/models/google_llm.js +14 -17
  121. package/dist/esm/models/llm_response.js +9 -1
  122. package/dist/esm/models/registry.js +1 -1
  123. package/dist/esm/models/routed_llm.js +9 -8
  124. package/dist/esm/planners/plan_re_act_planner.js +1 -1
  125. package/dist/esm/plugins/debug_logging_plugin.js +615 -0
  126. package/dist/esm/plugins/plugin_manager.js +1 -1
  127. package/dist/esm/plugins/tool_call_integrity_plugin.js +339 -0
  128. package/dist/esm/runner/in_memory_runner.js +6 -11
  129. package/dist/esm/runner/runner.js +124 -35
  130. package/dist/esm/sessions/db/operations.js +1 -1
  131. package/dist/esm/sessions/in_memory_session_service.js +3 -1
  132. package/dist/esm/sessions/state.js +8 -4
  133. package/dist/esm/sessions/vertex_ai_session_service.js +34 -15
  134. package/dist/esm/telemetry/tracing.js +97 -66
  135. package/dist/esm/tools/agent_tool.js +44 -0
  136. package/dist/esm/tools/apihub_tool/apihub_toolset.js +106 -0
  137. package/dist/esm/tools/apihub_tool/clients/apihub_client.js +244 -0
  138. package/dist/esm/tools/apihub_tool/clients/secret_client.js +132 -0
  139. package/dist/esm/tools/apihub_tool/clients/service_account.js +21 -0
  140. package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +163 -0
  141. package/dist/esm/tools/application_integration_tool/clients/cloud_request.js +103 -0
  142. package/dist/esm/tools/application_integration_tool/clients/connections_client.js +561 -0
  143. package/dist/esm/tools/application_integration_tool/clients/integration_client.js +215 -0
  144. package/dist/esm/tools/crewai_tool.js +107 -0
  145. package/dist/esm/tools/example_tool.js +13 -1
  146. package/dist/esm/tools/function_tool.js +316 -0
  147. package/dist/esm/tools/google_api_tool/google_api_tool.js +70 -0
  148. package/dist/esm/tools/google_api_tool/google_api_tool_set.js +188 -0
  149. package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +24 -0
  150. package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +393 -0
  151. package/dist/esm/tools/google_api_tool/index.js +33 -0
  152. package/dist/esm/tools/langchain_tool.js +148 -0
  153. package/dist/esm/tools/mcp/index.js +6 -0
  154. package/dist/esm/tools/mcp/mcp_session_manager.js +25 -0
  155. package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +1 -2
  156. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +50 -3
  157. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
  158. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
  159. package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +15 -2
  160. package/dist/esm/tools/retrieval/base_retrieval_tool.js +16 -2
  161. package/dist/esm/tools/toolbox_tool.js +80 -0
  162. package/dist/esm/utils/env_aware_utils.js +6 -8
  163. package/dist/esm/utils/error_utils.js +9 -10
  164. package/dist/esm/utils/file_extension_utils.js +11 -0
  165. package/dist/esm/utils/file_utils.js +2 -23
  166. package/dist/esm/utils/gemini_schema_util.js +4 -1
  167. package/dist/esm/utils/json_utils.js +21 -0
  168. package/dist/esm/utils/live_connection_utils.js +4 -5
  169. package/dist/esm/utils/logger_node.js +7 -1
  170. package/dist/esm/utils/object_notation_utils.js +4 -2
  171. package/dist/esm/utils/streaming_utils.js +11 -11
  172. package/dist/esm/version.js +1 -1
  173. package/dist/types/a2a/a2a_remote_agent.d.ts +9 -0
  174. package/dist/types/a2a/agent_card.d.ts +44 -1
  175. package/dist/types/a2a/agent_to_a2a.d.ts +9 -0
  176. package/dist/types/a2a/index.d.ts +1 -0
  177. package/dist/types/agents/functions.d.ts +33 -1
  178. package/dist/types/agents/invocation_context.d.ts +20 -1
  179. package/dist/types/agents/langgraph_agent.d.ts +153 -0
  180. package/dist/types/agents/remote_agent.d.ts +68 -0
  181. package/dist/types/auth/auth_handler.d.ts +28 -1
  182. package/dist/types/auth/auth_schemes.d.ts +13 -0
  183. package/dist/types/cli/cli_eval.d.ts +173 -0
  184. package/dist/types/cli/utils/envs.d.ts +23 -0
  185. package/dist/types/cli/utils/evals.d.ts +47 -0
  186. package/dist/types/cli/utils/logs.d.ts +38 -0
  187. package/dist/types/code_executors/code_execution_utils.d.ts +39 -0
  188. package/dist/types/code_executors/code_executor_context.d.ts +1 -0
  189. package/dist/types/common.d.ts +30 -4
  190. package/dist/types/events/abort_events.d.ts +43 -0
  191. package/dist/types/events/event.d.ts +4 -0
  192. package/dist/types/events/internal_metadata.d.ts +78 -0
  193. package/dist/types/examples/example_util.d.ts +17 -0
  194. package/dist/types/flows/llm_flows/audio_transcriber.d.ts +85 -0
  195. package/dist/types/index.d.ts +16 -1
  196. package/dist/types/models/gemini_llm_connection.d.ts +6 -7
  197. package/dist/types/models/routed_llm.d.ts +1 -1
  198. package/dist/types/plugins/debug_logging_plugin.d.ts +157 -0
  199. package/dist/types/plugins/tool_call_integrity_plugin.d.ts +116 -0
  200. package/dist/types/runner/in_memory_runner.d.ts +2 -1
  201. package/dist/types/runner/runner.d.ts +34 -0
  202. package/dist/types/sessions/state.d.ts +5 -1
  203. package/dist/types/sessions/vertex_ai_session_service.d.ts +8 -0
  204. package/dist/types/skills/skill.d.ts +1 -1
  205. package/dist/types/telemetry/tracing.d.ts +4 -2
  206. package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +122 -0
  207. package/dist/types/tools/apihub_tool/clients/apihub_client.d.ts +142 -0
  208. package/dist/types/tools/apihub_tool/clients/secret_client.d.ts +55 -0
  209. package/dist/types/tools/apihub_tool/clients/service_account.d.ts +11 -0
  210. package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +86 -0
  211. package/dist/types/tools/application_integration_tool/clients/cloud_request.d.ts +53 -0
  212. package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +215 -0
  213. package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +72 -0
  214. package/dist/types/tools/crewai_tool.d.ts +85 -0
  215. package/dist/types/tools/example_tool.d.ts +10 -0
  216. package/dist/types/tools/function_tool.d.ts +32 -0
  217. package/dist/types/tools/google_api_tool/google_api_tool.d.ts +30 -0
  218. package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +78 -0
  219. package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +33 -0
  220. package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +164 -0
  221. package/dist/types/tools/google_api_tool/index.d.ts +11 -0
  222. package/dist/types/tools/langchain_tool.d.ts +103 -0
  223. package/dist/types/tools/mcp/index.d.ts +3 -0
  224. package/dist/types/tools/mcp/mcp_session_manager.d.ts +34 -1
  225. package/dist/types/tools/mcp/mcp_toolset.d.ts +15 -0
  226. package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +19 -0
  227. package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +18 -1
  228. package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +2 -1
  229. package/dist/types/tools/retrieval/base_retrieval_tool.d.ts +15 -0
  230. package/dist/types/tools/toolbox_tool.d.ts +73 -0
  231. package/dist/types/utils/env_aware_utils.d.ts +18 -2
  232. package/dist/types/utils/error_utils.d.ts +7 -0
  233. package/dist/types/utils/file_utils.d.ts +6 -1
  234. package/dist/types/utils/gemini_schema_util.d.ts +1 -2
  235. package/dist/types/utils/json_utils.d.ts +11 -0
  236. package/dist/types/utils/object_notation_utils.d.ts +7 -0
  237. package/dist/types/utils/streaming_utils.d.ts +11 -4
  238. package/dist/types/version.d.ts +1 -1
  239. package/dist/web/index_web.js +105 -106
  240. package/dist/web/index_web.js.map +4 -4
  241. package/package.json +8 -3
@@ -0,0 +1,173 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { BaseAgent } from '../agents/base_agent.js';
7
+ import { BaseArtifactService } from '../artifacts/base_artifact_service.js';
8
+ import { BaseSessionService } from '../sessions/base_session_service.js';
9
+ import { EvaluationItem } from './utils/evals.js';
10
+ /**
11
+ * Error message when evaluation dependencies are missing.
12
+ */
13
+ export declare const MISSING_EVAL_DEPENDENCIES_MESSAGE = "Eval module is not installed, please install via `pip install google-adk[eval]`.";
14
+ /**
15
+ * Metric key for average tool trajectory score.
16
+ */
17
+ export declare const TOOL_TRAJECTORY_SCORE_KEY = "tool_trajectory_avg_score";
18
+ /**
19
+ * Metric key for response match (ROUGE-1) score.
20
+ */
21
+ export declare const RESPONSE_MATCH_SCORE_KEY = "response_match_score";
22
+ /**
23
+ * Metric key for LLM-based response evaluation score.
24
+ */
25
+ export declare const RESPONSE_EVALUATION_SCORE_KEY = "response_evaluation_score";
26
+ /**
27
+ * Prefix applied to session IDs generated during evaluation runs.
28
+ */
29
+ export declare const EVAL_SESSION_ID_PREFIX = "___eval___session___";
30
+ /**
31
+ * Default evaluation criteria thresholds when no config file is supplied.
32
+ */
33
+ export declare const DEFAULT_CRITERIA: Record<string, number>;
34
+ /**
35
+ * Outcome status of an evaluation metric or case.
36
+ */
37
+ export declare enum EvalStatus {
38
+ PASSED = 1,
39
+ FAILED = 2,
40
+ NOT_EVALUATED = 3
41
+ }
42
+ /**
43
+ * An evaluation metric definition and its pass threshold.
44
+ */
45
+ export interface EvalMetric {
46
+ metric_name: string;
47
+ threshold: number;
48
+ }
49
+ /**
50
+ * Result of evaluating a single metric.
51
+ */
52
+ export interface EvalMetricResult extends EvalMetric {
53
+ score?: number;
54
+ eval_status: EvalStatus;
55
+ }
56
+ /**
57
+ * Per-invocation evaluation metric breakdown.
58
+ */
59
+ export interface InvocationEvalMetricResult {
60
+ actual_invocation: EvaluationItem;
61
+ expected_invocation: EvaluationItem;
62
+ eval_metric_results: EvalMetricResult[];
63
+ }
64
+ /**
65
+ * Complete evaluation result for a single eval case in an evalset.
66
+ */
67
+ export interface EvalResult {
68
+ eval_set_file: string;
69
+ eval_id: string;
70
+ final_eval_status: EvalStatus;
71
+ eval_metric_results: Array<[EvalMetric, EvalMetricResult]>;
72
+ overall_eval_metric_results: EvalMetricResult[];
73
+ eval_metric_result_per_invocation: InvocationEvalMetricResult[];
74
+ session_id: string;
75
+ user_id?: string;
76
+ }
77
+ /**
78
+ * Request payload for adding a session to an eval set (`add_session`).
79
+ */
80
+ export interface AddSessionToEvalSetRequest {
81
+ evalId: string;
82
+ sessionId: string;
83
+ userId: string;
84
+ }
85
+ /**
86
+ * Request payload for running evaluations on an eval set (`run_eval`).
87
+ */
88
+ export interface RunEvalRequest {
89
+ evalIds: string[];
90
+ evalMetrics: EvalMetric[];
91
+ }
92
+ /**
93
+ * Result returned for a single evaluation case by the `run_eval` endpoint.
94
+ */
95
+ export interface RunEvalResult extends EvalResult {
96
+ evalSetFile: string;
97
+ evalSetId: string;
98
+ evalId: string;
99
+ finalEvalStatus: EvalStatus;
100
+ evalMetricResults: Array<[EvalMetric, EvalMetricResult]>;
101
+ overallEvalMetricResults: EvalMetricResult[];
102
+ evalMetricResultPerInvocation: InvocationEvalMetricResult[];
103
+ userId?: string;
104
+ sessionId: string;
105
+ }
106
+ /**
107
+ * Initial session metadata for an evaluation case.
108
+ */
109
+ export interface EvalInitialSession {
110
+ state?: Record<string, unknown>;
111
+ app_name?: string;
112
+ user_id?: string;
113
+ }
114
+ /**
115
+ * A named evaluation case within an evalset file.
116
+ */
117
+ export interface EvalEntry {
118
+ name: string;
119
+ data: EvaluationItem[];
120
+ initial_session?: EvalInitialSession;
121
+ }
122
+ /**
123
+ * Alias for a single evaluation case entry in an evalset.
124
+ */
125
+ export type EvalSetItem = EvalEntry;
126
+ /**
127
+ * Options for running evaluations via `runEvals`.
128
+ */
129
+ export interface RunEvalsOptions {
130
+ evalCasesByEvalSetId: Record<string, EvalEntry[] | string[]>;
131
+ rootAgent: BaseAgent;
132
+ resetFunc?: () => void | Promise<void>;
133
+ evalMetrics?: EvalMetric[];
134
+ printDetailedResults?: boolean;
135
+ sessionService?: BaseSessionService;
136
+ artifactService?: BaseArtifactService;
137
+ }
138
+ /**
139
+ * Loads evaluation criteria from a JSON config file, or returns `DEFAULT_CRITERIA`
140
+ * if no path is supplied.
141
+ *
142
+ * @param evalConfigFilePath Optional path to a `test_config.json` file.
143
+ * @returns Map of metric names to numeric thresholds.
144
+ */
145
+ export declare function getEvaluationCriteriaOrDefault(evalConfigFilePath?: string): Record<string, number>;
146
+ /**
147
+ * Dynamically imports an agent module and returns its `rootAgent`.
148
+ *
149
+ * @param agentModuleFilePath File or directory path to the agent module.
150
+ * @returns The loaded `BaseAgent` instance.
151
+ */
152
+ export declare function getRootAgent(agentModuleFilePath: string): Promise<BaseAgent>;
153
+ /**
154
+ * Attempts to retrieve an optional `reset_data` or `resetData` function from
155
+ * the agent module.
156
+ *
157
+ * @param agentModuleFilePath File or directory path to the agent module.
158
+ * @returns The reset function if exported, or `undefined`.
159
+ */
160
+ export declare function tryGetResetFunc(agentModuleFilePath: string): Promise<(() => void | Promise<void>) | undefined>;
161
+ /**
162
+ * Parses CLI evalset file arguments of the form `file_path` or
163
+ * `file_path:eval_1,eval_2` into a mapping from file path to requested eval IDs.
164
+ *
165
+ * @param evalSetFilePaths Array of evalset file specifications.
166
+ * @returns Mapping of evalset file path to list of eval case names.
167
+ */
168
+ export declare function parseAndGetEvalsToRun(evalSetFilePaths: string[]): Record<string, string[]>;
169
+ /**
170
+ * Runs a collection of evaluation cases against `rootAgent` and yields an
171
+ * `EvalResult` for each case.
172
+ */
173
+ export declare function runEvals(optionsOrMap: RunEvalsOptions | Record<string, EvalEntry[] | string[]>, rootAgentArg?: BaseAgent, resetFuncArg?: () => void | Promise<void>, evalMetricsArg?: EvalMetric[], printDetailedResultsArg?: boolean, sessionServiceArg?: BaseSessionService, artifactServiceArg?: BaseArtifactService): AsyncGenerator<EvalResult, void, void>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Walks up the directory tree starting from `folder` until `filename` is found,
8
+ * or until the filesystem root is reached.
9
+ *
10
+ * @param folder The directory to start searching from.
11
+ * @param filename The file name to look for. Defaults to `'.env'`.
12
+ * @returns The absolute path to the found file, or `''` if not found.
13
+ */
14
+ export declare function walkToRootUntilFound(folder: string, filename?: string): string;
15
+ /**
16
+ * Walks up from the agent directory to the root directory and loads the first
17
+ * `.env` file found into `process.env` with override semantics.
18
+ *
19
+ * @param agentName The name or path of the agent.
20
+ * @param agentParentFolder The parent directory containing the agent. Defaults to `'.'`.
21
+ * @param filename The dotenv filename to search for. Defaults to `'.env'`.
22
+ */
23
+ export declare function loadDotenvForAgent(agentName: string, agentParentFolder?: string, filename?: string): void;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Part } from '@google/genai';
7
+ import { BaseAgent } from '../../agents/base_agent.js';
8
+ import { Session } from '../../sessions/session.js';
9
+ /**
10
+ * Represents a single expected tool invocation in an evaluation item.
11
+ */
12
+ export interface ToolUseItem {
13
+ tool_name: string;
14
+ tool_input: Record<string, unknown>;
15
+ mock_tool_output?: unknown;
16
+ }
17
+ /**
18
+ * Represents an intermediate agent response tuple of `[author, parts]`.
19
+ */
20
+ export type IntermediateAgentResponseItem = [string, Part[]];
21
+ /**
22
+ * Represents a single turn in an evaluation dataset converted from a session.
23
+ */
24
+ export interface EvaluationItem {
25
+ query: string;
26
+ expected_tool_use: ToolUseItem[];
27
+ expected_intermediate_agent_responses: IntermediateAgentResponseItem[];
28
+ reference: string;
29
+ }
30
+ /**
31
+ * Converts a session into a list of evaluation items suitable for saving into
32
+ * an evalset or running through `runEvals`.
33
+ *
34
+ * @param session The session whose events should be converted.
35
+ * @returns An array of `EvaluationItem` records, one per user turn.
36
+ */
37
+ export declare function convertSessionToEvalFormat(session?: Session): EvaluationItem[];
38
+ /**
39
+ * Creates a state object initialized with empty strings `''` for all `{var}`
40
+ * placeholders referenced in the instruction strings of `agent` and its
41
+ * sub-agents, overridden by any keys provided in `initializedStates`.
42
+ *
43
+ * @param agent The root agent to inspect.
44
+ * @param initializedStates Optional pre-initialized state values that take precedence.
45
+ * @returns The combined state record.
46
+ */
47
+ export declare function createEmptyState(agent: BaseAgent, initializedStates?: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { LogLevel } from '../../utils/logger.js';
7
+ /**
8
+ * Standard log format template for CLI log output.
9
+ */
10
+ export declare const LOGGING_FORMAT = "%(asctime)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s";
11
+ /**
12
+ * Options for configuring `logToTmpFolder`.
13
+ */
14
+ export interface LogToTmpFolderOptions {
15
+ /** Minimum log level to record. Defaults to `LogLevel.INFO`. */
16
+ level?: LogLevel;
17
+ /** Subdirectory inside the system temp folder. Defaults to `'agents_log'`. */
18
+ subFolder?: string;
19
+ /** Prefix for generated log files. Defaults to `'agent'`. */
20
+ logFilePrefix?: string;
21
+ /** Timestamp suffix for the log filename. Defaults to `YYYYMMDD_HHMMSS`. */
22
+ logFileTimestamp?: string;
23
+ }
24
+ /**
25
+ * Configures the global ADK logger to write formatted log records to `stderr`.
26
+ *
27
+ * @param level The minimum `LogLevel` to emit. Defaults to `LogLevel.INFO`.
28
+ */
29
+ export declare function logToStderr(level?: LogLevel): void;
30
+ /**
31
+ * Configures the global ADK logger to write formatted log records to a timestamped
32
+ * file in the system temporary directory and updates the `<prefix>.latest.log`
33
+ * symlink to point to the newest file.
34
+ *
35
+ * @param options Configuration options for the temporary log file.
36
+ * @returns The absolute path to the created log file.
37
+ */
38
+ export declare function logToTmpFolder(options?: LogToTmpFolderOptions): string;
@@ -90,6 +90,29 @@ export interface CodeExecutionResult {
90
90
  * @return The file content as a base64-encoded bytes.
91
91
  */
92
92
  export declare function getEncodedFileContent(data: string): string;
93
+ /**
94
+ * Gets the language of the code in a block from the block's leading delimiter.
95
+ *
96
+ * @param leadingDelimiter The leading delimiter of a code block, for example
97
+ * '```javascript\n'.
98
+ * @return The language that the fence tag names, or
99
+ * `CodeExecutionLanguage.UNSPECIFIED` for a tag that is not known. The
100
+ * executor decides what to do with an unspecified language.
101
+ */
102
+ export declare function getCodeBlockLanguage(leadingDelimiter: string): CodeExecutionLanguage;
103
+ /**
104
+ * A code block extracted from a model response.
105
+ */
106
+ export interface ExtractedCodeBlock {
107
+ /**
108
+ * The code in the block, or an empty string if there is no block.
109
+ */
110
+ code: string;
111
+ /**
112
+ * The language of the code, from the fence that matched it.
113
+ */
114
+ language: CodeExecutionLanguage;
115
+ }
93
116
  /**
94
117
  * Extracts the first code block from the content and truncate everything after
95
118
  * it.
@@ -100,6 +123,22 @@ export declare function getEncodedFileContent(data: string): string;
100
123
  * @return The first code block if found, otherwise an empty string.
101
124
  */
102
125
  export declare function extractCodeAndTruncateContent(content: Content, codeBlockDelimiters: Array<[string, string]>): string;
126
+ /**
127
+ * Extracts the first code block and its language from the content, and
128
+ * truncates everything after it.
129
+ *
130
+ * An `executableCode` part holds Python. A code block in text has the
131
+ * language of the fence tag in its leading delimiter: see
132
+ * {@link getCodeBlockLanguage}.
133
+ *
134
+ * @param content The mutable content to extract the code from.
135
+ * @param codeBlockDelimiters The list of the enclosing delimiters to identify
136
+ * the code blocks.
137
+ * @return The first code block and its language. With no code block, the
138
+ * code is an empty string and the language is
139
+ * `CodeExecutionLanguage.UNSPECIFIED`.
140
+ */
141
+ export declare function extractCodeBlockAndTruncateContent(content: Content, codeBlockDelimiters: Array<[string, string]>): ExtractedCodeBlock;
103
142
  /**
104
143
  * Builds an executable code part with code string.
105
144
  *
@@ -1,5 +1,6 @@
1
1
  import { State } from '../sessions/state.js';
2
2
  import { File } from './code_execution_utils.js';
3
+ export declare const CONTEXT_KEY = "_code_execution_context";
3
4
  /**
4
5
  * The parameters for updating the code execution result.
5
6
  * */
@@ -8,9 +8,11 @@ export type { ActiveStreamingToolParams } from './agents/active_streaming_tool.j
8
8
  export { BaseAgent, isBaseAgent } from './agents/base_agent.js';
9
9
  export type { AfterAgentCallback, BaseAgentConfig, BeforeAgentCallback, SingleAgentCallback, } from './agents/base_agent.js';
10
10
  export { Context } from './agents/context.js';
11
- export { REQUEST_CONFIRMATION_FUNCTION_CALL_NAME, REQUEST_CREDENTIAL_FUNCTION_CALL_NAME, REQUEST_INPUT_FUNCTION_CALL_NAME, findEventByFunctionCallId, findMatchingFunctionCall, functionsExportedForTestingOnly, isToolNotFound, } from './agents/functions.js';
12
- export { InvocationContext, requireAgent } from './agents/invocation_context.js';
11
+ export { REQUEST_CONFIRMATION_FUNCTION_CALL_NAME, REQUEST_CREDENTIAL_FUNCTION_CALL_NAME, REQUEST_INPUT_FUNCTION_CALL_NAME, findEventByFunctionCallId, findMatchingFunctionCall, functionsExportedForTestingOnly, handleFunctionCallsLive, isToolNotFound, } from './agents/functions.js';
12
+ export { InvocationContext, LlmCallsLimitExceededError, isLlmCallsLimitExceededError, requireAgent, } from './agents/invocation_context.js';
13
13
  export type { InvocationContextParams, WorkflowInstructionScope, } from './agents/invocation_context.js';
14
+ export { LangGraphAgent, getLastHumanMessages, isLangGraphAgent, } from './agents/langgraph_agent.js';
15
+ export type { CompiledGraphLike, LangGraphAIMessage, LangGraphAgentConfig, LangGraphContentPart, LangGraphHumanMessage, LangGraphInvokeInput, LangGraphInvokeOutput, LangGraphMessageContent, LangGraphMessageLike, LangGraphRunnableConfig, LangGraphStateSnapshot, LangGraphSystemMessage, } from './agents/langgraph_agent.js';
14
16
  export { LiveRequestQueue } from './agents/live_request_queue.js';
15
17
  export type { LiveRequest } from './agents/live_request_queue.js';
16
18
  export { LlmAgent as Agent, LlmAgent, isLlmAgent } from './agents/llm_agent.js';
@@ -20,13 +22,16 @@ export type { LoopAgentConfig } from './agents/loop_agent.js';
20
22
  export { ParallelAgent, isParallelAgent } from './agents/parallel_agent.js';
21
23
  export { AgentTransferLlmRequestProcessor } from './agents/processors/agent_transfer_llm_request_processor.js';
22
24
  export { BaseLlmRequestProcessor, BaseLlmResponseProcessor, } from './agents/processors/base_llm_processor.js';
25
+ export { CodeExecutionResponseProcessor } from './agents/processors/code_execution_request_processor.js';
23
26
  export { CONTENT_REQUEST_PROCESSOR, ContentRequestProcessor, } from './agents/processors/content_request_processor.js';
24
27
  export { ContextCompactorRequestProcessor } from './agents/processors/context_compactor_request_processor.js';
25
28
  export { INTERACTIONS_REQUEST_PROCESSOR, InteractionsRequestProcessor, } from './agents/processors/interactions_request_processor.js';
26
29
  export { ReadonlyContext } from './agents/readonly_context.js';
30
+ export { RemoteAgent, isRemoteAgent } from './agents/remote_agent.js';
31
+ export type { RemoteAgentConfig, RemoteAgentFetch, } from './agents/remote_agent.js';
27
32
  export { RoutedAgent, isRoutedAgent } from './agents/routed_agent.js';
28
33
  export type { AgentRouter, RoutedAgentConfig } from './agents/routed_agent.js';
29
- export { StreamingMode } from './agents/run_config.js';
34
+ export { StreamingMode, createRunConfig } from './agents/run_config.js';
30
35
  export type { RunConfig } from './agents/run_config.js';
31
36
  export { SequentialAgent, isSequentialAgent } from './agents/sequential_agent.js';
32
37
  export type { TranscriptionEntry } from './agents/transcription_entry.js';
@@ -44,7 +49,7 @@ export type { AuthCredential, HttpAuth, HttpCredentials, OAuth2Auth, ServiceAcco
44
49
  export { AuthHandler } from './auth/auth_handler.js';
45
50
  export { AUTH_PREPROCESSOR, AuthPreprocessor } from './auth/auth_preprocessor.js';
46
51
  export { AuthProviderRegistry } from './auth/auth_provider_registry.js';
47
- export { OAuthGrantType } from './auth/auth_schemes.js';
52
+ export { AuthSchemeType, OAuthGrantType, getOAuthGrantTypeFromFlow, } from './auth/auth_schemes.js';
48
53
  export type { AuthScheme, OpenIdConnectWithConfig } from './auth/auth_schemes.js';
49
54
  export type { AuthConfig } from './auth/auth_tool.js';
50
55
  export type { BaseAuthProvider } from './auth/base_auth_provider.js';
@@ -87,6 +92,7 @@ export { createEvent, generateClientFunctionCallId, getFunctionCalls, getFunctio
87
92
  export type { CreateEventParams, Event, NodeInfo, Route, RouteKey, } from './events/event.js';
88
93
  export { createEventActions } from './events/event_actions.js';
89
94
  export type { EventActions } from './events/event_actions.js';
95
+ export { INTERNAL_METADATA_PREFIX, RESTORED_EVENT_KEY, markRestored, publicEvent, publicMetadata, publicSession, } from './events/internal_metadata.js';
90
96
  export { EventType, toStructuredEvents } from './events/structured_events.js';
91
97
  export type { ActivityEvent, CallCodeEvent, CodeResultEvent, ContentEvent, ErrorEvent, FinishedEvent, StructuredEvent, ThoughtEvent, ToolCallEvent, ToolConfirmationEvent, ToolResultEvent, } from './events/structured_events.js';
92
98
  export { BaseExampleProvider, isBaseExampleProvider, } from './examples/base_example_provider.js';
@@ -103,7 +109,9 @@ export { ChromeBuiltInLlm, ChromeModelUnavailableError, stripAdkIdentityPreamble
103
109
  export type { ChromeBuiltInDiagnostic, ChromeBuiltInLlmParams, ChromeCreateCoreOptions, ChromeCreateMonitor, ChromeCreateOptions, ChromeExpectedModality, ChromeLanguageModelFactory, ChromeLanguageModelSession, ChromeMessage, ChromeMessageContent, ChromeModelAvailability, ChromePromptOptions, } from './models/chrome_prompt_llm.js';
104
110
  export { Gemini, geminiInitParams } from './models/google_llm.js';
105
111
  export type { GeminiParams } from './models/google_llm.js';
112
+ export { appendInstructions } from './models/llm_request.js';
106
113
  export type { LlmRequest } from './models/llm_request.js';
114
+ export { createLlmResponse } from './models/llm_response.js';
107
115
  export type { LlmResponse } from './models/llm_response.js';
108
116
  export { LLMRegistry } from './models/registry.js';
109
117
  export type { BaseLlmType } from './models/registry.js';
@@ -114,6 +122,7 @@ export { BuiltInPlanner, isBuiltInPlanner } from './planners/built_in_planner.js
114
122
  export { PlanReActPlanner } from './planners/plan_re_act_planner.js';
115
123
  export { GLOBAL_SCOPE_KEY, REFLECT_AND_RETRY_RESPONSE_TYPE, ScopedFailureTracker, TrackingScope, resolveScopeKey, type PerItemFailuresCounter, type ToolFailureResponse, } from './plugins/_reflect_retry_utils.js';
116
124
  export { BasePlugin, ContextCompactionTrigger } from './plugins/base_plugin.js';
125
+ export type { DebugEntry, DebugLoggingPluginOptions, InvocationDebugState, } from './plugins/debug_logging_plugin.js';
117
126
  export { GlobalInstructionPlugin } from './plugins/global_instruction_plugin.js';
118
127
  export { LoggingPlugin } from './plugins/logging_plugin.js';
119
128
  export { PluginManager } from './plugins/plugin_manager.js';
@@ -121,6 +130,8 @@ export { ADK_HANDLE_MODEL_ERROR_TOOL_NAME, RESERVED_TOOL_CALL_ERROR_TYPE, Reflec
121
130
  export { ReflectAndRetryToolPlugin, type ReflectAndRetryToolPluginOptions, } from './plugins/reflect_retry_tool_plugin.js';
122
131
  export { InMemoryPolicyEngine, PolicyOutcome, SecurityPlugin, getAskUserConfirmationFunctionCalls, } from './plugins/security_plugin.js';
123
132
  export type { BasePolicyEngine, PolicyCheckResult, ToolCallPolicyContext, } from './plugins/security_plugin.js';
133
+ export { ToolCallIntegrityError, ToolCallIntegrityPlugin, } from './plugins/tool_call_integrity_plugin.js';
134
+ export type { ToolCallIntegrityPluginOptions } from './plugins/tool_call_integrity_plugin.js';
124
135
  export { InMemoryRunner } from './runner/in_memory_runner.js';
125
136
  export { Runner, determineAgentForResumption, findEventByLastFunctionResponseId, isRoutableLlmAgent, isRunner, } from './runner/runner.js';
126
137
  export type { RunnerConfig } from './runner/runner.js';
@@ -173,9 +184,13 @@ export type { WebMCPDocument, WebMCPExecuteToolOptions, WebMCPGetToolsOptions, W
173
184
  export { AsyncQueue } from './utils/async_queue.js';
174
185
  export { renameReservedKeywords, toSnakeCaseName } from './utils/case_utils.js';
175
186
  export { getClientLabels, runWithClientLabel } from './utils/client_labels.js';
187
+ export { toGeminiSchema } from './utils/gemini_schema_util.js';
188
+ export type { MCPToolSchema } from './utils/gemini_schema_util.js';
189
+ export { genaiSchemaToJsonSchema } from './utils/genai_schema_to_json.js';
176
190
  export { LogLevel, getLogger, logger, resetLogger, setLogLevel, setLogger, } from './utils/logger.js';
177
191
  export type { Logger } from './utils/logger.js';
178
192
  export { isGemini2OrAbove, isGemini35LiveTranslate, isGemini3xFlashLive, isGemini3xLive, } from './utils/model_name.js';
193
+ export { toJsonSchema } from './utils/schema.js';
179
194
  export type { SchemaLike } from './utils/schema.js';
180
195
  export { zodObjectToSchema } from './utils/simple_zod_to_json.js';
181
196
  export { Task } from './utils/task.js';
@@ -201,3 +216,14 @@ export * from './features/feature_registry.js';
201
216
  export * from './memory/base_memory_service.js';
202
217
  export * from './sessions/base_session_service.js';
203
218
  export * from './tools/base_tool.js';
219
+ export { convertSessionToEvalFormat, createEmptyState, } from './cli/utils/evals.js';
220
+ export type { EvaluationItem, IntermediateAgentResponseItem, ToolUseItem, } from './cli/utils/evals.js';
221
+ export { CrewaiTool, isCrewaiTool } from './tools/crewai_tool.js';
222
+ export type { CrewaiSchemaLike, CrewaiToolConfig, CrewaiToolLike, } from './tools/crewai_tool.js';
223
+ export { buildFunctionDeclarationForLangchain, buildFunctionDeclarationForParamsForCrewai, buildFunctionDeclarationUtil, } from './tools/function_tool.js';
224
+ export type { CallLiveToolRequest } from './tools/function_tool.js';
225
+ export { LangchainTool, isLangchainTool } from './tools/langchain_tool.js';
226
+ export type { LangchainSchemaLike, LangchainToolConfig, LangchainToolLike, } from './tools/langchain_tool.js';
227
+ export { isBaseRetrievalTool } from './tools/retrieval/base_retrieval_tool.js';
228
+ export { ToolboxTool, isToolboxTool } from './tools/toolbox_tool.js';
229
+ export type { ToolboxClientLike, ToolboxToolOptions, } from './tools/toolbox_tool.js';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event } from './event.js';
7
+ export declare const INVOCATION_ABORTED = "INVOCATION_ABORTED";
8
+ export declare const ABORT_MESSAGE = "Invocation was aborted by client.";
9
+ /**
10
+ * Returns whether `event` was synthesized to seal an aborted invocation.
11
+ */
12
+ export declare function isAbortEvent(event: Event): boolean;
13
+ /** Parameters for {@link buildAbortEvents}. */
14
+ export interface BuildAbortEventsParams {
15
+ /** The session history, in chronological order. */
16
+ events: Event[];
17
+ /** The aborted invocation; only its events are considered. */
18
+ invocationId: string;
19
+ /** Author of the abort event returned when nothing is dangling. */
20
+ rootAgentName: string;
21
+ /**
22
+ * Branch for calls whose event has no branch, and for the abort event
23
+ * returned when nothing is dangling.
24
+ */
25
+ branch?: string;
26
+ }
27
+ /**
28
+ * Returns the events that seal an aborted invocation.
29
+ *
30
+ * Each dangling function call gets a synthetic error response carrying the
31
+ * author, branch and isolation scope of the event that issued it, so the
32
+ * response pairs with its call in the issuing agent's own view. Calls sharing
33
+ * those three values are grouped into one event. If nothing is dangling, a
34
+ * single content-less abort event authored by the root agent is returned
35
+ * instead.
36
+ *
37
+ * Long-running calls (including confirmation and credential requests) are
38
+ * sealed too: the invocation that issued them is gone, so they are not left
39
+ * pending for a later turn.
40
+ *
41
+ * @returns The synthetic events, in the order they should be appended.
42
+ */
43
+ export declare function buildAbortEvents({ events, invocationId, rootAgentName, branch, }: BuildAbortEventsParams): Event[];
@@ -178,6 +178,10 @@ export declare function hasTrailingCodeExecutionResult(event: Event): boolean;
178
178
  export declare function stringifyContent(event: Event): string;
179
179
  /**
180
180
  * Estimates the number of tokens in the event based on usage metadata or characters.
181
+ *
182
+ * Prefers `initialPromptTokenCount`, because the promptTokenCount of a
183
+ * generation that @google/genai resumed after continuation pauses is summed
184
+ * over every resumed request, each of which resent the prompt.
181
185
  */
182
186
  export declare function getEventTokens(event: Event): number;
183
187
  /**
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * `Event.customMetadata` keys that only ADK code may write.
8
+ *
9
+ * Mirrors adk-python's `google.adk.events._internal_metadata`.
10
+ */
11
+ import type { Session } from '../sessions/session.js';
12
+ import type { Event } from './event.js';
13
+ type Metadata = Record<string, unknown>;
14
+ /**
15
+ * Prefix of `customMetadata` keys that callers cannot set.
16
+ *
17
+ * Keys with this prefix are dropped from the `customMetadata` passed to
18
+ * `Runner.runAsync`, and from events that are restored into a session or
19
+ * received from a remote A2A agent. Stored events keep them, but they are
20
+ * removed from API responses, saved session files and A2A messages.
21
+ *
22
+ * The value matches adk-python so a session store shared between the two
23
+ * treats the same keys as internal.
24
+ */
25
+ export declare const INTERNAL_METADATA_PREFIX = "__adk_internal_";
26
+ /** Set on events that ADK restored into a session from outside it. */
27
+ export declare const RESTORED_EVENT_KEY = "__adk_internal_restored_event";
28
+ /**
29
+ * Returns `metadata` without keys that have the internal prefix.
30
+ *
31
+ * Use it where callers supply metadata. Dropped keys are logged at debug level,
32
+ * because a caller set a key it cannot set.
33
+ *
34
+ * @param metadata A `customMetadata` value. It is not modified.
35
+ * @returns A new object without internal keys. A value that is not a plain
36
+ * object, such as `undefined`, is returned unchanged.
37
+ */
38
+ export declare function withoutInternalMetadata<T>(metadata: T): T;
39
+ /**
40
+ * Returns `metadata` as callers see it, without internal keys.
41
+ *
42
+ * Use it where events leave ADK. Removal there is routine, so nothing is
43
+ * logged.
44
+ *
45
+ * @param metadata A `customMetadata` value. It is not modified.
46
+ * @returns A new object without internal keys, or `undefined` if nothing is
47
+ * left. A value that is not a plain object is returned unchanged.
48
+ */
49
+ export declare function publicMetadata<T>(metadata: T): T | undefined;
50
+ /** Returns only the keys of `metadata` that have the internal prefix. */
51
+ export declare function internalMetadata(metadata: unknown): Metadata;
52
+ /**
53
+ * Marks an event restored from outside the session, in place.
54
+ *
55
+ * Internal metadata carried by the event is removed first, so a caller cannot
56
+ * supply its own.
57
+ *
58
+ * @param event The event about to be appended to a new session.
59
+ * @returns The same event.
60
+ */
61
+ export declare function markRestored<T extends Event>(event: T): T;
62
+ /**
63
+ * Returns the event as callers see it, without internal metadata.
64
+ *
65
+ * @param event A stored event. It is not modified.
66
+ * @returns The same event if it has no internal keys. Otherwise a copy whose
67
+ * `customMetadata` drops them, or is `undefined` if nothing else is left.
68
+ */
69
+ export declare function publicEvent<T extends Event>(event: T): T;
70
+ /**
71
+ * Returns the session as callers see it, without internal metadata.
72
+ *
73
+ * @param session A stored session. It is not modified.
74
+ * @returns The same session if no event changes. Otherwise a copy whose events
75
+ * are passed through {@link publicEvent}.
76
+ */
77
+ export declare function publicSession<T extends Session>(session: T): T;
78
+ export {};
@@ -6,6 +6,23 @@
6
6
  import { Session } from '../sessions/session.js';
7
7
  import { BaseExampleProvider } from './base_example_provider.js';
8
8
  import { Example } from './example.js';
9
+ /**
10
+ * Throws unless `examples` is a well-formed list of {@link Example}s.
11
+ *
12
+ * Mirrors `TypeAdapter(list[Example]).validate_python` in the adk-python
13
+ * `ExampleTool` constructor. {@link Example} is erased at compile time, so a
14
+ * value that reaches the SDK from untyped JavaScript or from a configuration
15
+ * file is otherwise unchecked, and a malformed entry only fails later while the
16
+ * few-shot instruction is rendered.
17
+ *
18
+ * The value is checked but not replaced, so it keeps reference identity and no
19
+ * defensive copy is made.
20
+ *
21
+ * @param examples - The value to check.
22
+ * @throws {InputValidationError} When the value is not a list of well-formed
23
+ * examples. The message names the path of each failing field.
24
+ */
25
+ export declare function validateExamples(examples: unknown): asserts examples is Example[];
9
26
  /**
10
27
  * Converts a list of examples to a string that can be used in a system
11
28
  * instruction.