@iqai/adk 0.1.10 → 0.1.12
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +85 -22
- package/dist/index.d.ts +85 -22
- package/dist/index.js +30 -16
- package/dist/index.mjs +30 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @iqai/adk
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1b9f517: - Add support for withMemory and withArtifactService methods to agent builder instead of passing it from withSession
|
|
8
|
+
|
|
9
|
+
## 0.1.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4a93c0a: Makes schema optional for createTool function
|
|
14
|
+
|
|
3
15
|
## 0.1.10
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -908,7 +908,26 @@ declare abstract class BaseTool {
|
|
|
908
908
|
/**
|
|
909
909
|
* Configuration for creating a tool
|
|
910
910
|
*/
|
|
911
|
-
interface CreateToolConfig<T extends Record<string, any>> {
|
|
911
|
+
interface CreateToolConfig<T extends Record<string, any> = Record<string, never>> {
|
|
912
|
+
/** The name of the tool */
|
|
913
|
+
name: string;
|
|
914
|
+
/** A description of what the tool does */
|
|
915
|
+
description: string;
|
|
916
|
+
/** Zod schema for validating tool arguments (optional) */
|
|
917
|
+
schema?: z.ZodSchema<T>;
|
|
918
|
+
/** The function to execute (can be sync or async) */
|
|
919
|
+
fn: (args: T, context?: ToolContext) => any;
|
|
920
|
+
/** Whether the tool is a long running operation */
|
|
921
|
+
isLongRunning?: boolean;
|
|
922
|
+
/** Whether the tool execution should be retried on failure */
|
|
923
|
+
shouldRetryOnFailure?: boolean;
|
|
924
|
+
/** Maximum retry attempts */
|
|
925
|
+
maxRetryAttempts?: number;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Configuration for creating a tool with schema
|
|
929
|
+
*/
|
|
930
|
+
interface CreateToolConfigWithSchema<T extends Record<string, any>> {
|
|
912
931
|
/** The name of the tool */
|
|
913
932
|
name: string;
|
|
914
933
|
/** A description of what the tool does */
|
|
@@ -924,6 +943,23 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
924
943
|
/** Maximum retry attempts */
|
|
925
944
|
maxRetryAttempts?: number;
|
|
926
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Configuration for creating a tool without schema (no parameters)
|
|
948
|
+
*/
|
|
949
|
+
interface CreateToolConfigWithoutSchema {
|
|
950
|
+
/** The name of the tool */
|
|
951
|
+
name: string;
|
|
952
|
+
/** A description of what the tool does */
|
|
953
|
+
description: string;
|
|
954
|
+
/** The function to execute (can be sync or async) */
|
|
955
|
+
fn: (args: Record<string, never>, context?: ToolContext) => any;
|
|
956
|
+
/** Whether the tool is a long running operation */
|
|
957
|
+
isLongRunning?: boolean;
|
|
958
|
+
/** Whether the tool execution should be retried on failure */
|
|
959
|
+
shouldRetryOnFailure?: boolean;
|
|
960
|
+
/** Maximum retry attempts */
|
|
961
|
+
maxRetryAttempts?: number;
|
|
962
|
+
}
|
|
927
963
|
/**
|
|
928
964
|
* Creates a tool from a configuration object.
|
|
929
965
|
*
|
|
@@ -942,6 +978,7 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
942
978
|
* import { createTool } from '@iqai/adk';
|
|
943
979
|
* import { z } from 'zod';
|
|
944
980
|
*
|
|
981
|
+
* // Tool with parameters
|
|
945
982
|
* const calculatorTool = createTool({
|
|
946
983
|
* name: 'calculator',
|
|
947
984
|
* description: 'Performs basic arithmetic operations',
|
|
@@ -960,9 +997,17 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
960
997
|
* }
|
|
961
998
|
* }
|
|
962
999
|
* });
|
|
1000
|
+
*
|
|
1001
|
+
* // Tool without parameters (schema is optional)
|
|
1002
|
+
* const timestampTool = createTool({
|
|
1003
|
+
* name: 'timestamp',
|
|
1004
|
+
* description: 'Gets the current timestamp',
|
|
1005
|
+
* fn: () => ({ timestamp: Date.now() })
|
|
1006
|
+
* });
|
|
963
1007
|
* ```
|
|
964
1008
|
*/
|
|
965
|
-
declare function createTool<T extends Record<string, any>>(config:
|
|
1009
|
+
declare function createTool<T extends Record<string, any>>(config: CreateToolConfigWithSchema<T>): BaseTool;
|
|
1010
|
+
declare function createTool(config: CreateToolConfigWithoutSchema): BaseTool;
|
|
966
1011
|
|
|
967
1012
|
/**
|
|
968
1013
|
* A tool that wraps a user-defined TypeScript function.
|
|
@@ -1812,7 +1857,9 @@ declare function getMcpTools(config: McpConfig, toolFilter?: string[] | ((tool:
|
|
|
1812
1857
|
type index$6_BaseTool = BaseTool;
|
|
1813
1858
|
declare const index$6_BaseTool: typeof BaseTool;
|
|
1814
1859
|
type index$6_BuildFunctionDeclarationOptions = BuildFunctionDeclarationOptions;
|
|
1815
|
-
type index$6_CreateToolConfig<T extends Record<string, any>> = CreateToolConfig<T>;
|
|
1860
|
+
type index$6_CreateToolConfig<T extends Record<string, any> = Record<string, never>> = CreateToolConfig<T>;
|
|
1861
|
+
type index$6_CreateToolConfigWithSchema<T extends Record<string, any>> = CreateToolConfigWithSchema<T>;
|
|
1862
|
+
type index$6_CreateToolConfigWithoutSchema = CreateToolConfigWithoutSchema;
|
|
1816
1863
|
type index$6_ExitLoopTool = ExitLoopTool;
|
|
1817
1864
|
declare const index$6_ExitLoopTool: typeof ExitLoopTool;
|
|
1818
1865
|
type index$6_FileOperationsTool = FileOperationsTool;
|
|
@@ -1874,7 +1921,7 @@ declare const index$6_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
|
|
|
1874
1921
|
declare const index$6_mcpSchemaToParameters: typeof mcpSchemaToParameters;
|
|
1875
1922
|
declare const index$6_normalizeJsonSchema: typeof normalizeJsonSchema;
|
|
1876
1923
|
declare namespace index$6 {
|
|
1877
|
-
export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntentSwaps as McpNearIntentSwaps, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
|
|
1924
|
+
export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, type index$6_CreateToolConfigWithSchema as CreateToolConfigWithSchema, type index$6_CreateToolConfigWithoutSchema as CreateToolConfigWithoutSchema, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntentSwaps as McpNearIntentSwaps, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
|
|
1878
1925
|
}
|
|
1879
1926
|
|
|
1880
1927
|
/**
|
|
@@ -3854,14 +3901,11 @@ interface AgentBuilderConfig {
|
|
|
3854
3901
|
rootNode?: string;
|
|
3855
3902
|
}
|
|
3856
3903
|
/**
|
|
3857
|
-
* Session configuration
|
|
3904
|
+
* Session configuration options
|
|
3858
3905
|
*/
|
|
3859
|
-
interface
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
appName: string;
|
|
3863
|
-
memoryService?: BaseMemoryService;
|
|
3864
|
-
artifactService?: BaseArtifactService;
|
|
3906
|
+
interface SessionOptions {
|
|
3907
|
+
userId?: string;
|
|
3908
|
+
appName?: string;
|
|
3865
3909
|
}
|
|
3866
3910
|
/**
|
|
3867
3911
|
* Message part interface for flexible message input
|
|
@@ -3918,6 +3962,15 @@ type AgentType = "llm" | "sequential" | "parallel" | "loop" | "langgraph";
|
|
|
3918
3962
|
* .withInstruction("You are a research assistant")
|
|
3919
3963
|
* .build();
|
|
3920
3964
|
*
|
|
3965
|
+
* // With memory and artifact services
|
|
3966
|
+
* const { runner } = await AgentBuilder
|
|
3967
|
+
* .create("persistent-agent")
|
|
3968
|
+
* .withModel("gemini-2.5-flash")
|
|
3969
|
+
* .withMemory(new RedisMemoryService())
|
|
3970
|
+
* .withArtifactService(new S3ArtifactService())
|
|
3971
|
+
* .withSession(new DatabaseSessionService(), { userId: "user123", appName: "myapp" })
|
|
3972
|
+
* .build();
|
|
3973
|
+
*
|
|
3921
3974
|
* // Multi-agent workflow
|
|
3922
3975
|
* const { runner } = await AgentBuilder
|
|
3923
3976
|
* .create("workflow")
|
|
@@ -3928,6 +3981,8 @@ type AgentType = "llm" | "sequential" | "parallel" | "loop" | "langgraph";
|
|
|
3928
3981
|
declare class AgentBuilder {
|
|
3929
3982
|
private config;
|
|
3930
3983
|
private sessionConfig?;
|
|
3984
|
+
private memoryService?;
|
|
3985
|
+
private artifactService?;
|
|
3931
3986
|
private agentType;
|
|
3932
3987
|
/**
|
|
3933
3988
|
* Private constructor - use static create() method
|
|
@@ -4004,21 +4059,29 @@ declare class AgentBuilder {
|
|
|
4004
4059
|
/**
|
|
4005
4060
|
* Configure session management with optional smart defaults
|
|
4006
4061
|
* @param service Session service to use
|
|
4007
|
-
* @param
|
|
4008
|
-
* @
|
|
4009
|
-
|
|
4010
|
-
|
|
4062
|
+
* @param options Session configuration options (userId and appName)
|
|
4063
|
+
* @returns This builder instance for chaining
|
|
4064
|
+
*/
|
|
4065
|
+
withSession(service: BaseSessionService, options?: SessionOptions): this;
|
|
4066
|
+
/**
|
|
4067
|
+
* Configure memory service for the agent
|
|
4068
|
+
* @param memoryService Memory service to use for conversation history and context
|
|
4069
|
+
* @returns This builder instance for chaining
|
|
4070
|
+
*/
|
|
4071
|
+
withMemory(memoryService: BaseMemoryService): this;
|
|
4072
|
+
/**
|
|
4073
|
+
* Configure artifact service for the agent
|
|
4074
|
+
* @param artifactService Artifact service to use for managing generated artifacts
|
|
4011
4075
|
* @returns This builder instance for chaining
|
|
4012
4076
|
*/
|
|
4013
|
-
|
|
4077
|
+
withArtifactService(artifactService: BaseArtifactService): this;
|
|
4014
4078
|
/**
|
|
4015
4079
|
* Configure with an in-memory session with custom IDs
|
|
4016
4080
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
|
4017
|
-
* @param
|
|
4018
|
-
* @param userId User identifier (optional, defaults to agent-based ID)
|
|
4081
|
+
* @param options Session configuration options (userId and appName)
|
|
4019
4082
|
* @returns This builder instance for chaining
|
|
4020
4083
|
*/
|
|
4021
|
-
withQuickSession(
|
|
4084
|
+
withQuickSession(options?: SessionOptions): this;
|
|
4022
4085
|
/**
|
|
4023
4086
|
* Build the agent and optionally create runner and session
|
|
4024
4087
|
* @returns Built agent with optional runner and session
|
|
@@ -4093,7 +4156,7 @@ declare const index$4_RunConfig: typeof RunConfig;
|
|
|
4093
4156
|
type index$4_SequentialAgent = SequentialAgent;
|
|
4094
4157
|
declare const index$4_SequentialAgent: typeof SequentialAgent;
|
|
4095
4158
|
type index$4_SequentialAgentConfig = SequentialAgentConfig;
|
|
4096
|
-
type index$
|
|
4159
|
+
type index$4_SessionOptions = SessionOptions;
|
|
4097
4160
|
type index$4_SingleAgentCallback = SingleAgentCallback;
|
|
4098
4161
|
type index$4_StreamingMode = StreamingMode;
|
|
4099
4162
|
declare const index$4_StreamingMode: typeof StreamingMode;
|
|
@@ -4102,7 +4165,7 @@ declare const index$4_createBranchContextForSubAgent: typeof createBranchContext
|
|
|
4102
4165
|
declare const index$4_mergeAgentRun: typeof mergeAgentRun;
|
|
4103
4166
|
declare const index$4_newInvocationContextId: typeof newInvocationContextId;
|
|
4104
4167
|
declare namespace index$4 {
|
|
4105
|
-
export { type index$4_AfterAgentCallback as AfterAgentCallback, LlmAgent as Agent, index$4_AgentBuilder as AgentBuilder, type index$4_AgentBuilderConfig as AgentBuilderConfig, type index$4_AgentType as AgentType, index$4_BaseAgent as BaseAgent, type index$4_BeforeAgentCallback as BeforeAgentCallback, type index$4_BuiltAgent as BuiltAgent, index$4_CallbackContext as CallbackContext, type index$4_EnhancedRunner as EnhancedRunner, type index$4_FullMessage as FullMessage, type index$4_InstructionProvider as InstructionProvider, index$4_InvocationContext as InvocationContext, index$4_LangGraphAgent as LangGraphAgent, type index$4_LangGraphAgentConfig as LangGraphAgentConfig, type index$4_LangGraphNode as LangGraphNode, index$4_LlmAgent as LlmAgent, type index$4_LlmAgentConfig as LlmAgentConfig, index$4_LlmCallsLimitExceededError as LlmCallsLimitExceededError, index$4_LoopAgent as LoopAgent, type index$4_LoopAgentConfig as LoopAgentConfig, type index$4_MessagePart as MessagePart, index$4_ParallelAgent as ParallelAgent, type index$4_ParallelAgentConfig as ParallelAgentConfig, index$4_ReadonlyContext as ReadonlyContext, index$4_RunConfig as RunConfig, index$4_SequentialAgent as SequentialAgent, type index$4_SequentialAgentConfig as SequentialAgentConfig, type index$
|
|
4168
|
+
export { type index$4_AfterAgentCallback as AfterAgentCallback, LlmAgent as Agent, index$4_AgentBuilder as AgentBuilder, type index$4_AgentBuilderConfig as AgentBuilderConfig, type index$4_AgentType as AgentType, index$4_BaseAgent as BaseAgent, type index$4_BeforeAgentCallback as BeforeAgentCallback, type index$4_BuiltAgent as BuiltAgent, index$4_CallbackContext as CallbackContext, type index$4_EnhancedRunner as EnhancedRunner, type index$4_FullMessage as FullMessage, type index$4_InstructionProvider as InstructionProvider, index$4_InvocationContext as InvocationContext, index$4_LangGraphAgent as LangGraphAgent, type index$4_LangGraphAgentConfig as LangGraphAgentConfig, type index$4_LangGraphNode as LangGraphNode, index$4_LlmAgent as LlmAgent, type index$4_LlmAgentConfig as LlmAgentConfig, index$4_LlmCallsLimitExceededError as LlmCallsLimitExceededError, index$4_LoopAgent as LoopAgent, type index$4_LoopAgentConfig as LoopAgentConfig, type index$4_MessagePart as MessagePart, index$4_ParallelAgent as ParallelAgent, type index$4_ParallelAgentConfig as ParallelAgentConfig, index$4_ReadonlyContext as ReadonlyContext, index$4_RunConfig as RunConfig, index$4_SequentialAgent as SequentialAgent, type index$4_SequentialAgentConfig as SequentialAgentConfig, type index$4_SessionOptions as SessionOptions, type index$4_SingleAgentCallback as SingleAgentCallback, index$4_StreamingMode as StreamingMode, type index$4_ToolUnion as ToolUnion, index$4_createBranchContextForSubAgent as createBranchContextForSubAgent, index$4_mergeAgentRun as mergeAgentRun, index$4_newInvocationContextId as newInvocationContextId };
|
|
4106
4169
|
}
|
|
4107
4170
|
|
|
4108
4171
|
/**
|
|
@@ -5044,4 +5107,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
|
|
|
5044
5107
|
|
|
5045
5108
|
declare const VERSION = "0.1.0";
|
|
5046
5109
|
|
|
5047
|
-
export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, type FunctionDeclaration, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, type JSONSchema, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntentSwaps, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type
|
|
5110
|
+
export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, type CreateToolConfigWithSchema, type CreateToolConfigWithoutSchema, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, type FunctionDeclaration, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, type JSONSchema, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntentSwaps, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionOptions, index$2 as Sessions, type SingleAgentCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type ThinkingConfig, type ToolConfig, ToolContext, type ToolUnion, index$6 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
|
package/dist/index.d.ts
CHANGED
|
@@ -908,7 +908,26 @@ declare abstract class BaseTool {
|
|
|
908
908
|
/**
|
|
909
909
|
* Configuration for creating a tool
|
|
910
910
|
*/
|
|
911
|
-
interface CreateToolConfig<T extends Record<string, any>> {
|
|
911
|
+
interface CreateToolConfig<T extends Record<string, any> = Record<string, never>> {
|
|
912
|
+
/** The name of the tool */
|
|
913
|
+
name: string;
|
|
914
|
+
/** A description of what the tool does */
|
|
915
|
+
description: string;
|
|
916
|
+
/** Zod schema for validating tool arguments (optional) */
|
|
917
|
+
schema?: z.ZodSchema<T>;
|
|
918
|
+
/** The function to execute (can be sync or async) */
|
|
919
|
+
fn: (args: T, context?: ToolContext) => any;
|
|
920
|
+
/** Whether the tool is a long running operation */
|
|
921
|
+
isLongRunning?: boolean;
|
|
922
|
+
/** Whether the tool execution should be retried on failure */
|
|
923
|
+
shouldRetryOnFailure?: boolean;
|
|
924
|
+
/** Maximum retry attempts */
|
|
925
|
+
maxRetryAttempts?: number;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Configuration for creating a tool with schema
|
|
929
|
+
*/
|
|
930
|
+
interface CreateToolConfigWithSchema<T extends Record<string, any>> {
|
|
912
931
|
/** The name of the tool */
|
|
913
932
|
name: string;
|
|
914
933
|
/** A description of what the tool does */
|
|
@@ -924,6 +943,23 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
924
943
|
/** Maximum retry attempts */
|
|
925
944
|
maxRetryAttempts?: number;
|
|
926
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Configuration for creating a tool without schema (no parameters)
|
|
948
|
+
*/
|
|
949
|
+
interface CreateToolConfigWithoutSchema {
|
|
950
|
+
/** The name of the tool */
|
|
951
|
+
name: string;
|
|
952
|
+
/** A description of what the tool does */
|
|
953
|
+
description: string;
|
|
954
|
+
/** The function to execute (can be sync or async) */
|
|
955
|
+
fn: (args: Record<string, never>, context?: ToolContext) => any;
|
|
956
|
+
/** Whether the tool is a long running operation */
|
|
957
|
+
isLongRunning?: boolean;
|
|
958
|
+
/** Whether the tool execution should be retried on failure */
|
|
959
|
+
shouldRetryOnFailure?: boolean;
|
|
960
|
+
/** Maximum retry attempts */
|
|
961
|
+
maxRetryAttempts?: number;
|
|
962
|
+
}
|
|
927
963
|
/**
|
|
928
964
|
* Creates a tool from a configuration object.
|
|
929
965
|
*
|
|
@@ -942,6 +978,7 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
942
978
|
* import { createTool } from '@iqai/adk';
|
|
943
979
|
* import { z } from 'zod';
|
|
944
980
|
*
|
|
981
|
+
* // Tool with parameters
|
|
945
982
|
* const calculatorTool = createTool({
|
|
946
983
|
* name: 'calculator',
|
|
947
984
|
* description: 'Performs basic arithmetic operations',
|
|
@@ -960,9 +997,17 @@ interface CreateToolConfig<T extends Record<string, any>> {
|
|
|
960
997
|
* }
|
|
961
998
|
* }
|
|
962
999
|
* });
|
|
1000
|
+
*
|
|
1001
|
+
* // Tool without parameters (schema is optional)
|
|
1002
|
+
* const timestampTool = createTool({
|
|
1003
|
+
* name: 'timestamp',
|
|
1004
|
+
* description: 'Gets the current timestamp',
|
|
1005
|
+
* fn: () => ({ timestamp: Date.now() })
|
|
1006
|
+
* });
|
|
963
1007
|
* ```
|
|
964
1008
|
*/
|
|
965
|
-
declare function createTool<T extends Record<string, any>>(config:
|
|
1009
|
+
declare function createTool<T extends Record<string, any>>(config: CreateToolConfigWithSchema<T>): BaseTool;
|
|
1010
|
+
declare function createTool(config: CreateToolConfigWithoutSchema): BaseTool;
|
|
966
1011
|
|
|
967
1012
|
/**
|
|
968
1013
|
* A tool that wraps a user-defined TypeScript function.
|
|
@@ -1812,7 +1857,9 @@ declare function getMcpTools(config: McpConfig, toolFilter?: string[] | ((tool:
|
|
|
1812
1857
|
type index$6_BaseTool = BaseTool;
|
|
1813
1858
|
declare const index$6_BaseTool: typeof BaseTool;
|
|
1814
1859
|
type index$6_BuildFunctionDeclarationOptions = BuildFunctionDeclarationOptions;
|
|
1815
|
-
type index$6_CreateToolConfig<T extends Record<string, any>> = CreateToolConfig<T>;
|
|
1860
|
+
type index$6_CreateToolConfig<T extends Record<string, any> = Record<string, never>> = CreateToolConfig<T>;
|
|
1861
|
+
type index$6_CreateToolConfigWithSchema<T extends Record<string, any>> = CreateToolConfigWithSchema<T>;
|
|
1862
|
+
type index$6_CreateToolConfigWithoutSchema = CreateToolConfigWithoutSchema;
|
|
1816
1863
|
type index$6_ExitLoopTool = ExitLoopTool;
|
|
1817
1864
|
declare const index$6_ExitLoopTool: typeof ExitLoopTool;
|
|
1818
1865
|
type index$6_FileOperationsTool = FileOperationsTool;
|
|
@@ -1874,7 +1921,7 @@ declare const index$6_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
|
|
|
1874
1921
|
declare const index$6_mcpSchemaToParameters: typeof mcpSchemaToParameters;
|
|
1875
1922
|
declare const index$6_normalizeJsonSchema: typeof normalizeJsonSchema;
|
|
1876
1923
|
declare namespace index$6 {
|
|
1877
|
-
export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntentSwaps as McpNearIntentSwaps, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
|
|
1924
|
+
export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, type index$6_CreateToolConfigWithSchema as CreateToolConfigWithSchema, type index$6_CreateToolConfigWithoutSchema as CreateToolConfigWithoutSchema, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntentSwaps as McpNearIntentSwaps, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
|
|
1878
1925
|
}
|
|
1879
1926
|
|
|
1880
1927
|
/**
|
|
@@ -3854,14 +3901,11 @@ interface AgentBuilderConfig {
|
|
|
3854
3901
|
rootNode?: string;
|
|
3855
3902
|
}
|
|
3856
3903
|
/**
|
|
3857
|
-
* Session configuration
|
|
3904
|
+
* Session configuration options
|
|
3858
3905
|
*/
|
|
3859
|
-
interface
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
appName: string;
|
|
3863
|
-
memoryService?: BaseMemoryService;
|
|
3864
|
-
artifactService?: BaseArtifactService;
|
|
3906
|
+
interface SessionOptions {
|
|
3907
|
+
userId?: string;
|
|
3908
|
+
appName?: string;
|
|
3865
3909
|
}
|
|
3866
3910
|
/**
|
|
3867
3911
|
* Message part interface for flexible message input
|
|
@@ -3918,6 +3962,15 @@ type AgentType = "llm" | "sequential" | "parallel" | "loop" | "langgraph";
|
|
|
3918
3962
|
* .withInstruction("You are a research assistant")
|
|
3919
3963
|
* .build();
|
|
3920
3964
|
*
|
|
3965
|
+
* // With memory and artifact services
|
|
3966
|
+
* const { runner } = await AgentBuilder
|
|
3967
|
+
* .create("persistent-agent")
|
|
3968
|
+
* .withModel("gemini-2.5-flash")
|
|
3969
|
+
* .withMemory(new RedisMemoryService())
|
|
3970
|
+
* .withArtifactService(new S3ArtifactService())
|
|
3971
|
+
* .withSession(new DatabaseSessionService(), { userId: "user123", appName: "myapp" })
|
|
3972
|
+
* .build();
|
|
3973
|
+
*
|
|
3921
3974
|
* // Multi-agent workflow
|
|
3922
3975
|
* const { runner } = await AgentBuilder
|
|
3923
3976
|
* .create("workflow")
|
|
@@ -3928,6 +3981,8 @@ type AgentType = "llm" | "sequential" | "parallel" | "loop" | "langgraph";
|
|
|
3928
3981
|
declare class AgentBuilder {
|
|
3929
3982
|
private config;
|
|
3930
3983
|
private sessionConfig?;
|
|
3984
|
+
private memoryService?;
|
|
3985
|
+
private artifactService?;
|
|
3931
3986
|
private agentType;
|
|
3932
3987
|
/**
|
|
3933
3988
|
* Private constructor - use static create() method
|
|
@@ -4004,21 +4059,29 @@ declare class AgentBuilder {
|
|
|
4004
4059
|
/**
|
|
4005
4060
|
* Configure session management with optional smart defaults
|
|
4006
4061
|
* @param service Session service to use
|
|
4007
|
-
* @param
|
|
4008
|
-
* @
|
|
4009
|
-
|
|
4010
|
-
|
|
4062
|
+
* @param options Session configuration options (userId and appName)
|
|
4063
|
+
* @returns This builder instance for chaining
|
|
4064
|
+
*/
|
|
4065
|
+
withSession(service: BaseSessionService, options?: SessionOptions): this;
|
|
4066
|
+
/**
|
|
4067
|
+
* Configure memory service for the agent
|
|
4068
|
+
* @param memoryService Memory service to use for conversation history and context
|
|
4069
|
+
* @returns This builder instance for chaining
|
|
4070
|
+
*/
|
|
4071
|
+
withMemory(memoryService: BaseMemoryService): this;
|
|
4072
|
+
/**
|
|
4073
|
+
* Configure artifact service for the agent
|
|
4074
|
+
* @param artifactService Artifact service to use for managing generated artifacts
|
|
4011
4075
|
* @returns This builder instance for chaining
|
|
4012
4076
|
*/
|
|
4013
|
-
|
|
4077
|
+
withArtifactService(artifactService: BaseArtifactService): this;
|
|
4014
4078
|
/**
|
|
4015
4079
|
* Configure with an in-memory session with custom IDs
|
|
4016
4080
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
|
4017
|
-
* @param
|
|
4018
|
-
* @param userId User identifier (optional, defaults to agent-based ID)
|
|
4081
|
+
* @param options Session configuration options (userId and appName)
|
|
4019
4082
|
* @returns This builder instance for chaining
|
|
4020
4083
|
*/
|
|
4021
|
-
withQuickSession(
|
|
4084
|
+
withQuickSession(options?: SessionOptions): this;
|
|
4022
4085
|
/**
|
|
4023
4086
|
* Build the agent and optionally create runner and session
|
|
4024
4087
|
* @returns Built agent with optional runner and session
|
|
@@ -4093,7 +4156,7 @@ declare const index$4_RunConfig: typeof RunConfig;
|
|
|
4093
4156
|
type index$4_SequentialAgent = SequentialAgent;
|
|
4094
4157
|
declare const index$4_SequentialAgent: typeof SequentialAgent;
|
|
4095
4158
|
type index$4_SequentialAgentConfig = SequentialAgentConfig;
|
|
4096
|
-
type index$
|
|
4159
|
+
type index$4_SessionOptions = SessionOptions;
|
|
4097
4160
|
type index$4_SingleAgentCallback = SingleAgentCallback;
|
|
4098
4161
|
type index$4_StreamingMode = StreamingMode;
|
|
4099
4162
|
declare const index$4_StreamingMode: typeof StreamingMode;
|
|
@@ -4102,7 +4165,7 @@ declare const index$4_createBranchContextForSubAgent: typeof createBranchContext
|
|
|
4102
4165
|
declare const index$4_mergeAgentRun: typeof mergeAgentRun;
|
|
4103
4166
|
declare const index$4_newInvocationContextId: typeof newInvocationContextId;
|
|
4104
4167
|
declare namespace index$4 {
|
|
4105
|
-
export { type index$4_AfterAgentCallback as AfterAgentCallback, LlmAgent as Agent, index$4_AgentBuilder as AgentBuilder, type index$4_AgentBuilderConfig as AgentBuilderConfig, type index$4_AgentType as AgentType, index$4_BaseAgent as BaseAgent, type index$4_BeforeAgentCallback as BeforeAgentCallback, type index$4_BuiltAgent as BuiltAgent, index$4_CallbackContext as CallbackContext, type index$4_EnhancedRunner as EnhancedRunner, type index$4_FullMessage as FullMessage, type index$4_InstructionProvider as InstructionProvider, index$4_InvocationContext as InvocationContext, index$4_LangGraphAgent as LangGraphAgent, type index$4_LangGraphAgentConfig as LangGraphAgentConfig, type index$4_LangGraphNode as LangGraphNode, index$4_LlmAgent as LlmAgent, type index$4_LlmAgentConfig as LlmAgentConfig, index$4_LlmCallsLimitExceededError as LlmCallsLimitExceededError, index$4_LoopAgent as LoopAgent, type index$4_LoopAgentConfig as LoopAgentConfig, type index$4_MessagePart as MessagePart, index$4_ParallelAgent as ParallelAgent, type index$4_ParallelAgentConfig as ParallelAgentConfig, index$4_ReadonlyContext as ReadonlyContext, index$4_RunConfig as RunConfig, index$4_SequentialAgent as SequentialAgent, type index$4_SequentialAgentConfig as SequentialAgentConfig, type index$
|
|
4168
|
+
export { type index$4_AfterAgentCallback as AfterAgentCallback, LlmAgent as Agent, index$4_AgentBuilder as AgentBuilder, type index$4_AgentBuilderConfig as AgentBuilderConfig, type index$4_AgentType as AgentType, index$4_BaseAgent as BaseAgent, type index$4_BeforeAgentCallback as BeforeAgentCallback, type index$4_BuiltAgent as BuiltAgent, index$4_CallbackContext as CallbackContext, type index$4_EnhancedRunner as EnhancedRunner, type index$4_FullMessage as FullMessage, type index$4_InstructionProvider as InstructionProvider, index$4_InvocationContext as InvocationContext, index$4_LangGraphAgent as LangGraphAgent, type index$4_LangGraphAgentConfig as LangGraphAgentConfig, type index$4_LangGraphNode as LangGraphNode, index$4_LlmAgent as LlmAgent, type index$4_LlmAgentConfig as LlmAgentConfig, index$4_LlmCallsLimitExceededError as LlmCallsLimitExceededError, index$4_LoopAgent as LoopAgent, type index$4_LoopAgentConfig as LoopAgentConfig, type index$4_MessagePart as MessagePart, index$4_ParallelAgent as ParallelAgent, type index$4_ParallelAgentConfig as ParallelAgentConfig, index$4_ReadonlyContext as ReadonlyContext, index$4_RunConfig as RunConfig, index$4_SequentialAgent as SequentialAgent, type index$4_SequentialAgentConfig as SequentialAgentConfig, type index$4_SessionOptions as SessionOptions, type index$4_SingleAgentCallback as SingleAgentCallback, index$4_StreamingMode as StreamingMode, type index$4_ToolUnion as ToolUnion, index$4_createBranchContextForSubAgent as createBranchContextForSubAgent, index$4_mergeAgentRun as mergeAgentRun, index$4_newInvocationContextId as newInvocationContextId };
|
|
4106
4169
|
}
|
|
4107
4170
|
|
|
4108
4171
|
/**
|
|
@@ -5044,4 +5107,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
|
|
|
5044
5107
|
|
|
5045
5108
|
declare const VERSION = "0.1.0";
|
|
5046
5109
|
|
|
5047
|
-
export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, type FunctionDeclaration, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, type JSONSchema, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntentSwaps, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type
|
|
5110
|
+
export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, type CreateToolConfigWithSchema, type CreateToolConfigWithoutSchema, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, type FunctionDeclaration, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, type JSONSchema, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntentSwaps, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionOptions, index$2 as Sessions, type SingleAgentCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type ThinkingConfig, type ToolConfig, ToolContext, type ToolUnion, index$6 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
|
package/dist/index.js
CHANGED
|
@@ -3879,7 +3879,7 @@ var CreatedTool = class extends BaseTool {
|
|
|
3879
3879
|
maxRetryAttempts: _nullishCoalesce(config.maxRetryAttempts, () => ( 3))
|
|
3880
3880
|
});
|
|
3881
3881
|
this.func = config.fn;
|
|
3882
|
-
this.schema = config.schema;
|
|
3882
|
+
this.schema = _nullishCoalesce(config.schema, () => ( z.object({})));
|
|
3883
3883
|
this.functionDeclaration = this.buildDeclaration();
|
|
3884
3884
|
}
|
|
3885
3885
|
/**
|
|
@@ -9886,6 +9886,8 @@ var InMemoryRunner = class extends Runner {
|
|
|
9886
9886
|
var AgentBuilder = (_class31 = class _AgentBuilder {
|
|
9887
9887
|
|
|
9888
9888
|
|
|
9889
|
+
|
|
9890
|
+
|
|
9889
9891
|
__init54() {this.agentType = "llm"}
|
|
9890
9892
|
/**
|
|
9891
9893
|
* Private constructor - use static create() method
|
|
@@ -10001,31 +10003,43 @@ var AgentBuilder = (_class31 = class _AgentBuilder {
|
|
|
10001
10003
|
/**
|
|
10002
10004
|
* Configure session management with optional smart defaults
|
|
10003
10005
|
* @param service Session service to use
|
|
10004
|
-
* @param
|
|
10005
|
-
* @param appName Application name (optional, defaults to agent-based name)
|
|
10006
|
-
* @param memoryService Optional memory service
|
|
10007
|
-
* @param artifactService Optional artifact service
|
|
10006
|
+
* @param options Session configuration options (userId and appName)
|
|
10008
10007
|
* @returns This builder instance for chaining
|
|
10009
10008
|
*/
|
|
10010
|
-
withSession(service,
|
|
10009
|
+
withSession(service, options = {}) {
|
|
10011
10010
|
this.sessionConfig = {
|
|
10012
10011
|
service,
|
|
10013
|
-
userId: userId || this.generateDefaultUserId(),
|
|
10014
|
-
appName: appName || this.generateDefaultAppName()
|
|
10015
|
-
memoryService,
|
|
10016
|
-
artifactService
|
|
10012
|
+
userId: options.userId || this.generateDefaultUserId(),
|
|
10013
|
+
appName: options.appName || this.generateDefaultAppName()
|
|
10017
10014
|
};
|
|
10018
10015
|
return this;
|
|
10019
10016
|
}
|
|
10017
|
+
/**
|
|
10018
|
+
* Configure memory service for the agent
|
|
10019
|
+
* @param memoryService Memory service to use for conversation history and context
|
|
10020
|
+
* @returns This builder instance for chaining
|
|
10021
|
+
*/
|
|
10022
|
+
withMemory(memoryService) {
|
|
10023
|
+
this.memoryService = memoryService;
|
|
10024
|
+
return this;
|
|
10025
|
+
}
|
|
10026
|
+
/**
|
|
10027
|
+
* Configure artifact service for the agent
|
|
10028
|
+
* @param artifactService Artifact service to use for managing generated artifacts
|
|
10029
|
+
* @returns This builder instance for chaining
|
|
10030
|
+
*/
|
|
10031
|
+
withArtifactService(artifactService) {
|
|
10032
|
+
this.artifactService = artifactService;
|
|
10033
|
+
return this;
|
|
10034
|
+
}
|
|
10020
10035
|
/**
|
|
10021
10036
|
* Configure with an in-memory session with custom IDs
|
|
10022
10037
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
|
10023
|
-
* @param
|
|
10024
|
-
* @param userId User identifier (optional, defaults to agent-based ID)
|
|
10038
|
+
* @param options Session configuration options (userId and appName)
|
|
10025
10039
|
* @returns This builder instance for chaining
|
|
10026
10040
|
*/
|
|
10027
|
-
withQuickSession(
|
|
10028
|
-
return this.withSession(new InMemorySessionService(),
|
|
10041
|
+
withQuickSession(options = {}) {
|
|
10042
|
+
return this.withSession(new InMemorySessionService(), options);
|
|
10029
10043
|
}
|
|
10030
10044
|
/**
|
|
10031
10045
|
* Build the agent and optionally create runner and session
|
|
@@ -10047,8 +10061,8 @@ var AgentBuilder = (_class31 = class _AgentBuilder {
|
|
|
10047
10061
|
appName: this.sessionConfig.appName,
|
|
10048
10062
|
agent,
|
|
10049
10063
|
sessionService: this.sessionConfig.service,
|
|
10050
|
-
memoryService: this.
|
|
10051
|
-
artifactService: this.
|
|
10064
|
+
memoryService: this.memoryService,
|
|
10065
|
+
artifactService: this.artifactService
|
|
10052
10066
|
};
|
|
10053
10067
|
const baseRunner = new Runner(runnerConfig);
|
|
10054
10068
|
runner = this.createEnhancedRunner(baseRunner, session);
|
package/dist/index.mjs
CHANGED
|
@@ -3879,7 +3879,7 @@ var CreatedTool = class extends BaseTool {
|
|
|
3879
3879
|
maxRetryAttempts: config.maxRetryAttempts ?? 3
|
|
3880
3880
|
});
|
|
3881
3881
|
this.func = config.fn;
|
|
3882
|
-
this.schema = config.schema;
|
|
3882
|
+
this.schema = config.schema ?? z.object({});
|
|
3883
3883
|
this.functionDeclaration = this.buildDeclaration();
|
|
3884
3884
|
}
|
|
3885
3885
|
/**
|
|
@@ -9886,6 +9886,8 @@ var InMemoryRunner = class extends Runner {
|
|
|
9886
9886
|
var AgentBuilder = class _AgentBuilder {
|
|
9887
9887
|
config;
|
|
9888
9888
|
sessionConfig;
|
|
9889
|
+
memoryService;
|
|
9890
|
+
artifactService;
|
|
9889
9891
|
agentType = "llm";
|
|
9890
9892
|
/**
|
|
9891
9893
|
* Private constructor - use static create() method
|
|
@@ -10001,31 +10003,43 @@ var AgentBuilder = class _AgentBuilder {
|
|
|
10001
10003
|
/**
|
|
10002
10004
|
* Configure session management with optional smart defaults
|
|
10003
10005
|
* @param service Session service to use
|
|
10004
|
-
* @param
|
|
10005
|
-
* @param appName Application name (optional, defaults to agent-based name)
|
|
10006
|
-
* @param memoryService Optional memory service
|
|
10007
|
-
* @param artifactService Optional artifact service
|
|
10006
|
+
* @param options Session configuration options (userId and appName)
|
|
10008
10007
|
* @returns This builder instance for chaining
|
|
10009
10008
|
*/
|
|
10010
|
-
withSession(service,
|
|
10009
|
+
withSession(service, options = {}) {
|
|
10011
10010
|
this.sessionConfig = {
|
|
10012
10011
|
service,
|
|
10013
|
-
userId: userId || this.generateDefaultUserId(),
|
|
10014
|
-
appName: appName || this.generateDefaultAppName()
|
|
10015
|
-
memoryService,
|
|
10016
|
-
artifactService
|
|
10012
|
+
userId: options.userId || this.generateDefaultUserId(),
|
|
10013
|
+
appName: options.appName || this.generateDefaultAppName()
|
|
10017
10014
|
};
|
|
10018
10015
|
return this;
|
|
10019
10016
|
}
|
|
10017
|
+
/**
|
|
10018
|
+
* Configure memory service for the agent
|
|
10019
|
+
* @param memoryService Memory service to use for conversation history and context
|
|
10020
|
+
* @returns This builder instance for chaining
|
|
10021
|
+
*/
|
|
10022
|
+
withMemory(memoryService) {
|
|
10023
|
+
this.memoryService = memoryService;
|
|
10024
|
+
return this;
|
|
10025
|
+
}
|
|
10026
|
+
/**
|
|
10027
|
+
* Configure artifact service for the agent
|
|
10028
|
+
* @param artifactService Artifact service to use for managing generated artifacts
|
|
10029
|
+
* @returns This builder instance for chaining
|
|
10030
|
+
*/
|
|
10031
|
+
withArtifactService(artifactService) {
|
|
10032
|
+
this.artifactService = artifactService;
|
|
10033
|
+
return this;
|
|
10034
|
+
}
|
|
10020
10035
|
/**
|
|
10021
10036
|
* Configure with an in-memory session with custom IDs
|
|
10022
10037
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
|
10023
|
-
* @param
|
|
10024
|
-
* @param userId User identifier (optional, defaults to agent-based ID)
|
|
10038
|
+
* @param options Session configuration options (userId and appName)
|
|
10025
10039
|
* @returns This builder instance for chaining
|
|
10026
10040
|
*/
|
|
10027
|
-
withQuickSession(
|
|
10028
|
-
return this.withSession(new InMemorySessionService(),
|
|
10041
|
+
withQuickSession(options = {}) {
|
|
10042
|
+
return this.withSession(new InMemorySessionService(), options);
|
|
10029
10043
|
}
|
|
10030
10044
|
/**
|
|
10031
10045
|
* Build the agent and optionally create runner and session
|
|
@@ -10047,8 +10061,8 @@ var AgentBuilder = class _AgentBuilder {
|
|
|
10047
10061
|
appName: this.sessionConfig.appName,
|
|
10048
10062
|
agent,
|
|
10049
10063
|
sessionService: this.sessionConfig.service,
|
|
10050
|
-
memoryService: this.
|
|
10051
|
-
artifactService: this.
|
|
10064
|
+
memoryService: this.memoryService,
|
|
10065
|
+
artifactService: this.artifactService
|
|
10052
10066
|
};
|
|
10053
10067
|
const baseRunner = new Runner(runnerConfig);
|
|
10054
10068
|
runner = this.createEnhancedRunner(baseRunner, session);
|