@google/adk 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/a2a/a2a_event.js +317 -0
- package/dist/cjs/a2a/a2a_remote_agent.js +174 -0
- package/dist/cjs/a2a/a2a_remote_agent_run_processor.js +198 -0
- package/dist/cjs/a2a/a2a_remote_agent_utils.js +165 -0
- package/dist/cjs/a2a/agent_card.js +380 -0
- package/dist/cjs/a2a/agent_executor.js +221 -0
- package/dist/cjs/a2a/agent_to_a2a.js +115 -0
- package/dist/cjs/a2a/event_converter_utils.js +201 -0
- package/dist/cjs/a2a/event_processor_utils.js +180 -0
- package/dist/cjs/a2a/executor_context.js +53 -0
- package/dist/cjs/a2a/metadata_converter_utils.js +126 -0
- package/dist/cjs/a2a/part_converter_utils.js +47 -34
- package/dist/cjs/agents/base_agent.js +3 -3
- package/dist/cjs/{tools/tool_context.js → agents/context.js} +70 -15
- package/dist/cjs/agents/functions.js +2 -2
- package/dist/cjs/agents/llm_agent.js +38 -674
- package/dist/cjs/agents/processors/agent_transfer_llm_request_processor.js +132 -0
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +68 -0
- package/dist/cjs/agents/processors/code_execution_request_processor.js +389 -0
- package/dist/cjs/agents/{content_processor_utils.js → processors/content_processor_utils.js} +21 -2
- package/dist/cjs/agents/processors/content_request_processor.js +87 -0
- package/dist/cjs/agents/processors/context_compactor_request_processor.js +61 -0
- package/dist/cjs/agents/processors/identity_llm_request_processor.js +54 -0
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +85 -0
- package/dist/cjs/agents/processors/request_confirmation_llm_request_processor.js +165 -0
- package/dist/cjs/artifacts/file_artifact_service.js +35 -4
- package/dist/cjs/common.js +48 -7
- package/dist/cjs/context/base_context_compactor.js +27 -0
- package/dist/cjs/context/summarizers/base_summarizer.js +27 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +93 -0
- package/dist/cjs/context/token_based_context_compactor.js +135 -0
- package/dist/cjs/context/truncating_context_compactor.js +58 -0
- package/dist/cjs/events/compacted_event.js +53 -0
- package/dist/cjs/index.js +113 -53
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/memory/in_memory_memory_service.js +1 -1
- package/dist/cjs/models/llm_response.js +2 -0
- package/dist/cjs/plugins/base_plugin.js +1 -1
- package/dist/cjs/runner/runner.js +20 -11
- package/dist/cjs/sessions/database_session_service.js +4 -1
- package/dist/cjs/sessions/db/operations.js +25 -23
- package/dist/cjs/sessions/state.js +2 -2
- package/dist/cjs/tools/agent_tool.js +6 -5
- package/dist/cjs/tools/base_tool.js +3 -0
- package/dist/cjs/tools/base_toolset.js +13 -3
- package/dist/cjs/tools/exit_loop_tool.js +63 -0
- package/dist/cjs/tools/load_artifacts_tool.js +188 -0
- package/dist/cjs/tools/load_memory_tool.js +107 -0
- package/dist/cjs/tools/mcp/mcp_toolset.js +9 -5
- package/dist/cjs/tools/preload_memory_tool.js +109 -0
- package/dist/cjs/utils/logger.js +62 -54
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/a2a_event.js +269 -0
- package/dist/esm/a2a/a2a_remote_agent.js +148 -0
- package/dist/esm/a2a/a2a_remote_agent_run_processor.js +175 -0
- package/dist/esm/a2a/a2a_remote_agent_utils.js +131 -0
- package/dist/esm/a2a/agent_card.js +340 -0
- package/dist/esm/a2a/agent_executor.js +202 -0
- package/dist/esm/a2a/agent_to_a2a.js +80 -0
- package/dist/esm/a2a/event_converter_utils.js +187 -0
- package/dist/esm/a2a/event_processor_utils.js +159 -0
- package/dist/esm/a2a/executor_context.js +23 -0
- package/dist/esm/a2a/metadata_converter_utils.js +91 -0
- package/dist/esm/a2a/part_converter_utils.js +49 -34
- package/dist/esm/agents/base_agent.js +3 -3
- package/dist/{web/tools/tool_context.js → esm/agents/context.js} +66 -11
- package/dist/esm/agents/functions.js +2 -2
- package/dist/esm/agents/llm_agent.js +31 -683
- package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +101 -0
- package/dist/esm/agents/processors/basic_llm_request_processor.js +37 -0
- package/dist/esm/agents/processors/code_execution_request_processor.js +363 -0
- package/dist/esm/agents/{content_processor_utils.js → processors/content_processor_utils.js} +23 -2
- package/dist/esm/agents/processors/content_request_processor.js +59 -0
- package/dist/esm/agents/processors/context_compactor_request_processor.js +31 -0
- package/dist/esm/agents/processors/identity_llm_request_processor.js +23 -0
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +54 -0
- package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +140 -0
- package/dist/esm/artifacts/file_artifact_service.js +30 -3
- package/dist/esm/common.js +44 -10
- package/dist/esm/context/base_context_compactor.js +5 -0
- package/dist/esm/context/summarizers/base_summarizer.js +5 -0
- package/dist/esm/context/summarizers/llm_summarizer.js +65 -0
- package/dist/esm/context/token_based_context_compactor.js +105 -0
- package/dist/esm/context/truncating_context_compactor.js +28 -0
- package/dist/esm/events/compacted_event.js +22 -0
- package/dist/esm/index.js +119 -18
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/memory/in_memory_memory_service.js +1 -1
- package/dist/esm/models/llm_response.js +2 -0
- package/dist/esm/plugins/base_plugin.js +1 -1
- package/dist/esm/runner/runner.js +18 -10
- package/dist/esm/sessions/database_session_service.js +4 -1
- package/dist/esm/sessions/db/operations.js +32 -18
- package/dist/esm/sessions/state.js +2 -2
- package/dist/esm/tools/agent_tool.js +6 -5
- package/dist/esm/tools/base_tool.js +3 -0
- package/dist/esm/tools/base_toolset.js +11 -2
- package/dist/esm/tools/exit_loop_tool.js +32 -0
- package/dist/esm/tools/load_artifacts_tool.js +159 -0
- package/dist/esm/tools/load_memory_tool.js +78 -0
- package/dist/esm/tools/mcp/mcp_toolset.js +9 -5
- package/dist/esm/tools/preload_memory_tool.js +80 -0
- package/dist/esm/utils/logger.js +52 -54
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_event.d.ts +139 -0
- package/dist/types/a2a/a2a_remote_agent.d.ts +63 -0
- package/dist/types/a2a/a2a_remote_agent_run_processor.d.ts +31 -0
- package/dist/types/a2a/a2a_remote_agent_utils.d.ts +38 -0
- package/dist/types/a2a/agent_card.d.ts +23 -0
- package/dist/types/a2a/agent_executor.d.ts +52 -0
- package/dist/types/a2a/agent_to_a2a.d.ts +45 -0
- package/dist/types/a2a/event_converter_utils.d.ts +20 -0
- package/dist/types/a2a/event_processor_utils.d.ts +24 -0
- package/dist/types/a2a/executor_context.d.ts +33 -0
- package/dist/types/a2a/metadata_converter_utils.d.ts +63 -0
- package/dist/types/a2a/part_converter_utils.d.ts +4 -3
- package/dist/types/agents/base_agent.d.ts +2 -2
- package/dist/types/{tools/tool_context.d.ts → agents/context.d.ts} +43 -8
- package/dist/types/agents/llm_agent.d.ts +14 -31
- package/dist/types/agents/loop_agent.d.ts +1 -1
- package/dist/types/agents/processors/agent_transfer_llm_request_processor.d.ts +18 -0
- package/dist/types/agents/{base_llm_processor.d.ts → processors/base_llm_processor.d.ts} +4 -4
- package/dist/types/agents/processors/basic_llm_request_processor.d.ts +13 -0
- package/dist/types/agents/processors/code_execution_request_processor.d.ts +34 -0
- package/dist/types/agents/{content_processor_utils.d.ts → processors/content_processor_utils.d.ts} +1 -1
- package/dist/types/agents/processors/content_request_processor.d.ts +13 -0
- package/dist/types/agents/processors/context_compactor_request_processor.d.ts +22 -0
- package/dist/types/agents/processors/identity_llm_request_processor.d.ts +13 -0
- package/dist/types/agents/processors/instructions_llm_request_processor.d.ts +16 -0
- package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +13 -0
- package/dist/types/artifacts/file_artifact_service.d.ts +4 -0
- package/dist/types/auth/credential_service/base_credential_service.d.ts +3 -3
- package/dist/types/auth/credential_service/in_memory_credential_service.d.ts +3 -3
- package/dist/types/common.d.ts +20 -5
- package/dist/types/context/base_context_compactor.d.ts +24 -0
- package/dist/types/context/summarizers/base_summarizer.d.ts +19 -0
- package/dist/types/context/summarizers/llm_summarizer.d.ts +23 -0
- package/dist/types/context/token_based_context_compactor.d.ts +33 -0
- package/dist/types/context/truncating_context_compactor.d.ts +24 -0
- package/dist/types/events/compacted_event.d.ts +33 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/models/llm_response.d.ts +5 -1
- package/dist/types/plugins/base_plugin.d.ts +12 -13
- package/dist/types/plugins/logging_plugin.d.ts +9 -10
- package/dist/types/plugins/plugin_manager.d.ts +9 -10
- package/dist/types/plugins/security_plugin.d.ts +2 -2
- package/dist/types/runner/runner.d.ts +13 -0
- package/dist/types/sessions/database_session_service.d.ts +2 -1
- package/dist/types/sessions/db/operations.d.ts +3 -4
- package/dist/types/tools/base_tool.d.ts +3 -3
- package/dist/types/tools/base_toolset.d.ts +12 -3
- package/dist/types/tools/exit_loop_tool.d.ts +24 -0
- package/dist/types/tools/forwarding_artifact_service.d.ts +2 -2
- package/dist/types/tools/function_tool.d.ts +2 -2
- package/dist/types/tools/load_artifacts_tool.d.ts +21 -0
- package/dist/types/tools/load_memory_tool.d.ts +22 -0
- package/dist/types/tools/mcp/mcp_toolset.d.ts +1 -1
- package/dist/types/tools/preload_memory_tool.d.ts +23 -0
- package/dist/types/utils/logger.d.ts +5 -9
- package/dist/types/version.d.ts +1 -1
- package/dist/web/a2a/a2a_event.js +269 -0
- package/dist/web/a2a/a2a_remote_agent.js +193 -0
- package/dist/web/a2a/a2a_remote_agent_run_processor.js +175 -0
- package/dist/web/a2a/a2a_remote_agent_utils.js +131 -0
- package/dist/web/a2a/agent_card.js +340 -0
- package/dist/web/a2a/agent_executor.js +216 -0
- package/dist/web/a2a/agent_to_a2a.js +80 -0
- package/dist/web/a2a/event_converter_utils.js +201 -0
- package/dist/web/a2a/event_processor_utils.js +168 -0
- package/dist/web/a2a/executor_context.js +23 -0
- package/dist/web/a2a/metadata_converter_utils.js +108 -0
- package/dist/web/a2a/part_converter_utils.js +49 -34
- package/dist/web/agents/base_agent.js +3 -3
- package/dist/{esm/tools/tool_context.js → web/agents/context.js} +66 -11
- package/dist/web/agents/functions.js +2 -2
- package/dist/web/agents/llm_agent.js +31 -661
- package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +100 -0
- package/dist/web/agents/processors/basic_llm_request_processor.js +71 -0
- package/dist/web/agents/processors/code_execution_request_processor.js +365 -0
- package/dist/web/agents/{content_processor_utils.js → processors/content_processor_utils.js} +22 -2
- package/dist/web/agents/processors/content_request_processor.js +77 -0
- package/dist/web/agents/processors/context_compactor_request_processor.js +49 -0
- package/dist/web/agents/processors/identity_llm_request_processor.js +41 -0
- package/dist/web/agents/processors/instructions_llm_request_processor.js +72 -0
- package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +158 -0
- package/dist/web/artifacts/file_artifact_service.js +30 -3
- package/dist/web/common.js +44 -10
- package/dist/web/context/base_context_compactor.js +5 -0
- package/dist/web/context/summarizers/base_summarizer.js +5 -0
- package/dist/web/context/summarizers/llm_summarizer.js +74 -0
- package/dist/web/context/token_based_context_compactor.js +105 -0
- package/dist/web/context/truncating_context_compactor.js +28 -0
- package/dist/web/events/compacted_event.js +40 -0
- package/dist/web/index.js +13 -18
- package/dist/web/index.js.map +7 -0
- package/dist/web/memory/in_memory_memory_service.js +1 -1
- package/dist/web/models/llm_response.js +2 -0
- package/dist/web/plugins/base_plugin.js +1 -1
- package/dist/web/runner/runner.js +18 -10
- package/dist/web/sessions/database_session_service.js +4 -1
- package/dist/web/sessions/db/operations.js +32 -18
- package/dist/web/sessions/state.js +2 -2
- package/dist/web/tools/agent_tool.js +6 -5
- package/dist/web/tools/base_tool.js +3 -0
- package/dist/web/tools/base_toolset.js +11 -2
- package/dist/web/tools/exit_loop_tool.js +32 -0
- package/dist/web/tools/load_artifacts_tool.js +150 -0
- package/dist/web/tools/load_memory_tool.js +77 -0
- package/dist/web/tools/mcp/mcp_toolset.js +27 -5
- package/dist/web/tools/preload_memory_tool.js +75 -0
- package/dist/web/utils/logger.js +52 -54
- package/dist/web/version.js +1 -1
- package/package.json +7 -4
- package/dist/cjs/agents/callback_context.js +0 -101
- package/dist/esm/agents/callback_context.js +0 -71
- package/dist/types/agents/callback_context.d.ts +0 -42
- package/dist/web/agents/callback_context.js +0 -71
- /package/dist/cjs/agents/{base_llm_processor.js → processors/base_llm_processor.js} +0 -0
- /package/dist/esm/agents/{base_llm_processor.js → processors/base_llm_processor.js} +0 -0
- /package/dist/web/agents/{base_llm_processor.js → processors/base_llm_processor.js} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { RequestContext } from '@a2a-js/sdk/server';
|
|
7
|
+
import { Content } from '@google/genai';
|
|
8
|
+
import { Event } from '../events/event.js';
|
|
9
|
+
import { Session } from '../sessions/session.js';
|
|
10
|
+
/**
|
|
11
|
+
* The A2A Agent Executor context.
|
|
12
|
+
*/
|
|
13
|
+
export interface ExecutorContext {
|
|
14
|
+
userId: string;
|
|
15
|
+
sessionId: string;
|
|
16
|
+
appName: string;
|
|
17
|
+
readonlyState: Record<string, unknown>;
|
|
18
|
+
events: Event[];
|
|
19
|
+
userContent: Content;
|
|
20
|
+
requestContext: RequestContext;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates an A2A Agent Executor context from the given parameters.
|
|
24
|
+
* @param session The session.
|
|
25
|
+
* @param userContent The content of the user.
|
|
26
|
+
* @param requestContext The request context.
|
|
27
|
+
* @returns The A2A Agent Executor context.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createExecutorContext({ session, userContent, requestContext, }: {
|
|
30
|
+
session: Session;
|
|
31
|
+
userContent: Content;
|
|
32
|
+
requestContext: RequestContext;
|
|
33
|
+
}): ExecutorContext;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Event as AdkEvent } from '../events/event.js';
|
|
7
|
+
import { EventActions as AdkEventActions } from '../events/event_actions.js';
|
|
8
|
+
import { A2AEvent } from './a2a_event.js';
|
|
9
|
+
/**
|
|
10
|
+
* Keys for metadata that will be stored in A2A message metadata and related to ADK events.
|
|
11
|
+
*/
|
|
12
|
+
export declare enum A2AMetadataKeys {
|
|
13
|
+
APP_NAME = "adk_app_name",
|
|
14
|
+
USER_ID = "adk_user_id",
|
|
15
|
+
SESSION_ID = "adk_session_id",
|
|
16
|
+
INVOCATION_ID = "adk_invocation_id",
|
|
17
|
+
AUTHOR = "adk_author",
|
|
18
|
+
BRANCH = "adk_branch",
|
|
19
|
+
DATA_PART_TYPE = "adk_type",
|
|
20
|
+
PARTIAL = "adk_partial",
|
|
21
|
+
ESCALATE = "adk_escalate",
|
|
22
|
+
TRANSFER_TO_AGENT = "adk_transfer_to_agent",
|
|
23
|
+
IS_LONG_RUNNING = "adk_is_long_running",
|
|
24
|
+
THOUGHT = "adk_thought",
|
|
25
|
+
ERROR_CODE = "adk_error_code",
|
|
26
|
+
ERROR_MESSAGE = "adk_error_message",
|
|
27
|
+
CITATION_METADATA = "adk_citation_metadata",
|
|
28
|
+
GROUNDING_METADATA = "adk_grounding_metadata",
|
|
29
|
+
USAGE_METADATA = "adk_usage_metadata",
|
|
30
|
+
CUSTOM_METADATA = "adk_custom_metadata",
|
|
31
|
+
VIDEO_METADATA = "adk_video_metadata"
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Keys for metadata that will be stored in ADK event metadata and related to A2A messages.
|
|
35
|
+
*/
|
|
36
|
+
export declare enum AdkMetadataKeys {
|
|
37
|
+
TASK_ID = "a2a:task_id",
|
|
38
|
+
CONTEXT_ID = "a2a:context_id"
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates ADK Event metadata from an A2A Event.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAdkEventMetadata(a2aEvent: A2AEvent): Record<string, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* Creates A2A Event metadata from an ADK Event.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getA2AEventMetadata(adkEvent: AdkEvent, { appName, userId, sessionId, }: {
|
|
48
|
+
appName: string;
|
|
49
|
+
userId: string;
|
|
50
|
+
sessionId: string;
|
|
51
|
+
}): Record<string, unknown>;
|
|
52
|
+
/**
|
|
53
|
+
* Creates A2A Session metadata from ADK Event invocation metadata.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getA2ASessionMetadata({ appName, userId, sessionId, }: {
|
|
56
|
+
appName: string;
|
|
57
|
+
userId: string;
|
|
58
|
+
sessionId: string;
|
|
59
|
+
}): Record<string, unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* Creates A2A Event metadata from ADK Event actions.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getA2AEventMetadataFromActions(actions: AdkEventActions): Record<string, unknown>;
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { DataPart as A2ADataPart, FilePart as A2AFilePart, Part as A2APart, TextPart as A2ATextPart } from '@a2a-js/sdk';
|
|
7
|
-
import { Part as GenAIPart } from '@google/genai';
|
|
6
|
+
import { DataPart as A2ADataPart, FilePart as A2AFilePart, Part as A2APart, TextPart as A2ATextPart, Message } from '@a2a-js/sdk';
|
|
7
|
+
import { Content as GenAIContent, Part as GenAIPart } from '@google/genai';
|
|
8
8
|
/**
|
|
9
9
|
* Converts GenAI Parts to A2A Parts.
|
|
10
10
|
*/
|
|
11
|
-
export declare function toA2AParts(parts
|
|
11
|
+
export declare function toA2AParts(parts?: GenAIPart[], longRunningToolIDs?: string[]): A2APart[];
|
|
12
12
|
/**
|
|
13
13
|
* Converts a GenAI Part to an A2A Part.
|
|
14
14
|
*/
|
|
@@ -25,6 +25,7 @@ export declare function toA2AFilePart(part: GenAIPart): A2APart;
|
|
|
25
25
|
* Converts a GenAI Data Part to an A2A Data Part.
|
|
26
26
|
*/
|
|
27
27
|
export declare function toA2ADataPart(part: GenAIPart, longRunningToolIDs?: string[]): A2APart;
|
|
28
|
+
export declare function toGenAIContent(a2aMessage: Message): GenAIContent;
|
|
28
29
|
/**
|
|
29
30
|
* Converts an A2A Part to a GenAI Part.
|
|
30
31
|
*/
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Content } from '@google/genai';
|
|
7
7
|
import { Event } from '../events/event.js';
|
|
8
|
-
import {
|
|
8
|
+
import { Context } from './context.js';
|
|
9
9
|
import { InvocationContext } from './invocation_context.js';
|
|
10
10
|
/**
|
|
11
11
|
* A single callback function for an agent.
|
|
12
12
|
*/
|
|
13
|
-
export type SingleAgentCallback = (context:
|
|
13
|
+
export type SingleAgentCallback = (context: Context) => Promise<Content | undefined> | (Content | undefined);
|
|
14
14
|
/**
|
|
15
15
|
* Type for before agent callbacks, which can be a single callback or
|
|
16
16
|
* an array of callbacks.
|
|
@@ -3,34 +3,69 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { InvocationContext } from '../agents/invocation_context.js';
|
|
6
|
+
import { Part } from '@google/genai';
|
|
8
7
|
import { AuthCredential } from '../auth/auth_credential.js';
|
|
9
8
|
import { AuthConfig } from '../auth/auth_tool.js';
|
|
10
9
|
import { EventActions } from '../events/event_actions.js';
|
|
11
10
|
import { SearchMemoryResponse } from '../memory/base_memory_service.js';
|
|
11
|
+
import { State } from '../sessions/state.js';
|
|
12
12
|
import { ToolConfirmation } from '../tools/tool_confirmation.js';
|
|
13
|
-
|
|
13
|
+
import { InvocationContext } from './invocation_context.js';
|
|
14
|
+
import { ReadonlyContext } from './readonly_context.js';
|
|
15
|
+
/**
|
|
16
|
+
* The context of various callbacks within an agent run.
|
|
17
|
+
*
|
|
18
|
+
* This class provides the context for callbacks and tool invocations, including
|
|
19
|
+
* access to the invocation context, function call ID, event actions, and
|
|
20
|
+
* authentication response. It also provides methods for requesting credentials,
|
|
21
|
+
* retrieving authentication responses, loading and saving artifacts, and
|
|
22
|
+
* searching memory.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Context extends ReadonlyContext {
|
|
25
|
+
private readonly _state;
|
|
26
|
+
readonly eventActions: EventActions;
|
|
14
27
|
readonly functionCallId?: string;
|
|
15
28
|
toolConfirmation?: ToolConfirmation;
|
|
16
29
|
/**
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
30
|
+
* @param options The configuration options for the Context.
|
|
31
|
+
* @param options.invocationContext The invocation context.
|
|
32
|
+
* @param options.eventActions The event actions of the current call.
|
|
33
|
+
* @param options.functionCallId The function call id of the current tool call.
|
|
20
34
|
* This id was returned in the function call event from LLM to identify a
|
|
21
35
|
* function call. If LLM didn't return this id, ADK will assign one to it.
|
|
22
36
|
* This id is used to map function call response to the original function
|
|
23
37
|
* call.
|
|
24
|
-
* @param
|
|
38
|
+
* @param options.toolConfirmation The tool confirmation of the current tool
|
|
25
39
|
* call.
|
|
26
40
|
*/
|
|
27
|
-
constructor(
|
|
41
|
+
constructor(options: {
|
|
28
42
|
invocationContext: InvocationContext;
|
|
29
43
|
eventActions?: EventActions;
|
|
30
44
|
functionCallId?: string;
|
|
31
45
|
toolConfirmation?: ToolConfirmation;
|
|
32
46
|
});
|
|
47
|
+
/**
|
|
48
|
+
* The delta-aware state of the current session.
|
|
49
|
+
*/
|
|
50
|
+
get state(): State;
|
|
33
51
|
get actions(): EventActions;
|
|
52
|
+
/**
|
|
53
|
+
* Loads an artifact attached to the current session.
|
|
54
|
+
*
|
|
55
|
+
* @param filename The filename of the artifact.
|
|
56
|
+
* @param version The version of the artifact. If not provided, the latest
|
|
57
|
+
* version will be used.
|
|
58
|
+
* @return A promise that resolves to the loaded artifact.
|
|
59
|
+
*/
|
|
60
|
+
loadArtifact(filename: string, version?: number): Promise<Part | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Saves an artifact attached to the current session.
|
|
63
|
+
*
|
|
64
|
+
* @param filename The filename of the artifact.
|
|
65
|
+
* @param artifact The artifact to save.
|
|
66
|
+
* @return A promise that resolves to the version of the saved artifact.
|
|
67
|
+
*/
|
|
68
|
+
saveArtifact(filename: string, artifact: Part): Promise<number>;
|
|
34
69
|
requestCredential(authConfig: AuthConfig): void;
|
|
35
70
|
/**
|
|
36
71
|
* Gets the auth credential for the given auth config.
|
|
@@ -15,10 +15,10 @@ import { LlmRequest } from '../models/llm_request.js';
|
|
|
15
15
|
import { LlmResponse } from '../models/llm_response.js';
|
|
16
16
|
import { BaseTool } from '../tools/base_tool.js';
|
|
17
17
|
import { BaseToolset } from '../tools/base_toolset.js';
|
|
18
|
-
import {
|
|
18
|
+
import { Context } from './context.js';
|
|
19
19
|
import { BaseAgent, BaseAgentConfig } from './base_agent.js';
|
|
20
|
-
import { BaseLlmRequestProcessor, BaseLlmResponseProcessor } from './base_llm_processor.js';
|
|
21
|
-
import {
|
|
20
|
+
import { BaseLlmRequestProcessor, BaseLlmResponseProcessor } from './processors/base_llm_processor.js';
|
|
21
|
+
import { BaseContextCompactor } from '../context/base_context_compactor.js';
|
|
22
22
|
import { InvocationContext } from './invocation_context.js';
|
|
23
23
|
import { ReadonlyContext } from './readonly_context.js';
|
|
24
24
|
/**
|
|
@@ -36,7 +36,7 @@ export type InstructionProvider = (context: ReadonlyContext) => string | Promise
|
|
|
36
36
|
* will be skipped and the provided content will be returned to user.
|
|
37
37
|
*/
|
|
38
38
|
export type SingleBeforeModelCallback = (params: {
|
|
39
|
-
context:
|
|
39
|
+
context: Context;
|
|
40
40
|
request: LlmRequest;
|
|
41
41
|
}) => LlmResponse | undefined | Promise<LlmResponse | undefined>;
|
|
42
42
|
/**
|
|
@@ -56,7 +56,7 @@ export type BeforeModelCallback = SingleBeforeModelCallback | SingleBeforeModelC
|
|
|
56
56
|
* user.
|
|
57
57
|
*/
|
|
58
58
|
export type SingleAfterModelCallback = (params: {
|
|
59
|
-
context:
|
|
59
|
+
context: Context;
|
|
60
60
|
response: LlmResponse;
|
|
61
61
|
}) => LlmResponse | undefined | Promise<LlmResponse | undefined>;
|
|
62
62
|
/**
|
|
@@ -71,14 +71,14 @@ export type AfterModelCallback = SingleAfterModelCallback | SingleAfterModelCall
|
|
|
71
71
|
*
|
|
72
72
|
* @param params.tool The tool to be called.
|
|
73
73
|
* @param params.args The arguments to the tool.
|
|
74
|
-
* @param params.context
|
|
74
|
+
* @param params.context Context for the tool call.
|
|
75
75
|
* @returns The tool response. When present, the returned tool response will
|
|
76
76
|
* be used and the framework will skip calling the actual tool.
|
|
77
77
|
*/
|
|
78
78
|
export type SingleBeforeToolCallback = (params: {
|
|
79
79
|
tool: BaseTool;
|
|
80
80
|
args: Record<string, unknown>;
|
|
81
|
-
context:
|
|
81
|
+
context: Context;
|
|
82
82
|
}) => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
|
|
83
83
|
/**
|
|
84
84
|
* A single callback or a list of callbacks.
|
|
@@ -92,14 +92,14 @@ export type BeforeToolCallback = SingleBeforeToolCallback | SingleBeforeToolCall
|
|
|
92
92
|
*
|
|
93
93
|
* @param params.tool The tool to be called.
|
|
94
94
|
* @param params.args The arguments to the tool.
|
|
95
|
-
* @param params.context
|
|
95
|
+
* @param params.context Context for the tool call.
|
|
96
96
|
* @param params.response The response from the tool.
|
|
97
97
|
* @returns When present, the returned record will be used as tool result.
|
|
98
98
|
*/
|
|
99
99
|
export type SingleAfterToolCallback = (params: {
|
|
100
100
|
tool: BaseTool;
|
|
101
101
|
args: Record<string, unknown>;
|
|
102
|
-
context:
|
|
102
|
+
context: Context;
|
|
103
103
|
response: Record<string, unknown>;
|
|
104
104
|
}) => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
|
|
105
105
|
/**
|
|
@@ -201,32 +201,15 @@ export interface LlmAgentConfig extends BaseAgentConfig {
|
|
|
201
201
|
*/
|
|
202
202
|
responseProcessors?: BaseLlmResponseProcessor[];
|
|
203
203
|
/**
|
|
204
|
-
*
|
|
204
|
+
* A list of context compactors to evaluate in priority order.
|
|
205
|
+
* Modifies the session history to keep context overhead within limits.
|
|
205
206
|
*/
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
declare class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
209
|
-
/** Handles tool confirmation information to build the LLM request. */
|
|
210
|
-
runAsync(invocationContext: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
211
|
-
}
|
|
212
|
-
export declare const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR: RequestConfirmationLlmRequestProcessor;
|
|
213
|
-
/**
|
|
214
|
-
* Processor for code execution responses.
|
|
215
|
-
*/
|
|
216
|
-
declare class CodeExecutionResponseProcessor implements BaseLlmResponseProcessor {
|
|
207
|
+
contextCompactors?: BaseContextCompactor[];
|
|
217
208
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* @param invocationContext The invocation context
|
|
221
|
-
* @param llmResponse The LLM response to process
|
|
222
|
-
* @returns An async generator yielding events
|
|
209
|
+
* Instructs the agent to make a plan and execute it step by step.
|
|
223
210
|
*/
|
|
224
|
-
|
|
211
|
+
codeExecutor?: BaseCodeExecutor;
|
|
225
212
|
}
|
|
226
|
-
/**
|
|
227
|
-
* The exported response processor instance.
|
|
228
|
-
*/
|
|
229
|
-
export declare const responseProcessor: CodeExecutionResponseProcessor;
|
|
230
213
|
/**
|
|
231
214
|
* A unique symbol to identify ADK agent classes.
|
|
232
215
|
* Defined once and shared by all LlmAgent instances.
|
|
@@ -39,7 +39,7 @@ export declare class LoopAgent extends BaseAgent {
|
|
|
39
39
|
* A unique symbol to identify ADK loop agent class.
|
|
40
40
|
*/
|
|
41
41
|
readonly [LOOP_AGENT_SIGNATURE_SYMBOL] = true;
|
|
42
|
-
|
|
42
|
+
readonly maxIterations: number;
|
|
43
43
|
constructor(config: LoopAgentConfig);
|
|
44
44
|
protected runAsyncImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
45
45
|
protected runLiveImpl(_context: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Event } from '../../events/event.js';
|
|
7
|
+
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
9
|
+
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
export declare class AgentTransferLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
11
|
+
private readonly toolName;
|
|
12
|
+
private readonly tool;
|
|
13
|
+
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
14
|
+
private buildTargetAgentsInfo;
|
|
15
|
+
private buildTargetAgentsInstructions;
|
|
16
|
+
private getTransferTargets;
|
|
17
|
+
}
|
|
18
|
+
export declare const AGENT_TRANSFER_LLM_REQUEST_PROCESSOR: AgentTransferLlmRequestProcessor;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { Event } from '../../events/event.js';
|
|
7
|
+
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
|
+
import { LlmResponse } from '../../models/llm_response.js';
|
|
9
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
10
10
|
/**
|
|
11
11
|
* Base class for LLM request processor.
|
|
12
12
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Event } from '../../events/event.js';
|
|
7
|
+
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
9
|
+
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
export declare class BasicLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
11
|
+
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const BASIC_LLM_REQUEST_PROCESSOR: BasicLlmRequestProcessor;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Event } from '../../events/event.js';
|
|
7
|
+
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
|
+
import { LlmResponse } from '../../models/llm_response.js';
|
|
9
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
10
|
+
import { BaseLlmRequestProcessor, BaseLlmResponseProcessor } from './base_llm_processor.js';
|
|
11
|
+
/**
|
|
12
|
+
* Processes code execution requests.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CodeExecutionRequestProcessor extends BaseLlmRequestProcessor {
|
|
15
|
+
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Processor for code execution responses.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CodeExecutionResponseProcessor implements BaseLlmResponseProcessor {
|
|
21
|
+
/**
|
|
22
|
+
* Processes the LLM response asynchronously.
|
|
23
|
+
*
|
|
24
|
+
* @param invocationContext The invocation context
|
|
25
|
+
* @param llmResponse The LLM response to process
|
|
26
|
+
* @returns An async generator yielding events
|
|
27
|
+
*/
|
|
28
|
+
runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event, void, unknown>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The exported response processor instance.
|
|
32
|
+
*/
|
|
33
|
+
export declare const responseProcessor: CodeExecutionResponseProcessor;
|
|
34
|
+
export declare const CODE_EXECUTION_REQUEST_PROCESSOR: CodeExecutionRequestProcessor;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Event } from '../../events/event.js';
|
|
7
|
+
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
9
|
+
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
export declare class ContentRequestProcessor implements BaseLlmRequestProcessor {
|
|
11
|
+
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const CONTENT_REQUEST_PROCESSOR: ContentRequestProcessor;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { BaseContextCompactor } from '../../context/base_context_compactor.js';
|
|
7
|
+
import { Event } from '../../events/event.js';
|
|
8
|
+
import { LlmRequest } from '../../models/llm_request.js';
|
|
9
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
10
|
+
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
11
|
+
/**
|
|
12
|
+
* A processor that evaluates a set of compactors to optionally compact
|
|
13
|
+
* the conversation history (events) prior to generating an LLM request.
|
|
14
|
+
*
|
|
15
|
+
* It evaluates each compactor in priority order. The first one that indicates
|
|
16
|
+
* it should compact will perform the compaction and iteration stops.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ContextCompactorRequestProcessor implements BaseLlmRequestProcessor {
|
|
19
|
+
private compactors;
|
|
20
|
+
constructor(compactors: BaseContextCompactor[]);
|
|
21
|
+
runAsync(invocationContext: InvocationContext, _llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Event } from '../../events/event.js';
|
|
7
|
+
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
9
|
+
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
export declare class IdentityLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
11
|
+
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, undefined>;
|
|
12
|
+
}
|
|
13
|
+
export declare const IDENTITY_LLM_REQUEST_PROCESSOR: IdentityLlmRequestProcessor;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Event } from '../../events/event.js';
|
|
7
|
+
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
9
|
+
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
export declare class InstructionsLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
11
|
+
/**
|
|
12
|
+
* Handles instructions and global instructions for LLM flow.
|
|
13
|
+
*/
|
|
14
|
+
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
15
|
+
}
|
|
16
|
+
export declare const INSTRUCTIONS_LLM_REQUEST_PROCESSOR: InstructionsLlmRequestProcessor;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Event } from '../../events/event.js';
|
|
7
|
+
import { InvocationContext } from '../invocation_context.js';
|
|
8
|
+
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
9
|
+
export declare class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
10
|
+
/** Handles tool confirmation information to build the LLM request. */
|
|
11
|
+
runAsync(invocationContext: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR: RequestConfirmationLlmRequestProcessor;
|
|
@@ -41,3 +41,7 @@ export declare class FileArtifactService implements BaseArtifactService {
|
|
|
41
41
|
listArtifactVersions({ userId, sessionId, filename, }: ListVersionsRequest): Promise<ArtifactVersion[]>;
|
|
42
42
|
getArtifactVersion({ userId, sessionId, filename, version, }: LoadArtifactRequest): Promise<ArtifactVersion | undefined>;
|
|
43
43
|
}
|
|
44
|
+
export declare function assertSafeSegment(value: string, label: string): void;
|
|
45
|
+
export declare function assertInsideRoot(resolvedPath: string, rootDir: string, label: string): void;
|
|
46
|
+
export declare function getUserRoot(rootDir: string, userId: string): string;
|
|
47
|
+
export declare function getSessionArtifactsDir(baseRoot: string, sessionId: string): string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { Context } from '../../agents/context.js';
|
|
7
7
|
import { AuthCredential } from '../auth_credential.js';
|
|
8
8
|
import { AuthConfig } from '../auth_tool.js';
|
|
9
9
|
/**
|
|
@@ -22,6 +22,6 @@ export interface BaseCredentialService {
|
|
|
22
22
|
* trying to load the credential.
|
|
23
23
|
* @return A promise that resolves to the credential saved in the store.
|
|
24
24
|
*/
|
|
25
|
-
loadCredential(authConfig: AuthConfig, toolContext:
|
|
26
|
-
saveCredential(authConfig: AuthConfig, toolContext:
|
|
25
|
+
loadCredential(authConfig: AuthConfig, toolContext: Context): Promise<AuthCredential | undefined>;
|
|
26
|
+
saveCredential(authConfig: AuthConfig, toolContext: Context): Promise<void>;
|
|
27
27
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { Context } from '../../agents/context.js';
|
|
7
7
|
import { AuthCredential } from '../auth_credential.js';
|
|
8
8
|
import { AuthConfig } from '../auth_tool.js';
|
|
9
9
|
import { BaseCredentialService } from './base_credential_service.js';
|
|
@@ -13,7 +13,7 @@ import { BaseCredentialService } from './base_credential_service.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export declare class InMemoryCredentialService implements BaseCredentialService {
|
|
15
15
|
private readonly credentials;
|
|
16
|
-
loadCredential(authConfig: AuthConfig, toolContext:
|
|
17
|
-
saveCredential(authConfig: AuthConfig, toolContext:
|
|
16
|
+
loadCredential(authConfig: AuthConfig, toolContext: Context): Promise<AuthCredential | undefined>;
|
|
17
|
+
saveCredential(authConfig: AuthConfig, toolContext: Context): Promise<void>;
|
|
18
18
|
private getBucketForCurrentContext;
|
|
19
19
|
}
|
package/dist/types/common.d.ts
CHANGED
|
@@ -7,8 +7,7 @@ export { ActiveStreamingTool } from './agents/active_streaming_tool.js';
|
|
|
7
7
|
export type { ActiveStreamingToolParams } from './agents/active_streaming_tool.js';
|
|
8
8
|
export { BaseAgent, isBaseAgent } from './agents/base_agent.js';
|
|
9
9
|
export type { AfterAgentCallback, BaseAgentConfig, BeforeAgentCallback, SingleAgentCallback, } from './agents/base_agent.js';
|
|
10
|
-
export {
|
|
11
|
-
export { CallbackContext } from './agents/callback_context.js';
|
|
10
|
+
export { Context } from './agents/context.js';
|
|
12
11
|
export { functionsExportedForTestingOnly } from './agents/functions.js';
|
|
13
12
|
export { InvocationContext } from './agents/invocation_context.js';
|
|
14
13
|
export type { InvocationContextParams } from './agents/invocation_context.js';
|
|
@@ -19,6 +18,9 @@ export type { AfterModelCallback, AfterToolCallback, BeforeModelCallback, Before
|
|
|
19
18
|
export { LoopAgent, isLoopAgent } from './agents/loop_agent.js';
|
|
20
19
|
export type { LoopAgentConfig } from './agents/loop_agent.js';
|
|
21
20
|
export { ParallelAgent, isParallelAgent } from './agents/parallel_agent.js';
|
|
21
|
+
export { BaseLlmRequestProcessor, BaseLlmResponseProcessor, } from './agents/processors/base_llm_processor.js';
|
|
22
|
+
export { CONTENT_REQUEST_PROCESSOR, ContentRequestProcessor, } from './agents/processors/content_request_processor.js';
|
|
23
|
+
export { ContextCompactorRequestProcessor } from './agents/processors/context_compactor_request_processor.js';
|
|
22
24
|
export { ReadonlyContext } from './agents/readonly_context.js';
|
|
23
25
|
export { StreamingMode } from './agents/run_config.js';
|
|
24
26
|
export type { RunConfig } from './agents/run_config.js';
|
|
@@ -35,6 +37,16 @@ export { BaseCodeExecutor } from './code_executors/base_code_executor.js';
|
|
|
35
37
|
export type { ExecuteCodeParams } from './code_executors/base_code_executor.js';
|
|
36
38
|
export { BuiltInCodeExecutor } from './code_executors/built_in_code_executor.js';
|
|
37
39
|
export type { CodeExecutionInput, CodeExecutionResult, File, } from './code_executors/code_execution_utils.js';
|
|
40
|
+
export type { BaseContextCompactor } from './context/base_context_compactor.js';
|
|
41
|
+
export type { BaseSummarizer } from './context/summarizers/base_summarizer.js';
|
|
42
|
+
export { LlmSummarizer } from './context/summarizers/llm_summarizer.js';
|
|
43
|
+
export type { LlmSummarizerOptions } from './context/summarizers/llm_summarizer.js';
|
|
44
|
+
export { TokenBasedContextCompactor } from './context/token_based_context_compactor.js';
|
|
45
|
+
export type { TokenBasedContextCompactorOptions } from './context/token_based_context_compactor.js';
|
|
46
|
+
export { TruncatingContextCompactor } from './context/truncating_context_compactor.js';
|
|
47
|
+
export type { TruncatingContextCompactorOptions } from './context/truncating_context_compactor.js';
|
|
48
|
+
export { isCompactedEvent } from './events/compacted_event.js';
|
|
49
|
+
export type { CompactedEvent } from './events/compacted_event.js';
|
|
38
50
|
export { createEvent, getFunctionCalls, getFunctionResponses, hasTrailingCodeExecutionResult, isFinalResponse, stringifyContent, } from './events/event.js';
|
|
39
51
|
export type { Event } from './events/event.js';
|
|
40
52
|
export { createEventActions } from './events/event_actions.js';
|
|
@@ -62,7 +74,7 @@ export { PluginManager } from './plugins/plugin_manager.js';
|
|
|
62
74
|
export { InMemoryPolicyEngine, PolicyOutcome, REQUEST_CONFIRMATION_FUNCTION_CALL_NAME, SecurityPlugin, getAskUserConfirmationFunctionCalls, } from './plugins/security_plugin.js';
|
|
63
75
|
export type { BasePolicyEngine, PolicyCheckResult, ToolCallPolicyContext, } from './plugins/security_plugin.js';
|
|
64
76
|
export { InMemoryRunner } from './runner/in_memory_runner.js';
|
|
65
|
-
export { Runner } from './runner/runner.js';
|
|
77
|
+
export { Runner, isRunner } from './runner/runner.js';
|
|
66
78
|
export type { RunnerConfig } from './runner/runner.js';
|
|
67
79
|
export { BaseSessionService } from './sessions/base_session_service.js';
|
|
68
80
|
export type { AppendEventRequest, CreateSessionRequest, DeleteSessionRequest, GetSessionConfig, GetSessionRequest, ListSessionsRequest, ListSessionsResponse, } from './sessions/base_session_service.js';
|
|
@@ -74,14 +86,17 @@ export { AgentTool, isAgentTool } from './tools/agent_tool.js';
|
|
|
74
86
|
export type { AgentToolConfig } from './tools/agent_tool.js';
|
|
75
87
|
export { BaseTool, isBaseTool } from './tools/base_tool.js';
|
|
76
88
|
export type { BaseToolParams, RunAsyncToolRequest, ToolProcessLlmRequest, } from './tools/base_tool.js';
|
|
77
|
-
export { BaseToolset } from './tools/base_toolset.js';
|
|
89
|
+
export { BaseToolset, isBaseToolset } from './tools/base_toolset.js';
|
|
78
90
|
export type { ToolPredicate } from './tools/base_toolset.js';
|
|
91
|
+
export { EXIT_LOOP, ExitLoopTool } from './tools/exit_loop_tool.js';
|
|
79
92
|
export { FunctionTool, isFunctionTool } from './tools/function_tool.js';
|
|
80
93
|
export type { ToolExecuteArgument, ToolExecuteFunction, ToolInputParameters, ToolOptions, } from './tools/function_tool.js';
|
|
81
94
|
export { GOOGLE_SEARCH, GoogleSearchTool } from './tools/google_search_tool.js';
|
|
95
|
+
export { LOAD_ARTIFACTS, LoadArtifactsTool, } from './tools/load_artifacts_tool.js';
|
|
96
|
+
export { LOAD_MEMORY, LoadMemoryTool } from './tools/load_memory_tool.js';
|
|
82
97
|
export { LongRunningFunctionTool } from './tools/long_running_tool.js';
|
|
98
|
+
export { PRELOAD_MEMORY, PreloadMemoryTool, } from './tools/preload_memory_tool.js';
|
|
83
99
|
export { ToolConfirmation } from './tools/tool_confirmation.js';
|
|
84
|
-
export { ToolContext } from './tools/tool_context.js';
|
|
85
100
|
export { LogLevel, getLogger, setLogLevel, setLogger } from './utils/logger.js';
|
|
86
101
|
export type { Logger } from './utils/logger.js';
|
|
87
102
|
export { isGemini2OrAbove } from './utils/model_name.js';
|