@iqai/adk 0.1.19 → 0.1.21

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @iqai/adk
2
2
 
3
+ ## 0.1.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 22c1cc6: Adds support for input and output schemas for agents, now output schema would update the instruction with the given schema to ristrict model into giving the desired output and validates it before producing output. Agent builder is wired to provide better type inference of the schema given by withOutputSchema
8
+ - f141bc0: Improves error handling for missing models in workflows
9
+
10
+ ## 0.1.20
11
+
12
+ ### Patch Changes
13
+
14
+ - 85473c7: Fix OpenAI and AI SDK LLMs not taking in the schema from MCP tools
15
+
3
16
  ## 0.1.19
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Part, Content, Blob, SpeechConfig, AudioTranscriptionConfig, RealtimeInputConfig, ProactivityConfig, FunctionDeclaration, GroundingMetadata, GenerateContentResponseUsageMetadata, GenerateContentConfig, Schema, LiveConnectConfig, GoogleGenAI, FunctionCall } from '@google/genai';
2
2
  export { Blob, Content, FunctionDeclaration, Schema as JSONSchema } from '@google/genai';
3
3
  import { LanguageModel } from 'ai';
4
- import * as z from 'zod';
5
- import { z as z$1 } from 'zod';
4
+ import * as zod from 'zod';
5
+ import { z } from 'zod';
6
6
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
7
7
  import { CreateMessageRequestSchema, CreateMessageResultSchema, Tool } from '@modelcontextprotocol/sdk/types.js';
8
8
  import { Kysely, Generated } from 'kysely';
@@ -868,7 +868,7 @@ interface CreateToolConfig<T extends Record<string, any> = Record<string, never>
868
868
  /** A description of what the tool does */
869
869
  description: string;
870
870
  /** Zod schema for validating tool arguments (optional) */
871
- schema?: z.ZodSchema<T>;
871
+ schema?: zod.ZodSchema<T>;
872
872
  /** The function to execute (can be sync or async) */
873
873
  fn: (args: T, context: ToolContext) => any;
874
874
  /** Whether the tool is a long running operation */
