@iqai/adk 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1431,6 +1431,174 @@ declare class McpSamplingHandler {
1431
1431
  */
1432
1432
  declare function createSamplingHandler(handler: SamplingHandler): SamplingHandler;
1433
1433
 
1434
+ /**
1435
+ * Simplified MCP Server Wrappers
1436
+ *
1437
+ * This module provides simplified wrapper functions for IQAI MCP servers and popular third-party MCP servers.
1438
+ * Instead of manually configuring McpToolset with verbose configuration objects, you can use these
1439
+ * convenience functions with flexible configuration objects.
1440
+ *
1441
+ * @example
1442
+ * ```typescript
1443
+ * // Old verbose way:
1444
+ * const toolset = new McpToolset({
1445
+ * name: "Near Intent Swaps MCP Client",
1446
+ * description: "Client for Near Intent Swaps",
1447
+ * debug: env.DEBUG,
1448
+ * retryOptions: { maxRetries: 2, initialDelay: 200 },
1449
+ * transport: {
1450
+ * mode: "stdio",
1451
+ * command: "npx",
1452
+ * args: ["-y", "@iqai/mcp-near"],
1453
+ * env: {
1454
+ * ACCOUNT_ID: env.ACCOUNT_ID,
1455
+ * ACCOUNT_KEY: env.ACCOUNT_KEY,
1456
+ * NEAR_NETWORK_ID: "testnet",
1457
+ * PATH: env.PATH
1458
+ * },
1459
+ * },
1460
+ * });
1461
+ *
1462
+ * // New simplified way:
1463
+ * const toolset = McpNearAgent({
1464
+ * env: {
1465
+ * ACCOUNT_ID: env.ACCOUNT_ID,
1466
+ * ACCOUNT_KEY: env.ACCOUNT_KEY,
1467
+ * NEAR_NETWORK_ID: "testnet",
1468
+ * PATH: env.PATH
1469
+ * }
1470
+ * });
1471
+ *
1472
+ * // Usage with LLM Agent:
1473
+ * const nearTools = await toolset.getTools();
1474
+ * const agent = new LlmAgent({
1475
+ * name: "near_assistant",
1476
+ * model: "gemini-2.5-flash",
1477
+ * tools: nearTools,
1478
+ * });
1479
+ * ```
1480
+ *
1481
+ * @example
1482
+ * ```typescript
1483
+ * // Multiple MCP servers:
1484
+ * const atpTools = await McpAtp({
1485
+ * env: {
1486
+ * ATP_WALLET_PRIVATE_KEY: env.WALLET_PRIVATE_KEY,
1487
+ * ATP_API_KEY: env.ATP_API_KEY
1488
+ * }
1489
+ * }).getTools();
1490
+ *
1491
+ * const fraxlendTools = await McpFraxlend({
1492
+ * env: {
1493
+ * WALLET_PRIVATE_KEY: env.WALLET_PRIVATE_KEY
1494
+ * }
1495
+ * }).getTools();
1496
+ *
1497
+ * const agent = new LlmAgent({
1498
+ * name: "defi_assistant",
1499
+ * model: "gemini-2.5-flash",
1500
+ * tools: [...atpTools, ...fraxlendTools],
1501
+ * });
1502
+ * ```
1503
+ */
1504
+ /**
1505
+ * Base configuration interface for MCP servers
1506
+ */
1507
+ interface McpServerConfig {
1508
+ /** Environment variables to pass to the MCP server */
1509
+ env?: Record<string, any>;
1510
+ /** Enable debug logging */
1511
+ debug?: boolean;
1512
+ /** Custom description for the MCP server */
1513
+ description?: string;
1514
+ /** Retry configuration */
1515
+ retryOptions?: {
1516
+ maxRetries?: number;
1517
+ initialDelay?: number;
1518
+ };
1519
+ }
1520
+ /**
1521
+ * MCP ABI - Smart contract ABI interactions for Ethereum-compatible blockchains
1522
+ *
1523
+ * Required env vars: CONTRACT_ABI, CONTRACT_ADDRESS
1524
+ * Optional env vars: CONTRACT_NAME, CHAIN_ID, RPC_URL, WALLET_PRIVATE_KEY
1525
+ */
1526
+ declare function McpAbi(config: McpServerConfig): McpToolset;
1527
+ /**
1528
+ * MCP ATP - Interact with the IQ AI Agent Tokenization Platform
1529
+ *
1530
+ * Required env vars: ATP_WALLET_PRIVATE_KEY, ATP_API_KEY
1531
+ */
1532
+ declare function McpAtp(config: McpServerConfig): McpToolset;
1533
+ /**
1534
+ * MCP BAMM - Borrow Automated Market Maker operations on Fraxtal
1535
+ *
1536
+ * Required env vars: WALLET_PRIVATE_KEY
1537
+ */
1538
+ declare function McpBamm(config: McpServerConfig): McpToolset;
1539
+ /**
1540
+ * MCP FRAXLEND - Interact with the Fraxlend lending platform
1541
+ *
1542
+ * Required env vars: WALLET_PRIVATE_KEY
1543
+ */
1544
+ declare function McpFraxlend(config: McpServerConfig): McpToolset;
1545
+ /**
1546
+ * MCP IQWiki - Access and manage IQ.wiki data and user activities
1547
+ *
1548
+ * No required env vars
1549
+ */
1550
+ declare function McpIqWiki(config?: McpServerConfig): McpToolset;
1551
+ /**
1552
+ * MCP NEAR Agent - NEAR Protocol blockchain integration with AI-driven event processing
1553
+ *
1554
+ * Required env vars: ACCOUNT_ID, ACCOUNT_KEY
1555
+ * Optional env vars: NEAR_NETWORK_ID, NEAR_NODE_URL, NEAR_GAS_LIMIT
1556
+ */
1557
+ declare function McpNearAgent(config: McpServerConfig): McpToolset;
1558
+ /**
1559
+ * MCP NEAR Intent Swaps - NEAR Protocol intent swaps functionality
1560
+ *
1561
+ * Required env vars: ACCOUNT_ID, ACCOUNT_KEY
1562
+ * Optional env vars: NEAR_NETWORK_ID, NEAR_NODE_URL, NEAR_GAS_LIMIT
1563
+ */
1564
+ declare function McpNearIntentSwaps(config: McpServerConfig): McpToolset;
1565
+ /**
1566
+ * MCP ODOS - Interact with decentralized exchanges through ODOS aggregation
1567
+ *
1568
+ * Required env vars: WALLET_PRIVATE_KEY
1569
+ */
1570
+ declare function McpOdos(config: McpServerConfig): McpToolset;
1571
+ /**
1572
+ * MCP Telegram - Interact with Telegram bots and channels
1573
+ *
1574
+ * Required env vars: TELEGRAM_BOT_TOKEN
1575
+ */
1576
+ declare function McpTelegram(config: McpServerConfig): McpToolset;
1577
+ /**
1578
+ * Popular third-party MCP servers
1579
+ * These can be added as we expand support for community MCP servers
1580
+ */
1581
+ /**
1582
+ * MCP Filesystem - File system operations (third-party)
1583
+ *
1584
+ * Optional env vars: ALLOWED_DIRECTORIES (comma-separated list)
1585
+ */
1586
+ declare function McpFilesystem(config?: McpServerConfig): McpToolset;
1587
+ /**
1588
+ * MCP Memory - Memory and note-taking capabilities (third-party)
1589
+ *
1590
+ * No required env vars
1591
+ */
1592
+ declare function McpMemory(config?: McpServerConfig): McpToolset;
1593
+ /**
1594
+ * Generic MCP server function for any package
1595
+ *
1596
+ * @param packageName The npm package name of the MCP server
1597
+ * @param config Configuration object with environment variables
1598
+ * @param name Optional custom name for the client
1599
+ */
1600
+ declare function McpGeneric(packageName: string, config?: McpServerConfig, name?: string): McpToolset;
1601
+
1434
1602
  /**
1435
1603
  * A class for managing MCP tools similar to Python's MCPToolset.
1436
1604
  * Provides functionality to retrieve and use tools from an MCP server.
@@ -1520,15 +1688,28 @@ type index$6_LoadArtifactsTool = LoadArtifactsTool;
1520
1688
  declare const index$6_LoadArtifactsTool: typeof LoadArtifactsTool;
1521
1689
  type index$6_LoadMemoryTool = LoadMemoryTool;
1522
1690
  declare const index$6_LoadMemoryTool: typeof LoadMemoryTool;
1691
+ declare const index$6_McpAbi: typeof McpAbi;
1692
+ declare const index$6_McpAtp: typeof McpAtp;
1693
+ declare const index$6_McpBamm: typeof McpBamm;
1523
1694
  type index$6_McpConfig = McpConfig;
1524
1695
  type index$6_McpError = McpError;
1525
1696
  declare const index$6_McpError: typeof McpError;
1526
1697
  type index$6_McpErrorType = McpErrorType;
1527
1698
  declare const index$6_McpErrorType: typeof McpErrorType;
1699
+ declare const index$6_McpFilesystem: typeof McpFilesystem;
1700
+ declare const index$6_McpFraxlend: typeof McpFraxlend;
1701
+ declare const index$6_McpGeneric: typeof McpGeneric;
1702
+ declare const index$6_McpIqWiki: typeof McpIqWiki;
1703
+ declare const index$6_McpMemory: typeof McpMemory;
1704
+ declare const index$6_McpNearAgent: typeof McpNearAgent;
1705
+ declare const index$6_McpNearIntentSwaps: typeof McpNearIntentSwaps;
1706
+ declare const index$6_McpOdos: typeof McpOdos;
1528
1707
  type index$6_McpSamplingHandler = McpSamplingHandler;
1529
1708
  declare const index$6_McpSamplingHandler: typeof McpSamplingHandler;
1530
1709
  type index$6_McpSamplingRequest = McpSamplingRequest;
1531
1710
  type index$6_McpSamplingResponse = McpSamplingResponse;
1711
+ type index$6_McpServerConfig = McpServerConfig;
1712
+ declare const index$6_McpTelegram: typeof McpTelegram;
1532
1713
  type index$6_McpToolset = McpToolset;
1533
1714
  declare const index$6_McpToolset: typeof McpToolset;
1534
1715
  type index$6_McpTransportType = McpTransportType;
@@ -1549,7 +1730,7 @@ declare const index$6_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
1549
1730
  declare const index$6_mcpSchemaToParameters: typeof mcpSchemaToParameters;
1550
1731
  declare const index$6_normalizeJsonSchema: typeof normalizeJsonSchema;
1551
1732
  declare namespace index$6 {
1552
- export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, 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, type index$6_McpConfig as McpConfig, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, 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_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
1733
+ export { index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, 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, type index$6_McpConfig as McpConfig, 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_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
1553
1734
  }
1554
1735
 
1555
1736
  /**
@@ -3355,10 +3536,282 @@ declare class LangGraphAgent extends BaseAgent {
3355
3536
  setMaxSteps(maxSteps: number): void;
3356
3537
  }
3357
3538
 
3539
+ /**
3540
+ * The Runner class is used to run agents.
3541
+ * It manages the execution of an agent within a session, handling message
3542
+ * processing, event generation, and interaction with various services like
3543
+ * artifact storage, session management, and memory.
3544
+ */
3545
+ declare class Runner {
3546
+ /**
3547
+ * The app name of the runner.
3548
+ */
3549
+ appName: string;
3550
+ /**
3551
+ * The root agent to run.
3552
+ */
3553
+ agent: BaseAgent;
3554
+ /**
3555
+ * The artifact service for the runner.
3556
+ */
3557
+ artifactService?: BaseArtifactService;
3558
+ /**
3559
+ * The session service for the runner.
3560
+ */
3561
+ sessionService: BaseSessionService;
3562
+ /**
3563
+ * The memory service for the runner.
3564
+ */
3565
+ memoryService?: BaseMemoryService;
3566
+ /**
3567
+ * Initializes the Runner.
3568
+ */
3569
+ constructor({ appName, agent, artifactService, sessionService, memoryService, }: {
3570
+ appName: string;
3571
+ agent: BaseAgent;
3572
+ artifactService?: BaseArtifactService;
3573
+ sessionService: BaseSessionService;
3574
+ memoryService?: BaseMemoryService;
3575
+ });
3576
+ /**
3577
+ * Runs the agent synchronously.
3578
+ * NOTE: This sync interface is only for local testing and convenience purpose.
3579
+ * Consider using `runAsync` for production usage.
3580
+ */
3581
+ run({ userId, sessionId, newMessage, runConfig, }: {
3582
+ userId: string;
3583
+ sessionId: string;
3584
+ newMessage: Content$1;
3585
+ runConfig?: RunConfig;
3586
+ }): Generator<Event, void, unknown>;
3587
+ /**
3588
+ * Main entry method to run the agent in this runner.
3589
+ */
3590
+ runAsync({ userId, sessionId, newMessage, runConfig, }: {
3591
+ userId: string;
3592
+ sessionId: string;
3593
+ newMessage: Content$1;
3594
+ runConfig?: RunConfig;
3595
+ }): AsyncGenerator<Event, void, unknown>;
3596
+ /**
3597
+ * Appends a new message to the session.
3598
+ */
3599
+ private _appendNewMessageToSession;
3600
+ /**
3601
+ * Finds the agent to run to continue the session.
3602
+ */
3603
+ private _findAgentToRun;
3604
+ /**
3605
+ * Whether the agent to run can transfer to any other agent in the agent tree.
3606
+ */
3607
+ private _isTransferableAcrossAgentTree;
3608
+ /**
3609
+ * Creates a new invocation context.
3610
+ */
3611
+ private _newInvocationContext;
3612
+ }
3613
+ /**
3614
+ * An in-memory Runner for testing and development.
3615
+ */
3616
+ declare class InMemoryRunner extends Runner {
3617
+ /**
3618
+ * Deprecated. Please don't use. The in-memory session service for the runner.
3619
+ */
3620
+ private _inMemorySessionService;
3621
+ /**
3622
+ * Initializes the InMemoryRunner.
3623
+ */
3624
+ constructor(agent: BaseAgent, { appName }?: {
3625
+ appName?: string;
3626
+ });
3627
+ }
3628
+
3629
+ /**
3630
+ * Configuration options for the AgentBuilder
3631
+ */
3632
+ interface AgentBuilderConfig {
3633
+ name: string;
3634
+ model?: string;
3635
+ description?: string;
3636
+ instruction?: string;
3637
+ tools?: BaseTool[];
3638
+ planner?: BasePlanner;
3639
+ subAgents?: BaseAgent[];
3640
+ maxIterations?: number;
3641
+ nodes?: LangGraphNode[];
3642
+ rootNode?: string;
3643
+ }
3644
+ /**
3645
+ * Session configuration for the AgentBuilder
3646
+ */
3647
+ interface SessionConfig {
3648
+ service: BaseSessionService;
3649
+ userId: string;
3650
+ appName: string;
3651
+ memoryService?: BaseMemoryService;
3652
+ artifactService?: BaseArtifactService;
3653
+ }
3654
+ /**
3655
+ * Built agent result containing the agent and optional runner/session
3656
+ */
3657
+ interface BuiltAgent {
3658
+ agent: BaseAgent;
3659
+ runner?: Runner;
3660
+ session?: Session;
3661
+ }
3662
+ /**
3663
+ * Agent types that can be built
3664
+ */
3665
+ type AgentType = "llm" | "sequential" | "parallel" | "loop" | "langgraph";
3666
+ /**
3667
+ * AgentBuilder - A fluent interface for building agents with optional session management
3668
+ *
3669
+ * This builder provides a convenient way to create agents, manage sessions, and
3670
+ * automatically set up runners without the boilerplate code. It supports all
3671
+ * agent types and maintains backward compatibility with existing interfaces.
3672
+ *
3673
+ * Examples:
3674
+ * ```typescript
3675
+ * // Simplest possible usage
3676
+ * const response = await AgentBuilder
3677
+ * .withModel("gemini-2.5-flash")
3678
+ * .ask("What is the capital of Australia?");
3679
+ *
3680
+ * // Simple agent with name
3681
+ * const { agent } = AgentBuilder
3682
+ * .create("my-agent")
3683
+ * .withModel("gemini-2.5-flash")
3684
+ * .withInstruction("You are helpful")
3685
+ * .build();
3686
+ *
3687
+ * // Agent with session and runner
3688
+ * const { agent, runner, session } = await AgentBuilder
3689
+ * .create("my-agent")
3690
+ * .withModel("gemini-2.5-flash")
3691
+ * .withSession(sessionService, "user123", "myApp")
3692
+ * .build();
3693
+ * ```
3694
+ */
3695
+ declare class AgentBuilder {
3696
+ private config;
3697
+ private sessionConfig?;
3698
+ private agentType;
3699
+ /**
3700
+ * Private constructor - use static create() method
3701
+ */
3702
+ private constructor();
3703
+ /**
3704
+ * Create a new AgentBuilder instance
3705
+ * @param name The name of the agent (defaults to "default_agent")
3706
+ * @returns New AgentBuilder instance
3707
+ */
3708
+ static create(name?: string): AgentBuilder;
3709
+ /**
3710
+ * Convenience method to start building with a model directly
3711
+ * @param model The model identifier (e.g., "gemini-2.5-flash")
3712
+ * @returns New AgentBuilder instance with model set
3713
+ */
3714
+ static withModel(model: string): AgentBuilder;
3715
+ /**
3716
+ * Set the model for the agent
3717
+ * @param model The model identifier (e.g., "gemini-2.5-flash")
3718
+ * @returns This builder instance for chaining
3719
+ */
3720
+ withModel(model: string): this;
3721
+ /**
3722
+ * Set the description for the agent
3723
+ * @param description Agent description
3724
+ * @returns This builder instance for chaining
3725
+ */
3726
+ withDescription(description: string): this;
3727
+ /**
3728
+ * Set the instruction for the agent
3729
+ * @param instruction System instruction for the agent
3730
+ * @returns This builder instance for chaining
3731
+ */
3732
+ withInstruction(instruction: string): this;
3733
+ /**
3734
+ * Add tools to the agent
3735
+ * @param tools Tools to add to the agent
3736
+ * @returns This builder instance for chaining
3737
+ */
3738
+ withTools(...tools: BaseTool[]): this;
3739
+ /**
3740
+ * Set the planner for the agent
3741
+ * @param planner The planner to use
3742
+ * @returns This builder instance for chaining
3743
+ */
3744
+ withPlanner(planner: BasePlanner): this;
3745
+ /**
3746
+ * Configure as a sequential agent
3747
+ * @param subAgents Sub-agents to execute in sequence
3748
+ * @returns This builder instance for chaining
3749
+ */
3750
+ asSequential(subAgents: BaseAgent[]): this;
3751
+ /**
3752
+ * Configure as a parallel agent
3753
+ * @param subAgents Sub-agents to execute in parallel
3754
+ * @returns This builder instance for chaining
3755
+ */
3756
+ asParallel(subAgents: BaseAgent[]): this;
3757
+ /**
3758
+ * Configure as a loop agent
3759
+ * @param subAgents Sub-agents to execute iteratively
3760
+ * @param maxIterations Maximum number of iterations
3761
+ * @returns This builder instance for chaining
3762
+ */
3763
+ asLoop(subAgents: BaseAgent[], maxIterations?: number): this;
3764
+ /**
3765
+ * Configure as a LangGraph agent
3766
+ * @param nodes Graph nodes defining the workflow
3767
+ * @param rootNode The starting node name
3768
+ * @returns This builder instance for chaining
3769
+ */
3770
+ asLangGraph(nodes: LangGraphNode[], rootNode: string): this;
3771
+ /**
3772
+ * Configure session management
3773
+ * @param service Session service to use
3774
+ * @param userId User identifier
3775
+ * @param appName Application name
3776
+ * @param memoryService Optional memory service
3777
+ * @param artifactService Optional artifact service
3778
+ * @returns This builder instance for chaining
3779
+ */
3780
+ withSession(service: BaseSessionService, userId: string, appName: string, memoryService?: BaseMemoryService, artifactService?: BaseArtifactService): this;
3781
+ /**
3782
+ * Configure with an in-memory session (for quick setup)
3783
+ * @param appName Application name
3784
+ * @param userId User identifier
3785
+ * @returns This builder instance for chaining
3786
+ */
3787
+ withQuickSession(appName: string, userId: string): this;
3788
+ /**
3789
+ * Build the agent and optionally create runner and session
3790
+ * @returns Built agent with optional runner and session
3791
+ */
3792
+ build(): Promise<BuiltAgent>;
3793
+ /**
3794
+ * Quick execution helper - build and run a message
3795
+ * @param message Message to send to the agent
3796
+ * @returns Agent response
3797
+ */
3798
+ ask(message: string): Promise<string>;
3799
+ /**
3800
+ * Create the appropriate agent type based on configuration
3801
+ * @returns Created agent instance
3802
+ */
3803
+ private createAgent;
3804
+ }
3805
+
3358
3806
  type index$4_AfterAgentCallback = AfterAgentCallback;
3807
+ type index$4_AgentBuilder = AgentBuilder;
3808
+ declare const index$4_AgentBuilder: typeof AgentBuilder;
3809
+ type index$4_AgentBuilderConfig = AgentBuilderConfig;
3810
+ type index$4_AgentType = AgentType;
3359
3811
  type index$4_BaseAgent = BaseAgent;
3360
3812
  declare const index$4_BaseAgent: typeof BaseAgent;
3361
3813
  type index$4_BeforeAgentCallback = BeforeAgentCallback;
3814
+ type index$4_BuiltAgent = BuiltAgent;
3362
3815
  type index$4_CallbackContext = CallbackContext;
3363
3816
  declare const index$4_CallbackContext: typeof CallbackContext;
3364
3817
  type index$4_InstructionProvider = InstructionProvider;
@@ -3386,13 +3839,14 @@ declare const index$4_RunConfig: typeof RunConfig;
3386
3839
  type index$4_SequentialAgent = SequentialAgent;
3387
3840
  declare const index$4_SequentialAgent: typeof SequentialAgent;
3388
3841
  type index$4_SequentialAgentConfig = SequentialAgentConfig;
3842
+ type index$4_SessionConfig = SessionConfig;
3389
3843
  type index$4_SingleAgentCallback = SingleAgentCallback;
3390
3844
  type index$4_StreamingMode = StreamingMode;
3391
3845
  declare const index$4_StreamingMode: typeof StreamingMode;
3392
3846
  type index$4_ToolUnion = ToolUnion;
3393
3847
  declare const index$4_newInvocationContextId: typeof newInvocationContextId;
3394
3848
  declare namespace index$4 {
3395
- export { type index$4_AfterAgentCallback as AfterAgentCallback, LlmAgent as Agent, index$4_BaseAgent as BaseAgent, type index$4_BeforeAgentCallback as BeforeAgentCallback, index$4_CallbackContext as CallbackContext, 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, 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_SingleAgentCallback as SingleAgentCallback, index$4_StreamingMode as StreamingMode, type index$4_ToolUnion as ToolUnion, index$4_newInvocationContextId as newInvocationContextId };
3849
+ 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_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, 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_SessionConfig as SessionConfig, type index$4_SingleAgentCallback as SingleAgentCallback, index$4_StreamingMode as StreamingMode, type index$4_ToolUnion as ToolUnion, index$4_newInvocationContextId as newInvocationContextId };
3396
3850
  }
