@google/adk 1.1.0 → 1.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.
- package/dist/cjs/agents/base_agent.js +19 -1
- package/dist/cjs/agents/functions.js +4 -0
- package/dist/cjs/agents/instructions.js +81 -33
- package/dist/cjs/agents/invocation_context.js +0 -1
- package/dist/cjs/agents/llm_agent.js +52 -5
- package/dist/cjs/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/cjs/agents/processors/content_processor_utils.js +37 -24
- package/dist/cjs/agents/processors/content_request_processor.js +7 -0
- package/dist/cjs/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/cjs/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/cjs/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/cjs/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/cjs/auth/auth_preprocessor.js +12 -10
- package/dist/cjs/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +305 -0
- package/dist/cjs/code_executors/code_execution_utils.js +1 -1
- package/dist/cjs/code_executors/code_executor_context.js +7 -7
- package/dist/cjs/common.js +50 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +11 -0
- package/dist/cjs/context/token_based_context_compactor.js +1 -1
- package/dist/cjs/events/event.js +4 -2
- package/dist/cjs/index.js +14 -0
- package/dist/cjs/integrations/agent_registry/agent_registry.js +362 -0
- package/dist/cjs/integrations/agent_registry/agent_registry_mcp_toolset.js +122 -0
- package/dist/cjs/integrations/agent_registry/helpers.js +57 -0
- package/dist/cjs/integrations/agent_registry/types.js +50 -0
- package/dist/cjs/memory/vertex_ai_memory_bank_service.js +496 -0
- package/dist/cjs/models/gemini_llm_connection.js +62 -19
- package/dist/cjs/models/google_llm.js +26 -8
- package/dist/cjs/plugins/security_plugin.js +16 -0
- package/dist/cjs/runner/in_memory_runner.js +10 -5
- package/dist/cjs/runner/runner.js +32 -2
- package/dist/cjs/sessions/base_session_service.js +13 -2
- package/dist/cjs/sessions/database_session_service.js +51 -5
- package/dist/cjs/sessions/db/schema.js +45 -10
- package/dist/cjs/sessions/in_memory_session_service.js +72 -15
- package/dist/cjs/sessions/registry.js +4 -0
- package/dist/cjs/sessions/vertex_ai_session_service.js +429 -0
- package/dist/cjs/skills/gcp_skill_registry.js +104 -0
- package/dist/cjs/skills/loader.js +65 -0
- package/dist/cjs/skills/skill_registry.js +27 -0
- package/dist/cjs/tools/agent_tool.js +10 -5
- package/dist/cjs/tools/exit_loop_tool.js +9 -0
- package/dist/cjs/tools/function_tool.js +7 -2
- package/dist/cjs/tools/google_maps_grounding_tool.js +80 -0
- package/dist/cjs/tools/long_running_tool.js +2 -1
- package/dist/cjs/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/cjs/tools/mcp/mcp_tool.js +10 -6
- package/dist/cjs/tools/mcp/mcp_toolset.js +26 -3
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +78 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +84 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +133 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +232 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +224 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +127 -0
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +133 -0
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +256 -0
- package/dist/cjs/tools/skill/load_skill_resource_tool.js +27 -28
- package/dist/cjs/tools/skill/load_skill_tool.js +12 -1
- package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/cjs/tools/skill/search_skills_tool.js +108 -0
- package/dist/cjs/tools/skill/skill_toolset.js +40 -5
- package/dist/cjs/tools/vertex_rag_retrieval_tool.js +64 -0
- package/dist/cjs/utils/async_queue.js +88 -0
- package/dist/cjs/utils/case_utils.js +53 -0
- package/dist/cjs/utils/env_aware_utils.js +4 -0
- package/dist/cjs/utils/file_utils.js +28 -0
- package/dist/cjs/utils/gemini_schema_util.js +18 -0
- package/dist/cjs/utils/live_connection_utils.js +284 -0
- package/dist/cjs/utils/model_name.js +9 -0
- package/dist/cjs/utils/partial_copy.js +51 -0
- package/dist/cjs/utils/streaming_utils.js +169 -122
- package/dist/cjs/utils/vertex_ai_utils.js +50 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/base_agent.js +19 -1
- package/dist/esm/agents/functions.js +4 -0
- package/dist/esm/agents/instructions.js +81 -33
- package/dist/esm/agents/invocation_context.js +0 -1
- package/dist/esm/agents/llm_agent.js +53 -5
- package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/esm/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/esm/agents/processors/content_processor_utils.js +35 -23
- package/dist/esm/agents/processors/content_request_processor.js +7 -0
- package/dist/esm/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/esm/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/esm/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/esm/auth/auth_preprocessor.js +12 -10
- package/dist/esm/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +281 -0
- package/dist/esm/code_executors/code_execution_utils.js +1 -1
- package/dist/esm/code_executors/code_executor_context.js +7 -7
- package/dist/esm/common.js +43 -1
- package/dist/esm/context/summarizers/llm_summarizer.js +11 -0
- package/dist/esm/context/token_based_context_compactor.js +1 -1
- package/dist/esm/events/event.js +4 -2
- package/dist/esm/index.js +11 -0
- package/dist/esm/integrations/agent_registry/agent_registry.js +333 -0
- package/dist/esm/integrations/agent_registry/agent_registry_mcp_toolset.js +96 -0
- package/dist/esm/integrations/agent_registry/helpers.js +28 -0
- package/dist/esm/integrations/agent_registry/types.js +20 -0
- package/dist/esm/memory/vertex_ai_memory_bank_service.js +468 -0
- package/dist/esm/models/gemini_llm_connection.js +62 -19
- package/dist/esm/models/google_llm.js +26 -8
- package/dist/esm/plugins/security_plugin.js +16 -0
- package/dist/esm/runner/in_memory_runner.js +10 -5
- package/dist/esm/runner/runner.js +32 -2
- package/dist/esm/sessions/base_session_service.js +11 -1
- package/dist/esm/sessions/database_session_service.js +51 -5
- package/dist/esm/sessions/db/schema.js +44 -10
- package/dist/esm/sessions/in_memory_session_service.js +74 -16
- package/dist/esm/sessions/registry.js +7 -0
- package/dist/esm/sessions/vertex_ai_session_service.js +405 -0
- package/dist/esm/skills/gcp_skill_registry.js +78 -0
- package/dist/esm/skills/loader.js +64 -0
- package/dist/esm/skills/skill_registry.js +7 -0
- package/dist/esm/tools/agent_tool.js +10 -5
- package/dist/esm/tools/exit_loop_tool.js +9 -0
- package/dist/esm/tools/function_tool.js +7 -2
- package/dist/esm/tools/google_maps_grounding_tool.js +54 -0
- package/dist/esm/tools/long_running_tool.js +2 -1
- package/dist/esm/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/esm/tools/mcp/mcp_tool.js +10 -6
- package/dist/esm/tools/mcp/mcp_toolset.js +26 -3
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +48 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +60 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +111 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +206 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +101 -0
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +97 -0
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +229 -0
- package/dist/esm/tools/skill/load_skill_resource_tool.js +26 -27
- package/dist/esm/tools/skill/load_skill_tool.js +12 -1
- package/dist/esm/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/esm/tools/skill/search_skills_tool.js +82 -0
- package/dist/esm/tools/skill/skill_toolset.js +40 -5
- package/dist/esm/tools/vertex_rag_retrieval_tool.js +36 -0
- package/dist/esm/utils/async_queue.js +60 -0
- package/dist/esm/utils/case_utils.js +25 -0
- package/dist/esm/utils/env_aware_utils.js +4 -0
- package/dist/esm/utils/file_utils.js +26 -0
- package/dist/esm/utils/gemini_schema_util.js +18 -0
- package/dist/esm/utils/live_connection_utils.js +256 -0
- package/dist/esm/utils/model_name.js +8 -0
- package/dist/esm/utils/partial_copy.js +23 -0
- package/dist/esm/utils/streaming_utils.js +167 -121
- package/dist/esm/utils/vertex_ai_utils.js +22 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent.d.ts +14 -0
- package/dist/types/a2a/a2a_remote_agent_utils.d.ts +29 -4
- package/dist/types/a2a/event_converter_utils.d.ts +14 -1
- package/dist/types/a2a/metadata_converter_utils.d.ts +18 -0
- package/dist/types/a2a/part_converter_utils.d.ts +51 -6
- package/dist/types/agents/invocation_context.d.ts +0 -9
- package/dist/types/agents/llm_agent.d.ts +14 -0
- package/dist/types/agents/processors/agent_transfer_llm_request_processor.d.ts +14 -0
- package/dist/types/agents/processors/base_llm_processor.d.ts +12 -4
- package/dist/types/agents/processors/basic_llm_request_processor.d.ts +12 -0
- package/dist/types/agents/processors/content_processor_utils.d.ts +26 -0
- package/dist/types/agents/processors/content_request_processor.d.ts +16 -0
- package/dist/types/agents/processors/context_compactor_request_processor.d.ts +12 -0
- package/dist/types/agents/processors/identity_llm_request_processor.d.ts +11 -0
- package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +14 -1
- package/dist/types/agents/processors/tool_filter_request_processor.d.ts +12 -1
- package/dist/types/agents/run_config.d.ts +15 -0
- package/dist/types/code_executors/agent_engine_sandbox_code_executor.d.ts +51 -0
- package/dist/types/common.d.ts +19 -1
- package/dist/types/context/summarizers/llm_summarizer.d.ts +17 -0
- package/dist/types/events/event_actions.d.ts +25 -8
- package/dist/types/events/structured_events.d.ts +13 -0
- package/dist/types/examples/example_util.d.ts +25 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/integrations/agent_registry/agent_registry.d.ts +94 -0
- package/dist/types/integrations/agent_registry/agent_registry_mcp_toolset.d.ts +62 -0
- package/dist/types/integrations/agent_registry/helpers.d.ts +7 -0
- package/dist/types/integrations/agent_registry/types.d.ts +101 -0
- package/dist/types/memory/vertex_ai_memory_bank_service.d.ts +52 -0
- package/dist/types/models/base_llm_connection.d.ts +10 -0
- package/dist/types/models/gemini_llm_connection.d.ts +15 -4
- package/dist/types/models/llm_response.d.ts +10 -1
- package/dist/types/plugins/security_plugin.d.ts +30 -0
- package/dist/types/runner/in_memory_runner.d.ts +28 -1
- package/dist/types/runner/runner.d.ts +47 -0
- package/dist/types/sessions/base_session_service.d.ts +22 -0
- package/dist/types/sessions/database_session_service.d.ts +1 -1
- package/dist/types/sessions/db/schema.d.ts +1 -0
- package/dist/types/sessions/in_memory_session_service.d.ts +1 -1
- package/dist/types/sessions/vertex_ai_session_service.d.ts +37 -0
- package/dist/types/skills/gcp_skill_registry.d.ts +24 -0
- package/dist/types/skills/loader.d.ts +7 -0
- package/dist/types/skills/skill.d.ts +1 -1
- package/dist/types/skills/skill_registry.d.ts +29 -0
- package/dist/types/tools/exit_loop_tool.d.ts +9 -0
- package/dist/types/tools/function_tool.d.ts +22 -2
- package/dist/types/tools/google_maps_grounding_tool.d.ts +22 -0
- package/dist/types/tools/long_running_tool.d.ts +11 -1
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +3 -0
- package/dist/types/tools/mcp/mcp_toolset.d.ts +2 -1
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +25 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +20 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.d.ts +20 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +34 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +59 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +23 -0
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +27 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +50 -0
- package/dist/types/tools/skill/load_skill_resource_tool.d.ts +1 -1
- package/dist/types/tools/skill/search_skills_tool.d.ts +14 -0
- package/dist/types/tools/skill/skill_toolset.d.ts +5 -0
- package/dist/types/tools/vertex_rag_retrieval_tool.d.ts +42 -0
- package/dist/types/utils/async_queue.d.ts +18 -0
- package/dist/types/utils/case_utils.d.ts +12 -0
- package/dist/types/utils/file_utils.d.ts +2 -0
- package/dist/types/utils/live_connection_utils.d.ts +30 -0
- package/dist/types/utils/model_name.d.ts +7 -0
- package/dist/types/utils/partial_copy.d.ts +13 -0
- package/dist/types/utils/streaming_utils.d.ts +7 -17
- package/dist/types/utils/vertex_ai_utils.d.ts +14 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/web/agents/base_agent.js +31 -1
- package/dist/web/agents/functions.js +4 -0
- package/dist/web/agents/instructions.js +81 -33
- package/dist/web/agents/invocation_context.js +0 -1
- package/dist/web/agents/llm_agent.js +53 -5
- package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/web/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/web/agents/processors/content_processor_utils.js +53 -23
- package/dist/web/agents/processors/content_request_processor.js +7 -0
- package/dist/web/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/web/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/web/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/web/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/web/auth/auth_preprocessor.js +12 -10
- package/dist/web/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/web/code_executors/agent_engine_sandbox_code_executor.js +281 -0
- package/dist/web/code_executors/code_execution_utils.js +1 -1
- package/dist/web/code_executors/code_executor_context.js +7 -7
- package/dist/web/common.js +43 -1
- package/dist/web/context/summarizers/llm_summarizer.js +11 -0
- package/dist/web/context/token_based_context_compactor.js +1 -1
- package/dist/web/events/event.js +4 -2
- package/dist/web/index.js +11 -0
- package/dist/web/integrations/agent_registry/agent_registry.js +333 -0
- package/dist/web/integrations/agent_registry/agent_registry_mcp_toolset.js +109 -0
- package/dist/web/integrations/agent_registry/helpers.js +28 -0
- package/dist/web/integrations/agent_registry/types.js +20 -0
- package/dist/web/memory/vertex_ai_memory_bank_service.js +475 -0
- package/dist/web/models/gemini_llm_connection.js +75 -19
- package/dist/web/models/google_llm.js +26 -8
- package/dist/web/plugins/security_plugin.js +16 -0
- package/dist/web/runner/in_memory_runner.js +10 -5
- package/dist/web/runner/runner.js +32 -2
- package/dist/web/sessions/base_session_service.js +11 -1
- package/dist/web/sessions/database_session_service.js +51 -5
- package/dist/web/sessions/db/schema.js +44 -10
- package/dist/web/sessions/in_memory_session_service.js +74 -16
- package/dist/web/sessions/registry.js +7 -0
- package/dist/web/sessions/vertex_ai_session_service.js +416 -0
- package/dist/web/skills/gcp_skill_registry.js +78 -0
- package/dist/web/skills/loader.js +64 -0
- package/dist/web/skills/skill_registry.js +7 -0
- package/dist/web/tools/agent_tool.js +10 -5
- package/dist/web/tools/exit_loop_tool.js +9 -0
- package/dist/web/tools/function_tool.js +7 -2
- package/dist/web/tools/google_maps_grounding_tool.js +54 -0
- package/dist/web/tools/long_running_tool.js +2 -1
- package/dist/web/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/web/tools/mcp/mcp_tool.js +10 -6
- package/dist/web/tools/mcp/mcp_toolset.js +26 -3
- package/dist/web/tools/openapi_tool/auth/auth_helpers.js +48 -0
- package/dist/web/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +60 -0
- package/dist/web/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +111 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +221 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +101 -0
- package/dist/web/tools/openapi_tool/openapi_toolset.js +97 -0
- package/dist/web/tools/openapi_tool/rest_api_tool.js +229 -0
- package/dist/web/tools/skill/load_skill_resource_tool.js +26 -27
- package/dist/web/tools/skill/load_skill_tool.js +12 -1
- package/dist/web/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/web/tools/skill/search_skills_tool.js +82 -0
- package/dist/web/tools/skill/skill_toolset.js +40 -5
- package/dist/web/tools/vertex_rag_retrieval_tool.js +36 -0
- package/dist/web/utils/async_queue.js +60 -0
- package/dist/web/utils/case_utils.js +25 -0
- package/dist/web/utils/env_aware_utils.js +4 -0
- package/dist/web/utils/file_utils.js +26 -0
- package/dist/web/utils/gemini_schema_util.js +18 -0
- package/dist/web/utils/live_connection_utils.js +254 -0
- package/dist/web/utils/model_name.js +8 -0
- package/dist/web/utils/partial_copy.js +23 -0
- package/dist/web/utils/streaming_utils.js +221 -122
- package/dist/web/utils/vertex_ai_utils.js +22 -0
- package/dist/web/version.js +1 -1
- package/package.json +4 -1
|
@@ -12,7 +12,6 @@ import { BaseSessionService } from '../sessions/base_session_service.js';
|
|
|
12
12
|
import { Session } from '../sessions/session.js';
|
|
13
13
|
import { ActiveStreamingTool } from './active_streaming_tool.js';
|
|
14
14
|
import { BaseAgent } from './base_agent.js';
|
|
15
|
-
import { LiveRequestQueue } from './live_request_queue.js';
|
|
16
15
|
import { RunConfig } from './run_config.js';
|
|
17
16
|
import { TranscriptionEntry } from './transcription_entry.js';
|
|
18
17
|
/**
|
|
@@ -31,7 +30,6 @@ export interface InvocationContextParams {
|
|
|
31
30
|
endInvocation?: boolean;
|
|
32
31
|
transcriptionCache?: TranscriptionEntry[];
|
|
33
32
|
runConfig?: RunConfig;
|
|
34
|
-
liveRequestQueue?: LiveRequestQueue;
|
|
35
33
|
activeStreamingTools?: Record<string, ActiveStreamingTool>;
|
|
36
34
|
pluginManager: PluginManager;
|
|
37
35
|
abortSignal?: AbortSignal;
|
|
@@ -124,10 +122,6 @@ export declare class InvocationContext {
|
|
|
124
122
|
* this invocation.
|
|
125
123
|
*/
|
|
126
124
|
private readonly invocationCostManager;
|
|
127
|
-
/**
|
|
128
|
-
* The queue to receive live requests.
|
|
129
|
-
*/
|
|
130
|
-
liveRequestQueue?: LiveRequestQueue;
|
|
131
125
|
/**
|
|
132
126
|
* The running streaming tools of this invocation.
|
|
133
127
|
*/
|
|
@@ -136,9 +130,6 @@ export declare class InvocationContext {
|
|
|
136
130
|
* The manager for keeping track of plugins in this invocation.
|
|
137
131
|
*/
|
|
138
132
|
pluginManager: PluginManager;
|
|
139
|
-
/**
|
|
140
|
-
* The abort signal for the invocation.
|
|
141
|
-
*/
|
|
142
133
|
readonly abortSignal?: AbortSignal;
|
|
143
134
|
/**
|
|
144
135
|
* @param params The parameters for creating an invocation context.
|
|
@@ -327,6 +327,20 @@ export declare class LlmAgent extends BaseAgent {
|
|
|
327
327
|
private maybeSaveOutputToState;
|
|
328
328
|
protected runAsyncImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
329
329
|
protected runLiveImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
330
|
+
/**
|
|
331
|
+
* Runs the bidirectional (live) flow for this agent.
|
|
332
|
+
*
|
|
333
|
+
* Establishes a live connection to the model, drains the invocation's
|
|
334
|
+
* `liveRequestQueue` into the connection on a parallel task, and yields
|
|
335
|
+
* events derived from server messages until the queue closes, the model
|
|
336
|
+
* finishes, or an agent transfer occurs.
|
|
337
|
+
*
|
|
338
|
+
* If the live connection drops (network failure, server `goAway`) and a
|
|
339
|
+
* session resumption handle has been observed, the flow transparently
|
|
340
|
+
* reconnects using that handle up to {@link MAX_LIVE_RECONNECT_ATTEMPTS}
|
|
341
|
+
* times. Subsequent reconnects skip `sendHistory` because the server
|
|
342
|
+
* already holds the conversation state associated with the handle.
|
|
343
|
+
*/
|
|
330
344
|
private runLiveFlow;
|
|
331
345
|
private runOneStepAsync;
|
|
332
346
|
private postprocess;
|
|
@@ -7,9 +7,23 @@ import { Event } from '../../events/event.js';
|
|
|
7
7
|
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
8
|
import { InvocationContext } from '../invocation_context.js';
|
|
9
9
|
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
/**
|
|
11
|
+
* Augments the {@link LlmRequest} to support agent transfer. When the current
|
|
12
|
+
* agent has reachable transfer targets (sub-agents, peer agents, or a parent
|
|
13
|
+
* agent), this processor registers a `transfer_to_agent` function tool and
|
|
14
|
+
* appends instructions describing each candidate so the model can choose to
|
|
15
|
+
* hand off control.
|
|
16
|
+
*/
|
|
10
17
|
export declare class AgentTransferLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
11
18
|
private readonly toolName;
|
|
12
19
|
private readonly tool;
|
|
20
|
+
/**
|
|
21
|
+
* Appends transfer instructions and registers the `transfer_to_agent` tool
|
|
22
|
+
* when the agent has reachable transfer targets.
|
|
23
|
+
*
|
|
24
|
+
* @param invocationContext - The current invocation context.
|
|
25
|
+
* @param llmRequest - The request to augment with transfer instructions and the transfer tool.
|
|
26
|
+
*/
|
|
13
27
|
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
14
28
|
private buildTargetAgentsInfo;
|
|
15
29
|
private buildTargetAgentsInstructions;
|
|
@@ -8,20 +8,28 @@ import { LlmRequest } from '../../models/llm_request.js';
|
|
|
8
8
|
import { LlmResponse } from '../../models/llm_response.js';
|
|
9
9
|
import { InvocationContext } from '../invocation_context.js';
|
|
10
10
|
/**
|
|
11
|
-
* Base class for LLM request
|
|
11
|
+
* Base class for LLM request processors. Implementations mutate or augment
|
|
12
|
+
* the {@link LlmRequest} before it is sent to the model.
|
|
12
13
|
*/
|
|
13
14
|
export declare abstract class BaseLlmRequestProcessor {
|
|
14
15
|
/**
|
|
15
|
-
* Runs the processor.
|
|
16
|
+
* Runs the processor, optionally yielding intermediate {@link Event}s.
|
|
17
|
+
*
|
|
18
|
+
* @param invocationContext - The current invocation context.
|
|
19
|
+
* @param llmRequest - The request object to populate or mutate in place.
|
|
16
20
|
*/
|
|
17
21
|
abstract runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
|
-
* Base class for LLM response
|
|
24
|
+
* Base class for LLM response processors. Implementations inspect or
|
|
25
|
+
* transform the {@link LlmResponse} after it is received from the model.
|
|
21
26
|
*/
|
|
22
27
|
export declare abstract class BaseLlmResponseProcessor {
|
|
23
28
|
/**
|
|
24
|
-
*
|
|
29
|
+
* Runs the processor, optionally yielding intermediate {@link Event}s.
|
|
30
|
+
*
|
|
31
|
+
* @param invocationContext - The current invocation context.
|
|
32
|
+
* @param llmResponse - The response received from the model.
|
|
25
33
|
*/
|
|
26
34
|
abstract runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event, void, void>;
|
|
27
35
|
}
|
|
@@ -7,7 +7,19 @@ import { Event } from '../../events/event.js';
|
|
|
7
7
|
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
8
|
import { InvocationContext } from '../invocation_context.js';
|
|
9
9
|
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
/**
|
|
11
|
+
* Populates the {@link LlmRequest} with model configuration derived from the
|
|
12
|
+
* agent, including the model name, generation config, output schema, and live
|
|
13
|
+
* connect settings.
|
|
14
|
+
*/
|
|
10
15
|
export declare class BasicLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
16
|
+
/**
|
|
17
|
+
* Populates model name, generation config, output schema, and live connect
|
|
18
|
+
* settings on the request from the agent and run config.
|
|
19
|
+
*
|
|
20
|
+
* @param invocationContext - The current invocation context.
|
|
21
|
+
* @param llmRequest - The request object to populate in place.
|
|
22
|
+
*/
|
|
11
23
|
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
12
24
|
}
|
|
13
25
|
export declare const BASIC_LLM_REQUEST_PROCESSOR: BasicLlmRequestProcessor;
|
|
@@ -34,3 +34,29 @@ export declare function getContents(events: Event[], agentName: string, currentB
|
|
|
34
34
|
* needed for proper tool execution while excluding conversation history.
|
|
35
35
|
*/
|
|
36
36
|
export declare function getCurrentTurnContents(events: Event[], agentName: string, currentBranch?: string): Content[];
|
|
37
|
+
/**
|
|
38
|
+
* Merges a list of function_response events into one event.
|
|
39
|
+
*
|
|
40
|
+
* The key goal is to ensure:
|
|
41
|
+
* 1. function_call and function_response are always of the same number.
|
|
42
|
+
* 2. The function_call and function_response are consecutively in the content.
|
|
43
|
+
*
|
|
44
|
+
* @param events: A list of function_response events.
|
|
45
|
+
*
|
|
46
|
+
* NOTE:
|
|
47
|
+
* function_response_events must fulfill these requirements:
|
|
48
|
+
* 1. The list is in increasing order of timestamp;
|
|
49
|
+
* 2. the first event is the initial function_response event;
|
|
50
|
+
* 3. all later events should contain at least one function_response part that
|
|
51
|
+
* related to the function_call event. Caveat: This implementation doesn't
|
|
52
|
+
* support when a parallel function_call event contains async function_call of
|
|
53
|
+
* the same name.
|
|
54
|
+
*
|
|
55
|
+
* @returns
|
|
56
|
+
* A merged event, that is
|
|
57
|
+
* 1. All later function_response will replace function_response part in
|
|
58
|
+
* the initial function_response event.
|
|
59
|
+
* 2. All non-function_response parts will be appended to the part list of
|
|
60
|
+
* the initial function_response event.
|
|
61
|
+
*/
|
|
62
|
+
export declare function mergeFunctionResponseEvents(events: Event[]): Event;
|
|
@@ -7,7 +7,23 @@ import { Event } from '../../events/event.js';
|
|
|
7
7
|
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
8
|
import { InvocationContext } from '../invocation_context.js';
|
|
9
9
|
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
/**
|
|
11
|
+
* Populates {@link LlmRequest.contents} from the session event history.
|
|
12
|
+
*
|
|
13
|
+
* When a {@link CompactedEvent} exists in the session, only the most recent
|
|
14
|
+
* compacted event and the raw events that follow it are included, eliding
|
|
15
|
+
* earlier history. The extent of context included depends on the agent's
|
|
16
|
+
* `includeContents` setting: `'default'` sends the full visible history while
|
|
17
|
+
* any other value sends only the current-turn context.
|
|
18
|
+
*/
|
|
10
19
|
export declare class ContentRequestProcessor implements BaseLlmRequestProcessor {
|
|
20
|
+
/**
|
|
21
|
+
* Fills {@link LlmRequest.contents} based on the session event history and
|
|
22
|
+
* agent configuration.
|
|
23
|
+
*
|
|
24
|
+
* @param invocationContext - The current invocation context.
|
|
25
|
+
* @param llmRequest - The request whose contents field will be populated.
|
|
26
|
+
*/
|
|
11
27
|
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
12
28
|
}
|
|
13
29
|
export declare const CONTENT_REQUEST_PROCESSOR: ContentRequestProcessor;
|
|
@@ -17,6 +17,18 @@ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class ContextCompactorRequestProcessor implements BaseLlmRequestProcessor {
|
|
19
19
|
private compactors;
|
|
20
|
+
/**
|
|
21
|
+
* @param compactors - Ordered list of compactors to evaluate; the first one
|
|
22
|
+
* that reports it should compact will perform the compaction.
|
|
23
|
+
*/
|
|
20
24
|
constructor(compactors: BaseContextCompactor[]);
|
|
25
|
+
/**
|
|
26
|
+
* Evaluates compactors in priority order. The first compactor that indicates
|
|
27
|
+
* it should compact will compact the session history, fire plugin hooks, and
|
|
28
|
+
* yield any newly generated events. Iteration stops after one compaction.
|
|
29
|
+
*
|
|
30
|
+
* @param invocationContext - The current invocation context.
|
|
31
|
+
* @param _llmRequest - Unused; present to satisfy the {@link BaseLlmRequestProcessor} interface.
|
|
32
|
+
*/
|
|
21
33
|
runAsync(invocationContext: InvocationContext, _llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
22
34
|
}
|
|
@@ -7,7 +7,18 @@ import { Event } from '../../events/event.js';
|
|
|
7
7
|
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
8
|
import { InvocationContext } from '../invocation_context.js';
|
|
9
9
|
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
/**
|
|
11
|
+
* Appends identity instructions to the {@link LlmRequest} system prompt,
|
|
12
|
+
* informing the model of the agent's name and description.
|
|
13
|
+
*/
|
|
10
14
|
export declare class IdentityLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
15
|
+
/**
|
|
16
|
+
* Appends agent name and description as identity instructions to the system
|
|
17
|
+
* prompt of the request.
|
|
18
|
+
*
|
|
19
|
+
* @param invocationContext - The current invocation context.
|
|
20
|
+
* @param llmRequest - The request object to append instructions to.
|
|
21
|
+
*/
|
|
11
22
|
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, undefined>;
|
|
12
23
|
}
|
|
13
24
|
export declare const IDENTITY_LLM_REQUEST_PROCESSOR: IdentityLlmRequestProcessor;
|
|
@@ -6,8 +6,21 @@
|
|
|
6
6
|
import { Event } from '../../events/event.js';
|
|
7
7
|
import { InvocationContext } from '../invocation_context.js';
|
|
8
8
|
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
9
|
+
/**
|
|
10
|
+
* Resumes tool calls that were paused for user confirmation. Scans the session
|
|
11
|
+
* event history for pending confirmation responses and re-invokes the
|
|
12
|
+
* corresponding tools before the next LLM turn.
|
|
13
|
+
*/
|
|
9
14
|
export declare class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
10
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Resumes tool calls that were paused for user confirmation, re-invoking
|
|
17
|
+
* them with the confirmed or denied decision before the next LLM turn.
|
|
18
|
+
*
|
|
19
|
+
* @param invocationContext - The current invocation context, including the
|
|
20
|
+
* session event history used to locate pending confirmation responses.
|
|
21
|
+
* @yields Function response events for tools that have been confirmed and
|
|
22
|
+
* are ready to resume.
|
|
23
|
+
*/
|
|
11
24
|
runAsync(invocationContext: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
12
25
|
}
|
|
13
26
|
export declare const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR: RequestConfirmationLlmRequestProcessor;
|
|
@@ -7,8 +7,19 @@ import { Event } from '../../events/event.js';
|
|
|
7
7
|
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
8
|
import { InvocationContext } from '../invocation_context.js';
|
|
9
9
|
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
/**
|
|
11
|
+
* Filters the set of tools on the {@link LlmRequest} by delegating to the
|
|
12
|
+
* active plugin manager's `beforeToolSelection` hook. If no plugin restricts
|
|
13
|
+
* the tool set, the request is left unchanged.
|
|
14
|
+
*/
|
|
10
15
|
export declare class ToolFilterRequestProcessor extends BaseLlmRequestProcessor {
|
|
11
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Invokes plugin-based tool filtering and updates {@link LlmRequest.allowedTools}
|
|
18
|
+
* with the reduced tool set if any plugin returns a filtered result.
|
|
19
|
+
*
|
|
20
|
+
* @param invocationContext - The current invocation context.
|
|
21
|
+
* @param llmRequest - The request whose allowed tools may be restricted.
|
|
22
|
+
*/
|
|
12
23
|
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
13
24
|
}
|
|
14
25
|
export declare const TOOL_FILTER_REQUEST_PROCESSOR: ToolFilterRequestProcessor;
|
|
@@ -78,6 +78,21 @@ export interface RunConfig {
|
|
|
78
78
|
*/
|
|
79
79
|
pauseOnToolCalls?: boolean;
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates a {@link RunConfig} with production-safe defaults.
|
|
83
|
+
*
|
|
84
|
+
* Default values applied when the corresponding field is absent from `params`:
|
|
85
|
+
* - `saveInputBlobsAsArtifacts` → `false`
|
|
86
|
+
* - `supportCfc` → `false`
|
|
87
|
+
* - `enableAffectiveDialog` → `false`
|
|
88
|
+
* - `streamingMode` → {@link StreamingMode.NONE}
|
|
89
|
+
* - `maxLlmCalls` → `500` (validated via `validateMaxLlmCalls`)
|
|
90
|
+
* - `pauseOnToolCalls` → `false`
|
|
91
|
+
*
|
|
92
|
+
* @param params - Optional partial {@link RunConfig} overriding defaults.
|
|
93
|
+
* @returns A merged {@link RunConfig} object.
|
|
94
|
+
* @throws {Error} When `params.maxLlmCalls` exceeds `Number.MAX_SAFE_INTEGER`.
|
|
95
|
+
*/
|
|
81
96
|
export declare function createRunConfig(params?: Partial<RunConfig>): {
|
|
82
97
|
speechConfig?: SpeechConfig | undefined;
|
|
83
98
|
responseModalities?: Modality[] | undefined;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Client } from '@google-cloud/vertexai';
|
|
7
|
+
import { BaseCodeExecutor, ExecuteCodeParams } from './base_code_executor.js';
|
|
8
|
+
import { CodeExecutionResult } from './code_execution_utils.js';
|
|
9
|
+
/**
|
|
10
|
+
* Options for AgentEngineSandboxCodeExecutor.
|
|
11
|
+
*/
|
|
12
|
+
export interface AgentEngineSandboxCodeExecutorOptions {
|
|
13
|
+
/**
|
|
14
|
+
* If set, load the existing resource name of the code execution sandbox.
|
|
15
|
+
* Format: projects/123/locations/us-central1/reasoningEngines/456/sandboxEnvironments/789
|
|
16
|
+
*/
|
|
17
|
+
sandboxResourceName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The resource name of the agent engine to use to create the code execution sandbox.
|
|
20
|
+
* Format: projects/123/locations/us-central1/reasoningEngines/456
|
|
21
|
+
*/
|
|
22
|
+
agentEngineResourceName?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Project ID to use. If not provided, read from GOOGLE_CLOUD_PROJECT env var.
|
|
25
|
+
*/
|
|
26
|
+
projectId?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Location to use. If not provided, read from GOOGLE_CLOUD_LOCATION env var or default to 'us-central1'.
|
|
29
|
+
*/
|
|
30
|
+
location?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional client instance to use. If not provided, a new one will be created.
|
|
33
|
+
* Primarily for testing.
|
|
34
|
+
*/
|
|
35
|
+
client?: Client;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A code executor that uses Agent Engine Code Execution Sandbox to execute code.
|
|
39
|
+
*/
|
|
40
|
+
export declare class AgentEngineSandboxCodeExecutor extends BaseCodeExecutor {
|
|
41
|
+
sandboxResourceName?: string;
|
|
42
|
+
agentEngineResourceName?: string;
|
|
43
|
+
private projectId?;
|
|
44
|
+
private location?;
|
|
45
|
+
private client;
|
|
46
|
+
private agentEngineCreationPromise?;
|
|
47
|
+
constructor(options?: AgentEngineSandboxCodeExecutorOptions);
|
|
48
|
+
executeCode(params: ExecuteCodeParams): Promise<CodeExecutionResult>;
|
|
49
|
+
private getOrCreateAgentEngine;
|
|
50
|
+
private getOrCreateSandbox;
|
|
51
|
+
}
|
package/dist/types/common.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export { InMemoryArtifactService } from './artifacts/in_memory_artifact_service.
|
|
|
34
34
|
export { AuthCredentialTypes } from './auth/auth_credential.js';
|
|
35
35
|
export type { AuthCredential, HttpAuth, HttpCredentials, OAuth2Auth, ServiceAccount, ServiceAccountCredential, } from './auth/auth_credential.js';
|
|
36
36
|
export { AuthHandler } from './auth/auth_handler.js';
|
|
37
|
+
export { AUTH_PREPROCESSOR, AuthPreprocessor } from './auth/auth_preprocessor.js';
|
|
37
38
|
export { AuthProviderRegistry } from './auth/auth_provider_registry.js';
|
|
38
39
|
export { OAuthGrantType } from './auth/auth_schemes.js';
|
|
39
40
|
export type { AuthScheme, OpenIdConnectWithConfig } from './auth/auth_schemes.js';
|
|
@@ -73,6 +74,8 @@ export type { Example } from './examples/example.js';
|
|
|
73
74
|
export type { BaseMemoryService, SearchMemoryRequest, SearchMemoryResponse, } from './memory/base_memory_service.js';
|
|
74
75
|
export { InMemoryMemoryService } from './memory/in_memory_memory_service.js';
|
|
75
76
|
export type { MemoryEntry } from './memory/memory_entry.js';
|
|
77
|
+
export { VertexAiMemoryBankService } from './memory/vertex_ai_memory_bank_service.js';
|
|
78
|
+
export type { VertexAiMemoryBankServiceOptions } from './memory/vertex_ai_memory_bank_service.js';
|
|
76
79
|
export { ApigeeLlm } from './models/apigee_llm.js';
|
|
77
80
|
export type { ApigeeLlmParams } from './models/apigee_llm.js';
|
|
78
81
|
export { BaseLlm, isBaseLlm } from './models/base_llm.js';
|
|
@@ -108,6 +111,7 @@ export type { ToolPredicate } from './tools/base_toolset.js';
|
|
|
108
111
|
export { EXIT_LOOP, ExitLoopTool } from './tools/exit_loop_tool.js';
|
|
109
112
|
export { FunctionTool, isFunctionTool } from './tools/function_tool.js';
|
|
110
113
|
export type { ToolExecuteArgument, ToolExecuteFunction, ToolInputParameters, ToolOptions, } from './tools/function_tool.js';
|
|
114
|
+
export { GOOGLE_MAPS_GROUNDING, GoogleMapsGroundingTool, } from './tools/google_maps_grounding_tool.js';
|
|
111
115
|
export { GOOGLE_SEARCH, GoogleSearchTool } from './tools/google_search_tool.js';
|
|
112
116
|
export { LOAD_ARTIFACTS, LoadArtifactsTool, } from './tools/load_artifacts_tool.js';
|
|
113
117
|
export { LOAD_MEMORY, LoadMemoryTool } from './tools/load_memory_tool.js';
|
|
@@ -117,17 +121,31 @@ export { ToolConfirmation } from './tools/tool_confirmation.js';
|
|
|
117
121
|
export { URL_CONTEXT, UrlContextTool } from './tools/url_context_tool.js';
|
|
118
122
|
export { VertexAiSearchTool } from './tools/vertex_ai_search_tool.js';
|
|
119
123
|
export type { DataStoreParams, SearchEngineParams, VertexAISearchConfig, VertexAISearchDataStoreSpec, VertexAiSearchToolParams, } from './tools/vertex_ai_search_tool.js';
|
|
124
|
+
export { VertexRagRetrievalTool } from './tools/vertex_rag_retrieval_tool.js';
|
|
120
125
|
export { LogLevel, getLogger, setLogLevel, setLogger } from './utils/logger.js';
|
|
121
126
|
export type { Logger } from './utils/logger.js';
|
|
122
|
-
export { isGemini2OrAbove } from './utils/model_name.js';
|
|
127
|
+
export { isGemini2OrAbove, isGemini3xFlashLive } from './utils/model_name.js';
|
|
123
128
|
export { zodObjectToSchema } from './utils/simple_zod_to_json.js';
|
|
124
129
|
export { GoogleLLMVariant } from './utils/variant_utils.js';
|
|
125
130
|
export { version } from './version.js';
|
|
131
|
+
export { GCPSkillRegistry } from './skills/gcp_skill_registry.js';
|
|
132
|
+
export type { GCPSkillRegistryOptions } from './skills/gcp_skill_registry.js';
|
|
133
|
+
export { loadAllSkillsInDir, loadSkillFromDir, loadSkillFromZipBuffer, validateSkillDir, } from './skills/loader.js';
|
|
126
134
|
export type { Frontmatter, Resources, Script, Skill } from './skills/skill.js';
|
|
135
|
+
export type { SkillRegistry } from './skills/skill_registry.js';
|
|
127
136
|
export { ListSkillsTool } from './tools/skill/list_skills_tool.js';
|
|
128
137
|
export { LoadSkillResourceTool } from './tools/skill/load_skill_resource_tool.js';
|
|
129
138
|
export { LoadSkillTool } from './tools/skill/load_skill_tool.js';
|
|
139
|
+
export { SearchSkillsTool } from './tools/skill/search_skills_tool.js';
|
|
130
140
|
export { SkillToolset } from './tools/skill/skill_toolset.js';
|
|
141
|
+
export { OpenApiSpecParser } from './tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js';
|
|
142
|
+
export type { OperationEndpoint, ParsedOperation, } from './tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js';
|
|
143
|
+
export { OperationParser } from './tools/openapi_tool/openapi_spec_parser/operation_parser.js';
|
|
144
|
+
export type { ApiParameter } from './tools/openapi_tool/openapi_spec_parser/operation_parser.js';
|
|
145
|
+
export { ToolAuthHandler } from './tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js';
|
|
146
|
+
export type { AuthPreparationResult } from './tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js';
|
|
147
|
+
export { OpenAPIToolset } from './tools/openapi_tool/openapi_toolset.js';
|
|
148
|
+
export { RestApiTool, createRestApiTool, } from './tools/openapi_tool/rest_api_tool.js';
|
|
131
149
|
export * from './artifacts/base_artifact_service.js';
|
|
132
150
|
export * from './features/feature_registry.js';
|
|
133
151
|
export * from './memory/base_memory_service.js';
|
|
@@ -7,8 +7,14 @@ import { CompactedEvent } from '../../events/compacted_event.js';
|
|
|
7
7
|
import { Event } from '../../events/event.js';
|
|
8
8
|
import { BaseLlm } from '../../models/base_llm.js';
|
|
9
9
|
import { BaseSummarizer } from './base_summarizer.js';
|
|
10
|
+
/** Options for constructing an {@link LlmSummarizer}. */
|
|
10
11
|
export interface LlmSummarizerOptions {
|
|
12
|
+
/** The LLM instance used to generate the summary. */
|
|
11
13
|
llm: BaseLlm;
|
|
14
|
+
/**
|
|
15
|
+
* Optional system prompt prepended to the formatted events. Defaults to a
|
|
16
|
+
* built-in summarization prompt when omitted.
|
|
17
|
+
*/
|
|
12
18
|
prompt?: string;
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
@@ -18,6 +24,17 @@ export interface LlmSummarizerOptions {
|
|
|
18
24
|
export declare class LlmSummarizer implements BaseSummarizer {
|
|
19
25
|
private readonly llm;
|
|
20
26
|
private readonly prompt;
|
|
27
|
+
/**
|
|
28
|
+
* @param options - Configuration specifying the LLM and optional prompt.
|
|
29
|
+
*/
|
|
21
30
|
constructor(options: LlmSummarizerOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Summarizes a list of events into a single {@link CompactedEvent} using the
|
|
33
|
+
* configured LLM.
|
|
34
|
+
*
|
|
35
|
+
* @param events - The events to summarize. Must be non-empty.
|
|
36
|
+
* @returns A promise resolving to the compacted representation.
|
|
37
|
+
* @throws {Error} If `events` is empty or the LLM returns no content.
|
|
38
|
+
*/
|
|
22
39
|
summarize(events: Event[]): Promise<CompactedEvent>;
|
|
23
40
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { AuthConfig } from '../auth/auth_tool.js';
|
|
6
7
|
import { ToolConfirmation } from '../tools/tool_confirmation.js';
|
|
7
|
-
type AuthConfig = any;
|
|
8
8
|
/**
|
|
9
9
|
* Represents the actions attached to an event.
|
|
10
10
|
*/
|
|
@@ -58,17 +58,34 @@ export interface EventActions {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* Creates an EventActions object
|
|
61
|
+
* Creates an {@link EventActions} object with default empty-dict values for
|
|
62
|
+
* all dictionary fields.
|
|
63
|
+
*
|
|
64
|
+
* @param state - Optional partial {@link EventActions} whose properties
|
|
65
|
+
* override the defaults. Dictionary fields (`stateDelta`, `artifactDelta`,
|
|
66
|
+
* `requestedAuthConfigs`, `requestedToolConfirmations`) default to `{}`;
|
|
67
|
+
* scalar fields (`skipSummarization`, `transferToAgent`, `escalate`) default
|
|
68
|
+
* to `undefined`.
|
|
69
|
+
* @returns A fully populated {@link EventActions} object.
|
|
62
70
|
*/
|
|
63
71
|
export declare function createEventActions(state?: Partial<EventActions>): EventActions;
|
|
64
72
|
/**
|
|
65
|
-
* Merges a list of EventActions objects into a single
|
|
73
|
+
* Merges a list of {@link EventActions} objects into a single
|
|
74
|
+
* {@link EventActions} object.
|
|
66
75
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
76
|
+
* Merge semantics:
|
|
77
|
+
* 1. **Dictionary fields** (`stateDelta`, `artifactDelta`,
|
|
78
|
+
* `requestedAuthConfigs`, `requestedToolConfirmations`) — all entries from
|
|
79
|
+
* every source are combined via `Object.assign`. Later sources win on
|
|
80
|
+
* duplicate keys.
|
|
81
|
+
* 2. **Scalar fields** (`skipSummarization`, `transferToAgent`, `escalate`) —
|
|
82
|
+
* last-writer-wins: the value from the last source that sets the field is
|
|
83
|
+
* kept.
|
|
69
84
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
85
|
+
* @param sources - Ordered list of partial {@link EventActions} to merge.
|
|
86
|
+
* Falsy entries are silently skipped.
|
|
87
|
+
* @param target - Optional base {@link EventActions} to merge into. When
|
|
88
|
+
* provided it is used as the starting state before applying `sources`.
|
|
89
|
+
* @returns A new {@link EventActions} containing the merged result.
|
|
72
90
|
*/
|
|
73
91
|
export declare function mergeEventActions(sources: Array<Partial<EventActions>>, target?: EventActions): EventActions;
|
|
74
|
-
export {};
|
|
@@ -7,17 +7,30 @@ import { CodeExecutionResult, ExecutableCode, FunctionCall, FunctionResponse } f
|
|
|
7
7
|
import { Event } from './event.js';
|
|
8
8
|
/**
|
|
9
9
|
* The types of events that can be parsed from a raw Event.
|
|
10
|
+
*
|
|
11
|
+
* Each value corresponds to one category of structured output that
|
|
12
|
+
* {@link toStructuredEvents} may produce from a raw {@link Event}.
|
|
10
13
|
*/
|
|
11
14
|
export declare enum EventType {
|
|
15
|
+
/** A reasoning trace (thought) emitted by the model. */
|
|
12
16
|
THOUGHT = "thought",
|
|
17
|
+
/** A text delta intended for the end user. */
|
|
13
18
|
CONTENT = "content",
|
|
19
|
+
/** A request from the model to execute a tool (function call). */
|
|
14
20
|
TOOL_CALL = "tool_call",
|
|
21
|
+
/** The result returned by a tool execution (function response). */
|
|
15
22
|
TOOL_RESULT = "tool_result",
|
|
23
|
+
/** A request from the model to execute code. */
|
|
16
24
|
CALL_CODE = "call_code",
|
|
25
|
+
/** The result of a code execution. */
|
|
17
26
|
CODE_RESULT = "code_result",
|
|
27
|
+
/** A runtime error signalled via `event.errorCode`. */
|
|
18
28
|
ERROR = "error",
|
|
29
|
+
/** A generic activity or status update. */
|
|
19
30
|
ACTIVITY = "activity",
|
|
31
|
+
/** A request for the user to confirm one or more tool calls. */
|
|
20
32
|
TOOL_CONFIRMATION = "tool_confirmation",
|
|
33
|
+
/** The agent has produced its final response for this turn. */
|
|
21
34
|
FINISHED = "finished"
|
|
22
35
|
}
|
|
23
36
|
/**
|
|
@@ -8,6 +8,31 @@ import { Example } from './example.js';
|
|
|
8
8
|
/**
|
|
9
9
|
* Converts a list of examples to a string that can be used in a system
|
|
10
10
|
* instruction.
|
|
11
|
+
*
|
|
12
|
+
* When `model` is undefined or contains `"gemini-2"`, function calls and
|
|
13
|
+
* responses are formatted with plain triple-backtick fences. For other model
|
|
14
|
+
* names the legacy `tool_code` / `tool_outputs` fences are used instead.
|
|
15
|
+
*
|
|
16
|
+
* @param examples - The few-shot examples to convert.
|
|
17
|
+
* @param model - Optional model name used to select the function-call fence
|
|
18
|
+
* style. Defaults to the gemini-2 style when omitted.
|
|
19
|
+
* @returns A formatted string wrapped in `<EXAMPLES>…</EXAMPLES>` tags,
|
|
20
|
+
* suitable for inclusion in a system instruction.
|
|
11
21
|
*/
|
|
12
22
|
export declare function convertExamplesToText(examples: Example[], model?: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Builds the few-shot portion of a system instruction from a list of examples
|
|
25
|
+
* or a {@link BaseExampleProvider}.
|
|
26
|
+
*
|
|
27
|
+
* @param examples - Either an array of {@link Example} objects or a
|
|
28
|
+
* {@link BaseExampleProvider} whose `getExamples` method is called with
|
|
29
|
+
* `query` to obtain the examples dynamically.
|
|
30
|
+
* @param query - The user query passed to {@link BaseExampleProvider.getExamples}
|
|
31
|
+
* when `examples` is a provider. Ignored when `examples` is an array.
|
|
32
|
+
* @param model - Optional model name forwarded to
|
|
33
|
+
* {@link convertExamplesToText} to select the function-call fence style.
|
|
34
|
+
* @returns A formatted string ready to be appended to a system instruction.
|
|
35
|
+
* @throws {Error} When `examples` is neither an array nor a
|
|
36
|
+
* {@link BaseExampleProvider}.
|
|
37
|
+
*/
|
|
13
38
|
export declare function buildExampleSi(examples: Example[] | BaseExampleProvider, query: string, model?: string): string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,16 +11,22 @@ export type { AfterEventCallback, AfterExecuteCallback, AgentExecutorConfig, Bef
|
|
|
11
11
|
export { toA2a } from './a2a/agent_to_a2a.js';
|
|
12
12
|
export type { ToA2aOptions } from './a2a/agent_to_a2a.js';
|
|
13
13
|
export type { ExecutorContext } from './a2a/executor_context.js';
|
|
14
|
+
export { InvocationContext } from './agents/invocation_context.js';
|
|
14
15
|
export { FileArtifactService } from './artifacts/file_artifact_service.js';
|
|
15
16
|
export { GcsArtifactService } from './artifacts/gcs_artifact_service.js';
|
|
16
17
|
export { getArtifactServiceFromUri } from './artifacts/registry.js';
|
|
18
|
+
export { AgentEngineSandboxCodeExecutor, type AgentEngineSandboxCodeExecutorOptions, } from './code_executors/agent_engine_sandbox_code_executor.js';
|
|
19
|
+
export { CodeExecutionLanguage } from './code_executors/code_execution_utils.js';
|
|
17
20
|
export { UnsafeLocalCodeExecutor, type UnsafeLocalCodeExecutorOptions, } from './code_executors/unsafe_local_code_executor.js';
|
|
18
21
|
export * from './common.js';
|
|
19
22
|
export { DatabaseSessionService } from './sessions/database_session_service.js';
|
|
20
23
|
export { getSessionServiceFromUri } from './sessions/registry.js';
|
|
24
|
+
export { VertexAiSessionService } from './sessions/vertex_ai_session_service.js';
|
|
25
|
+
export type { VertexAiSessionServiceOptions } from './sessions/vertex_ai_session_service.js';
|
|
21
26
|
export { loadAllSkillsInDir, loadSkillFromDir, validateSkillDir, } from './skills/loader.js';
|
|
22
27
|
export { RunSkillInlineScriptTool } from './tools/skill/run_skill_inline_script_tool.js';
|
|
23
28
|
export { RunSkillScriptTool } from './tools/skill/run_skill_script_tool.js';
|
|
29
|
+
export * from './integrations/agent_registry/agent_registry.js';
|
|
24
30
|
export * from './telemetry/google_cloud.js';
|
|
25
31
|
export * from './telemetry/setup.js';
|
|
26
32
|
export * from './tools/mcp/mcp_session_manager.js';
|