@@ -887,7 +887,7 @@ interface CreateToolConfigWithSchema<T extends Record<string, any>> {
887
887
  /** A description of what the tool does */
888
888
  description: string;
889
889
  /** Zod schema for validating tool arguments */
890
- schema: z.ZodSchema<T>;
890
+ schema: zod.ZodSchema<T>;
891
891
  /** The function to execute (can be sync or async) */
892
892
  fn: (args: T, context: ToolContext) => any;
893
893
  /** Whether the tool is a long running operation */
@@ -1257,7 +1257,7 @@ declare abstract class BaseLlm {
1257
1257
  * @param llmRequest LlmRequest, the request to send to the LLM.
1258
1258
  * @returns BaseLLMConnection, the connection to the LLM.
1259
1259
  */
1260
- connect(llmRequest: LlmRequest): BaseLLMConnection;
1260
+ connect(_llmRequest: LlmRequest): BaseLLMConnection;
1261
1261
  }
1262
1262
 
1263
1263
  /**
@@ -1292,6 +1292,38 @@ type InstructionProvider = (ctx: ReadonlyContext) => string | Promise<string>;
1292
1292
  * Union type for tools (supporting functions, tools, and toolsets)
1293
1293
  */
1294
1294
  type ToolUnion = BaseTool | ((...args: any[]) => any);
1295
+ /**
1296
+ * Single before model callback type
1297
+ */
1298
+ type SingleBeforeModelCallback = (callbackContext: CallbackContext, llmRequest: LlmRequest) => LlmResponse | null | Promise<LlmResponse | null>;
1299
+ /**
1300
+ * Before model callback type (single or array)
1301
+ */
1302
+ type BeforeModelCallback = SingleBeforeModelCallback | SingleBeforeModelCallback[];
1303
+ /**
1304
+ * Single after model callback type
1305
+ */
1306
+ type SingleAfterModelCallback = (callbackContext: CallbackContext, llmResponse: LlmResponse) => LlmResponse | null | Promise<LlmResponse | null>;
1307
+ /**
1308
+ * After model callback type (single or array)
1309
+ */
1310
+ type AfterModelCallback = SingleAfterModelCallback | SingleAfterModelCallback[];
1311
+ /**
1312
+ * Single before tool callback type
1313
+ */
1314
+ type SingleBeforeToolCallback = (tool: BaseTool, args: Record<string, any>, toolContext: ToolContext) => Record<string, any> | null | Promise<Record<string, any> | null>;
1315
+ /**
1316
+ * Before tool callback type (single or array)
1317
+ */
1318
+ type BeforeToolCallback = SingleBeforeToolCallback | SingleBeforeToolCallback[];
1319
+ /**
1320
+ * Single after tool callback type
1321
+ */
1322
+ type SingleAfterToolCallback = (tool: BaseTool, args: Record<string, any>, toolContext: ToolContext, toolResponse: Record<string, any>) => Record<string, any> | null | Promise<Record<string, any> | null>;
1323
+ /**
1324
+ * After tool callback type (single or array)
1325
+ */
1326
+ type AfterToolCallback = SingleAfterToolCallback | SingleAfterToolCallback[];
1295
1327
  /**
1296
1328
  * Configuration for LlmAgent
1297
1329
  */
@@ -1387,12 +1419,28 @@ interface LlmAgentConfig<T extends BaseLlm = BaseLlm> {
1387
1419
  /**
1388
1420
  * The input schema when agent is used as a tool
1389
1421
  */
1390
- inputSchema?: any;
1422
+ inputSchema?: z.ZodSchema;
1391
1423
  /**
1392
1424
  * The output schema when agent replies
1393
1425
  * NOTE: when this is set, agent can ONLY reply and CANNOT use any tools
1394
1426
  */
1395
- outputSchema?: any;
1427
+ outputSchema?: z.ZodSchema;
1428
+ /**
1429
+ * Callback or list of callbacks to be called before calling the LLM
1430
+ */
1431
+ beforeModelCallback?: BeforeModelCallback;
1432
+ /**
1433
+ * Callback or list of callbacks to be called after calling the LLM
1434
+ */
1435
+ afterModelCallback?: AfterModelCallback;
1436
+ /**
1437
+ * Callback or list of callbacks to be called before calling a tool
1438
+ */
1439
+ beforeToolCallback?: BeforeToolCallback;
1440
+ /**
1441
+ * Callback or list of callbacks to be called after calling a tool
1442
+ */
1443
+ afterToolCallback?: AfterToolCallback;
1396
1444
  }
1397
1445
  /**
1398
1446
  * LLM-based Agent
@@ -1467,11 +1515,27 @@ declare class LlmAgent<T extends BaseLlm = BaseLlm> extends BaseAgent {
1467
1515
  /**
1468
1516
  * The input schema when agent is used as a tool
1469
1517
  */
1470
- inputSchema?: any;
1518
+ inputSchema?: z.ZodSchema;
1471
1519
  /**
1472
1520
  * The output schema when agent replies
1473
1521
  */
1474
- outputSchema?: any;
1522
+ outputSchema?: z.ZodSchema;
1523
+ /**
1524
+ * Callback or list of callbacks to be called before calling the LLM
1525
+ */
1526
+ beforeModelCallback?: BeforeModelCallback;
1527
+ /**
1528
+ * Callback or list of callbacks to be called after calling the LLM
1529
+ */
1530
+ afterModelCallback?: AfterModelCallback;
1531
+ /**
1532
+ * Callback or list of callbacks to be called before calling a tool
1533
+ */
1534
+ beforeToolCallback?: BeforeToolCallback;
1535
+ /**
1536
+ * Callback or list of callbacks to be called after calling a tool
1537
+ */
1538
+ afterToolCallback?: AfterToolCallback;
1475
1539
  protected logger: Logger;
1476
1540
  /**
1477
1541
  * Constructor for LlmAgent
@@ -1497,6 +1561,27 @@ declare class LlmAgent<T extends BaseLlm = BaseLlm> extends BaseAgent {
1497
1561
  * This method is only for use by Agent Development Kit
1498
1562
  */
1499
1563
  canonicalTools(ctx?: ReadonlyContext): Promise<BaseTool[]>;
1564
+ /**
1565
+ * Gets the canonical before model callbacks as an array
1566
+ */
1567
+ get canonicalBeforeModelCallbacks(): SingleBeforeModelCallback[];
1568
+ /**
1569
+ * Gets the canonical after model callbacks as an array
1570
+ */
1571
+ get canonicalAfterModelCallbacks(): SingleAfterModelCallback[];
1572
+ /**
1573
+ * Gets the canonical before tool callbacks as an array
1574
+ */
1575
+ get canonicalBeforeToolCallbacks(): SingleBeforeToolCallback[];
1576
+ /**
1577
+ * Gets the canonical after tool callbacks as an array
1578
+ */
1579
+ get canonicalAfterToolCallbacks(): SingleAfterToolCallback[];
1580
+ /**
1581
+ * Validates output schema configuration
1582
+ * This matches the Python implementation's __check_output_schema
1583
+ */
1584
+ private validateOutputSchemaConfig;
1500
1585
  /**
1501
1586
  * Gets the appropriate LLM flow for this agent
1502
1587
  * This matches the Python implementation's _llm_flow property
@@ -2006,8 +2091,8 @@ declare class McpError extends Error {
2006
2091
  originalError?: Error;
2007
2092
  constructor(message: string, type: McpErrorType, originalError?: Error);
2008
2093
  }
2009
- type McpSamplingRequest = z$1.infer<typeof CreateMessageRequestSchema>;
2010
- type McpSamplingResponse = z$1.infer<typeof CreateMessageResultSchema>;
2094
+ type McpSamplingRequest = z.infer<typeof CreateMessageRequestSchema>;
2095
+ type McpSamplingResponse = z.infer<typeof CreateMessageResultSchema>;
2011
2096
  type SamplingHandler = (request: LlmRequest) => Promise<string | LlmResponse>;
2012
2097
 
2013
2098
  declare class McpClientService {
@@ -2577,76 +2662,46 @@ declare class LlmRequest {
2577
2662
  }
2578
2663
 
2579
2664
  /**
2580
- * Google LLM Variant enum
2581
- */
2582
- declare enum GoogleLLMVariant {
2583
- VERTEX_AI = "VERTEX_AI",
2584
- GEMINI_API = "GEMINI_API"
2585
- }
2586
- /**
2587
- * Integration for Gemini models.
2665
+ * AI SDK integration that accepts a pre-configured LanguageModel.
2666
+ * Enables ADK to work with any provider supported by Vercel's AI SDK.
2588
2667
  */
2589
- declare class GoogleLlm extends BaseLlm {
2590
- private _apiClient?;
2591
- private _liveApiClient?;
2592
- private _apiBackend?;
2593
- private _trackingHeaders?;
2668
+ declare class AiSdkLlm extends BaseLlm {
2669
+ private modelInstance;
2670
+ protected logger: Logger;
2594
2671
  /**
2595
- * Constructor for Gemini
2672
+ * Constructor accepts a pre-configured LanguageModel instance
2673
+ * @param model - Pre-configured LanguageModel from provider(modelName)
2596
2674
  */
2597
- constructor(model?: string);
2675
+ constructor(modelInstance: LanguageModel);
2598
2676
  /**
2599
- * Provides the list of supported models.
2677
+ * Returns empty array - following Python ADK pattern
2600
2678
  */
2601
2679
  static supportedModels(): string[];
2680
+ protected generateContentAsyncImpl(request: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
2602
2681
  /**
2603
- * Main content generation method - handles both streaming and non-streaming
2604
- */
2605
- protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
2606
- /**
2607
- * Connects to the Gemini model and returns an llm connection.
2608
- */
2609
- connect(_llmRequest: LlmRequest): BaseLLMConnection;
2610
- /**
2611
- * Check if response has inline data
2612
- */
2613
- private hasInlineData;
2614
- /**
2615
- * Convert LlmRequest contents to GoogleGenAI format
2616
- */
2617
- private convertContents;
2618
- /**
2619
- * Preprocesses the request based on the API backend.
2620
- */
2621
- private preprocessRequest;
2622
- /**
2623
- * Sets display_name to null for the Gemini API (non-Vertex) backend.
2624
- */
2625
- private removeDisplayNameIfPresent;
2626
- /**
2627
- * Builds function declaration log string.
2682
+ * Convert ADK LlmRequest to AI SDK CoreMessage format
2628
2683
  */
2629
- private buildFunctionDeclarationLog;
2684
+ private convertToAiSdkMessages;
2630
2685
  /**
2631
- * Provides the api client.
2686
+ * Transform JSON schema to use lowercase types for AI SDK compatibility
2632
2687
  */
2633
- get apiClient(): GoogleGenAI;
2688
+ private transformSchemaForAiSdk;
2634
2689
  /**
2635
- * Gets the API backend type.
2690
+ * Convert ADK tools to AI SDK tools format
2636
2691
  */
2637
- get apiBackend(): GoogleLLMVariant;
2692
+ private convertToAiSdkTools;
2638
2693
  /**
2639
- * Gets the tracking headers.
2694
+ * Convert ADK Content to AI SDK CoreMessage
2640
2695
  */
2641
- get trackingHeaders(): Record<string, string>;
2696
+ private contentToAiSdkMessage;
2642
2697
  /**
2643
- * Gets the live API version.
2698
+ * Map ADK role to AI SDK role
2644
2699
  */
2645
- get liveApiVersion(): string;
2700
+ private mapRole;
2646
2701
  /**
2647
- * Gets the live API client.
2702
+ * Map AI SDK finish reason to ADK finish reason
2648
2703
  */
2649
- get liveApiClient(): GoogleGenAI;
2704
+ private mapFinishReason;
2650
2705
  }
2651
2706
 
2652
2707
  /**
@@ -2709,6 +2764,79 @@ declare class AnthropicLlm extends BaseLlm {
2709
2764
  private get client();
2710
2765
  }
2711
2766
 
2767
+ /**
2768
+ * Google LLM Variant enum
2769
+ */
2770
+ declare enum GoogleLLMVariant {
2771
+ VERTEX_AI = "VERTEX_AI",
2772
+ GEMINI_API = "GEMINI_API"
2773
+ }
2774
+ /**
2775
+ * Integration for Gemini models.
2776
+ */
2777
+ declare class GoogleLlm extends BaseLlm {
2778
+ private _apiClient?;
2779
+ private _liveApiClient?;
2780
+ private _apiBackend?;
2781
+ private _trackingHeaders?;
2782
+ /**
2783
+ * Constructor for Gemini
2784
+ */
2785
+ constructor(model?: string);
2786
+ /**
2787
+ * Provides the list of supported models.
2788
+ */
2789
+ static supportedModels(): string[];
2790
+ /**
2791
+ * Main content generation method - handles both streaming and non-streaming
2792
+ */
2793
+ protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
2794
+ /**
2795
+ * Connects to the Gemini model and returns an llm connection.
2796
+ */
2797
+ connect(_llmRequest: LlmRequest): BaseLLMConnection;
2798
+ /**
2799
+ * Check if response has inline data
2800
+ */
2801
+ private hasInlineData;
2802
+ /**
2803
+ * Convert LlmRequest contents to GoogleGenAI format
2804
+ */
2805
+ private convertContents;
2806
+ /**
2807
+ * Preprocesses the request based on the API backend.
2808
+ */
2809
+ private preprocessRequest;
2810
+ /**
2811
+ * Sets display_name to null for the Gemini API (non-Vertex) backend.
2812
+ */
2813
+ private removeDisplayNameIfPresent;
2814
+ /**
2815
+ * Builds function declaration log string.
2816
+ */
2817
+ private buildFunctionDeclarationLog;
2818
+ /**
2819
+ * Provides the api client.
2820
+ */
2821
+ get apiClient(): GoogleGenAI;
2822
+ /**
2823
+ * Gets the API backend type.
2824
+ */
2825
+ get apiBackend(): GoogleLLMVariant;
2826
+ /**
2827
+ * Gets the tracking headers.
2828
+ */
2829
+ get trackingHeaders(): Record<string, string>;
2830
+ /**
2831
+ * Gets the live API version.
2832
+ */
2833
+ get liveApiVersion(): string;
2834
+ /**
2835
+ * Gets the live API client.
2836
+ */
2837
+ get liveApiClient(): GoogleGenAI;
2838
+ }
2839
+
2712
2840
  /**
2713
2841
  * OpenAI LLM implementation using GPT models
2714
2842
  * Enhanced with comprehensive debug logging similar to Google LLM
@@ -2747,6 +2875,10 @@ declare class OpenAiLlm extends BaseLlm {
2747
2875
  * Convert ADK Part to OpenAI message content
2748
2876
  */
2749
2877
  private partToOpenAiContent;
2878
+ /**
2879
+ * Transform JSON schema to use lowercase types for OpenAI compatibility
2880
+ */
2881
+ private transformSchemaForOpenAi;
2750
2882
  /**
2751
2883
  * Convert ADK function declaration to OpenAI tool
2752
2884
  */
@@ -2782,45 +2914,6 @@ declare class OpenAiLlm extends BaseLlm {
2782
2914
  private get client();
2783
2915
  }
2784
2916
 
2785
- /**
2786
- * AI SDK integration that accepts a pre-configured LanguageModel.
2787
- * Enables ADK to work with any provider supported by Vercel's AI SDK.
2788
- */
2789
- declare class AiSdkLlm extends BaseLlm {
2790
- private modelInstance;
2791
- protected logger: Logger;
2792
- /**
2793
- * Constructor accepts a pre-configured LanguageModel instance
2794
- * @param model - Pre-configured LanguageModel from provider(modelName)
2795
- */
2796
- constructor(modelInstance: LanguageModel);
2797
- /**
2798
- * Returns empty array - following Python ADK pattern
2799
- */
2800
- static supportedModels(): string[];
2801
- protected generateContentAsyncImpl(request: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
2802
- /**
2803
- * Convert ADK LlmRequest to AI SDK CoreMessage format
2804
- */
2805
- private convertToAiSdkMessages;
2806
- /**
2807
- * Convert ADK tools to AI SDK tools format
2808
- */
2809
- private convertToAiSdkTools;
2810
- /**
2811
- * Convert ADK Content to AI SDK CoreMessage
2812
- */
2813
- private contentToAiSdkMessage;
2814
- /**
2815
- * Map ADK role to AI SDK role
2816
- */
2817
- private mapRole;
2818
- /**
2819
- * Map AI SDK finish reason to ADK finish reason
2820
- */
2821
- private mapFinishReason;
2822
- }
2823
-
2824
2917
  /**
2825
2918
  * Type for LLM constructor with static methods
2826
2919
  */
@@ -3943,6 +4036,8 @@ interface AgentBuilderConfig {
3943
4036
  nodes?: LangGraphNode[];
3944
4037
  rootNode?: string;
3945
4038
  outputKey?: string;
4039
+ inputSchema?: zod.ZodSchema;
4040
+ outputSchema?: zod.ZodSchema;
3946
4041
  }
3947
4042
  /**
3948
4043
  * Session configuration options
@@ -3968,26 +4063,35 @@ interface FullMessage extends Content {
3968
4063
  /**
3969
4064
  * Enhanced runner interface with simplified API
3970
4065
  */
3971
- interface EnhancedRunner {
3972
- ask(message: string | FullMessage | LlmRequest): Promise<string>;
4066
+ interface EnhancedRunner<T = string> {
4067
+ ask(message: string | FullMessage | LlmRequest): Promise<T>;
3973
4068
  runAsync(params: {
3974
4069
  userId: string;
3975
4070
  sessionId: string;
3976
4071
  newMessage: FullMessage;
3977
4072
  }): AsyncIterable<Event>;
4073
+ __outputSchema?: zod.ZodSchema;
3978
4074
  }
3979
4075
  /**
3980
4076
  * Built agent result containing the agent and runner/session
3981
4077
  */
3982
- interface BuiltAgent {
4078
+ interface BuiltAgent<T = string> {
3983
4079
  agent: BaseAgent;
3984
- runner: EnhancedRunner;
4080
+ runner: EnhancedRunner<T>;
3985
4081
  session: Session;
3986
4082
  }
3987
4083
  /**
3988
4084
  * Agent types that can be built
3989
4085
  */
3990
4086
  type AgentType = "llm" | "sequential" | "parallel" | "loop" | "langgraph";
4087
+ /**
4088
+ * AgentBuilder with typed output schema
4089
+ */
4090
+ interface AgentBuilderWithSchema<T> extends Omit<AgentBuilder, 'build' | 'ask'> {
4091
+ build(): Promise<BuiltAgent<T>>;
4092
+ buildWithSchema<U = T>(): Promise<BuiltAgent<U>>;
4093
+ ask(message: string | FullMessage): Promise<T>;
4094
+ }
3991
4095
  /**
3992
4096
  * AgentBuilder - A fluent interface for creating AI agents with automatic session management
3993
4097
  *
@@ -4074,6 +4178,8 @@ declare class AgentBuilder {
4074
4178
  * @returns This builder instance for chaining
4075
4179
  */
4076
4180
  withInstruction(instruction: string): this;
4181
+ withInputSchema(schema: zod.ZodSchema): this;
4182
+ withOutputSchema<T>(schema: zod.ZodType<T>): AgentBuilderWithSchema<T>;
4077
4183
  /**
4078
4184
  * Add tools to the agent
4079
4185
  * @param tools Tools to add to the agent
@@ -4179,7 +4285,12 @@ declare class AgentBuilder {
4179
4285
  * Build the agent and optionally create runner and session
4180
4286
  * @returns Built agent with optional runner and session
4181
4287
  */
4182
- build(): Promise<BuiltAgent>;
4288
+ build<T = string>(): Promise<BuiltAgent<T>>;
4289
+ /**
4290
+ * Type-safe build method for agents with output schemas
4291
+ * Provides better type inference for the ask method return type
4292
+ */
4293
+ buildWithSchema<T>(): Promise<BuiltAgent<T>>;
4183
4294
  /**
4184
4295
  * Quick execution helper - build and run a message
4185
4296
  * @param message Message to send to the agent (string or full message object)
@@ -4202,7 +4313,7 @@ declare class AgentBuilder {
4202
4313
  */
4203
4314
  private generateDefaultAppName;
4204
4315
  /**
4205
- * Create enhanced runner with simplified API
4316
+ * Create enhanced runner with simplified API and proper typing
4206
4317
  * @param baseRunner The base runner instance
4207
4318
  * @param session The session instance
4208
4319
  * @returns Enhanced runner with simplified API
@@ -4211,17 +4322,22 @@ declare class AgentBuilder {
4211
4322
  }
4212
4323
 
4213
4324
  type index$4_AfterAgentCallback = AfterAgentCallback;
4325
+ type index$4_AfterModelCallback = AfterModelCallback;
4326
+ type index$4_AfterToolCallback = AfterToolCallback;
4214
4327
  type index$4_AgentBuilder = AgentBuilder;
4215
4328
  declare const index$4_AgentBuilder: typeof AgentBuilder;
4216
4329
  type index$4_AgentBuilderConfig = AgentBuilderConfig;
4330
+ type index$4_AgentBuilderWithSchema<T> = AgentBuilderWithSchema<T>;
4217
4331
  type index$4_AgentType = AgentType;
4218
4332
  type index$4_BaseAgent = BaseAgent;
4219
4333
  declare const index$4_BaseAgent: typeof BaseAgent;
4220
4334
  type index$4_BeforeAgentCallback = BeforeAgentCallback;
4221
- type index$4_BuiltAgent = BuiltAgent;
4335
+ type index$4_BeforeModelCallback = BeforeModelCallback;
4336
+ type index$4_BeforeToolCallback = BeforeToolCallback;
4337
+ type index$4_BuiltAgent<T = string> = BuiltAgent<T>;
4222
4338
  type index$4_CallbackContext = CallbackContext;
4223
4339
  declare const index$4_CallbackContext: typeof CallbackContext;
4224
- type index$4_EnhancedRunner = EnhancedRunner;
4340
+ type index$4_EnhancedRunner<T = string> = EnhancedRunner<T>;
4225
4341
  type index$4_FullMessage = FullMessage;
4226
4342
  type index$4_InstructionProvider = InstructionProvider;
4227
4343
  type index$4_InvocationContext = InvocationContext;
@@ -4250,7 +4366,11 @@ type index$4_SequentialAgent = SequentialAgent;
4250
4366
  declare const index$4_SequentialAgent: typeof SequentialAgent;
4251
4367
  type index$4_SequentialAgentConfig = SequentialAgentConfig;
4252
4368
  type index$4_SessionOptions = SessionOptions;
4369
+ type index$4_SingleAfterModelCallback = SingleAfterModelCallback;
4370
+ type index$4_SingleAfterToolCallback = SingleAfterToolCallback;
4253
4371
  type index$4_SingleAgentCallback = SingleAgentCallback;
4372
+ type index$4_SingleBeforeModelCallback = SingleBeforeModelCallback;
4373
+ type index$4_SingleBeforeToolCallback = SingleBeforeToolCallback;
4254
4374
  type index$4_StreamingMode = StreamingMode;
4255
4375
  declare const index$4_StreamingMode: typeof StreamingMode;
4256
4376
  type index$4_ToolUnion = ToolUnion;
@@ -4258,7 +4378,7 @@ declare const index$4_createBranchContextForSubAgent: typeof createBranchContext
4258
4378
  declare const index$4_mergeAgentRun: typeof mergeAgentRun;
4259
4379
  declare const index$4_newInvocationContextId: typeof newInvocationContextId;
4260
4380
  declare namespace index$4 {
4261
- 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 };
4381
+ export { type index$4_AfterAgentCallback as AfterAgentCallback, type index$4_AfterModelCallback as AfterModelCallback, type index$4_AfterToolCallback as AfterToolCallback, LlmAgent as Agent, index$4_AgentBuilder as AgentBuilder, type index$4_AgentBuilderConfig as AgentBuilderConfig, type index$4_AgentBuilderWithSchema as AgentBuilderWithSchema, type index$4_AgentType as AgentType, index$4_BaseAgent as BaseAgent, type index$4_BeforeAgentCallback as BeforeAgentCallback, type index$4_BeforeModelCallback as BeforeModelCallback, type index$4_BeforeToolCallback as BeforeToolCallback, 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_SingleAfterModelCallback as SingleAfterModelCallback, type index$4_SingleAfterToolCallback as SingleAfterToolCallback, type index$4_SingleAgentCallback as SingleAgentCallback, type index$4_SingleBeforeModelCallback as SingleBeforeModelCallback, type index$4_SingleBeforeToolCallback as SingleBeforeToolCallback, 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 };
4262
4382
  }
4263
4383
 
4264
4384
  /**
@@ -5200,4 +5320,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
5200
5320
 
5201
5321
  declare const VERSION = "0.1.0";
5202
5322
 
5203
- export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, AgentTool, type AgentToolConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, type BaseAgentType, 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, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, 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, McpNearIntents, 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 };
5323
+ export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, type AfterModelCallback, type AfterToolCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentBuilderWithSchema, AgentTool, type AgentToolConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, type BaseAgentType, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BeforeModelCallback, type BeforeToolCallback, 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, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, 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, McpNearIntents, 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 SingleAfterModelCallback, type SingleAfterToolCallback, type SingleAgentCallback, type SingleBeforeModelCallback, type SingleBeforeToolCallback, 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 };