3397
3851
 
3398
3852
  /**
@@ -4108,96 +4562,6 @@ declare class PlanReActPlanner extends BasePlanner {
4108
4562
  private _buildNlPlannerInstruction;
4109
4563
  }
4110
4564
 
4111
- /**
4112
- * The Runner class is used to run agents.
4113
- * It manages the execution of an agent within a session, handling message
4114
- * processing, event generation, and interaction with various services like
4115
- * artifact storage, session management, and memory.
4116
- */
4117
- declare class Runner {
4118
- /**
4119
- * The app name of the runner.
4120
- */
4121
- appName: string;
4122
- /**
4123
- * The root agent to run.
4124
- */
4125
- agent: BaseAgent;
4126
- /**
4127
- * The artifact service for the runner.
4128
- */
4129
- artifactService?: BaseArtifactService;
4130
- /**
4131
- * The session service for the runner.
4132
- */
4133
- sessionService: BaseSessionService;
4134
- /**
4135
- * The memory service for the runner.
4136
- */
4137
- memoryService?: BaseMemoryService;
4138
- /**
4139
- * Initializes the Runner.
4140
- */
4141
- constructor({ appName, agent, artifactService, sessionService, memoryService, }: {
4142
- appName: string;
4143
- agent: BaseAgent;
4144
- artifactService?: BaseArtifactService;
4145
- sessionService: BaseSessionService;
4146
- memoryService?: BaseMemoryService;
4147
- });
4148
- /**
4149
- * Runs the agent synchronously.
4150
- * NOTE: This sync interface is only for local testing and convenience purpose.
4151
- * Consider using `runAsync` for production usage.
4152
- */
4153
- run({ userId, sessionId, newMessage, runConfig, }: {
4154
- userId: string;
4155
- sessionId: string;
4156
- newMessage: Content$1;
4157
- runConfig?: RunConfig;
4158
- }): Generator<Event, void, unknown>;
4159
- /**
4160
- * Main entry method to run the agent in this runner.
4161
- */
4162
- runAsync({ userId, sessionId, newMessage, runConfig, }: {
4163
- userId: string;
4164
- sessionId: string;
4165
- newMessage: Content$1;
4166
- runConfig?: RunConfig;
4167
- }): AsyncGenerator<Event, void, unknown>;
4168
- /**
4169
- * Appends a new message to the session.
4170
- */
4171
- private _appendNewMessageToSession;
4172
- /**
4173
- * Finds the agent to run to continue the session.
4174
- */
4175
- private _findAgentToRun;
4176
- /**
4177
- * Whether the agent to run can transfer to any other agent in the agent tree.
4178
- */
4179
- private _isTransferableAcrossAgentTree;
4180
- /**
4181
- * Creates a new invocation context.
4182
- */
4183
- private _newInvocationContext;
4184
- }
4185
- /**
4186
- * An in-memory Runner for testing and development.
4187
- */
4188
- declare class InMemoryRunner extends Runner {
4189
- /**
4190
- * Deprecated. Please don't use. The in-memory session service for the runner.
4191
- */
4192
- private _inMemorySessionService;
4193
- /**
4194
- * Initializes the InMemoryRunner.
4195
- */
4196
- constructor(agent: BaseAgent, { appName }?: {
4197
- appName?: string;
4198
- });
4199
- }
4200
-
4201
4565
  interface TelemetryConfig {
4202
4566
  appName: string;
4203
4567
  appVersion?: string;
@@ -4270,4 +4634,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
4270
4634
 
4271
4635
  declare const VERSION = "0.1.0";
4272
4636
 
4273
- export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, index$4 as Agents, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, BuiltInPlanner, CallbackContext, DatabaseSessionService, EnhancedAuthConfig, Event, EventActions, index$1 as Events, ExitLoopTool, FileOperationsTool, index as Flows, 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, type McpConfig, McpError, McpErrorType, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, McpToolset, type McpTransportType, index$3 as Memory, 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, 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, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
4637
+ export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentType, index$4 as Agents, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInPlanner, CallbackContext, DatabaseSessionService, EnhancedAuthConfig, Event, EventActions, index$1 as Events, ExitLoopTool, FileOperationsTool, index as Flows, 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, type McpConfig, 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, 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 SessionConfig, 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, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };