@iqai/adk 0.1.6 → 0.1.7
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 +6 -0
- package/README.md +113 -20
- package/dist/index.d.mts +181 -126
- package/dist/index.d.ts +181 -126
- package/dist/index.js +86 -46
- package/dist/index.mjs +85 -45
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="https://files.catbox.moe/vumztw.png" alt="ADK TypeScript Logo" width="100" />
|
|
4
|
+
|
|
5
|
+
<br/>
|
|
6
|
+
|
|
7
|
+
# @iqai/adk
|
|
8
|
+
|
|
9
|
+
**The core TypeScript library for building sophisticated AI agents with multi-LLM support, advanced tools, and flexible conversation flows.**
|
|
10
|
+
|
|
11
|
+
*Production-ready • Multi-Agent Systems • Extensible Architecture*
|
|
4
12
|
|
|
5
13
|
<p align="center">
|
|
6
14
|
<a href="https://www.npmjs.com/package/@iqai/adk">
|
|
@@ -17,30 +25,43 @@
|
|
|
17
25
|
</a>
|
|
18
26
|
</p>
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
</div>
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
## 🌟 Overview
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
`@iqai/adk` is the core TypeScript library for the Agent Development Kit, providing the foundational tools and abstractions to build sophisticated AI agents. It enables seamless integration with multiple Large Language Models (LLMs), advanced tool usage, and persistent memory capabilities.
|
|
35
|
+
|
|
36
|
+
## 🚀 Key Features
|
|
37
|
+
|
|
38
|
+
- **🤖 Multi-Provider LLM Support** - Seamlessly integrate OpenAI, Anthropic, Google, and other leading providers
|
|
39
|
+
- **🛠️ Extensible Tool System** - Define custom tools with declarative schemas for intelligent LLM integration
|
|
40
|
+
- **🧠 Advanced Agent Reasoning** - Complete reasoning loop implementation for complex task execution
|
|
41
|
+
- **⚡ Real-Time Streaming** - Support for streaming responses and dynamic user interactions
|
|
42
|
+
- **🔐 Flexible Authentication** - Secure agent API access with multiple auth mechanisms
|
|
43
|
+
- **💾 Persistent Memory Systems** - Context retention and learning from past interactions
|
|
44
|
+
- **🔄 Multi-Agent Orchestration** - Sequential, parallel, and loop-based agent workflows
|
|
45
|
+
- **📊 Built-in Telemetry** - Comprehensive monitoring and analytics capabilities
|
|
30
46
|
|
|
31
|
-
##
|
|
47
|
+
## 🚀 Quick Start
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
### Installation
|
|
34
50
|
|
|
35
51
|
```bash
|
|
36
|
-
# Using npm
|
|
37
52
|
npm install @iqai/adk
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Simple Example
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { AgentBuilder } from '@iqai/adk';
|
|
38
59
|
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
const response = await AgentBuilder
|
|
61
|
+
.withModel("gpt-4")
|
|
62
|
+
.ask("What is the primary function of an AI agent?");
|
|
41
63
|
|
|
42
|
-
|
|
43
|
-
pnpm add @iqai/adk
|
|
64
|
+
console.log(response);
|
|
44
65
|
```
|
|
45
66
|
|
|
46
67
|
## ⚙️ Environment Configuration
|
|
@@ -228,12 +249,84 @@ async function performCalculation() {
|
|
|
228
249
|
performCalculation().catch(console.error);
|
|
229
250
|
```
|
|
230
251
|
|
|
231
|
-
|
|
252
|
+
## 🏗️ Advanced Features
|
|
253
|
+
|
|
254
|
+
### Multi-Agent Systems
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
import { AgentBuilder } from '@iqai/adk';
|
|
258
|
+
|
|
259
|
+
// Sequential workflow
|
|
260
|
+
const workflow = await AgentBuilder
|
|
261
|
+
.create("data_pipeline")
|
|
262
|
+
.asSequential([dataCollector, dataProcessor, dataAnalyzer])
|
|
263
|
+
.withQuickSession("pipeline-app", "admin")
|
|
264
|
+
.build();
|
|
265
|
+
|
|
266
|
+
// Parallel execution
|
|
267
|
+
const parallelAnalysis = await AgentBuilder
|
|
268
|
+
.create("multi_analysis")
|
|
269
|
+
.asParallel([sentimentAnalyzer, topicExtractor, summaryGenerator])
|
|
270
|
+
.build();
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Memory & Sessions
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
import { Agent, InMemorySessionService } from '@iqai/adk';
|
|
277
|
+
|
|
278
|
+
const agent = new Agent({
|
|
279
|
+
name: "persistent_assistant",
|
|
280
|
+
model: "gpt-4-turbo",
|
|
281
|
+
sessionService: new InMemorySessionService(),
|
|
282
|
+
instructions: "Remember our conversation history."
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Custom Tools
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
import { BaseTool } from '@iqai/adk';
|
|
290
|
+
|
|
291
|
+
class WeatherTool extends BaseTool {
|
|
292
|
+
constructor() {
|
|
293
|
+
super({
|
|
294
|
+
name: 'weather',
|
|
295
|
+
description: 'Get current weather information'
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
async runAsync(args: { location: string }) {
|
|
300
|
+
// Implementation here
|
|
301
|
+
return { temperature: 72, condition: 'sunny' };
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## 📚 Documentation
|
|
307
|
+
|
|
308
|
+
For comprehensive guides, API reference, and advanced examples:
|
|
309
|
+
|
|
310
|
+
**[https://adk.iqai.com](https://adk.iqai.com)**
|
|
311
|
+
|
|
312
|
+
## 🧪 Examples
|
|
313
|
+
|
|
314
|
+
Explore comprehensive examples in the main repository:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
git clone https://github.com/IQAIcom/adk-ts
|
|
318
|
+
cd adk-ts/apps/examples
|
|
319
|
+
pnpm install && pnpm dev
|
|
320
|
+
```
|
|
232
321
|
|
|
233
322
|
## 🤝 Contributing
|
|
234
323
|
|
|
235
|
-
|
|
324
|
+
Contributions are welcome! See our [Contributing Guide](https://github.com/IQAIcom/adk-ts/blob/main/CONTRIBUTION.md) for details.
|
|
236
325
|
|
|
237
326
|
## 📜 License
|
|
238
327
|
|
|
239
|
-
|
|
328
|
+
MIT License - see [LICENSE](https://github.com/IQAIcom/adk-ts/blob/main/LICENSE.md) for details.
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
**Ready to build your first AI agent?** Visit [https://adk.iqai.com](https://adk.iqai.com) to get started!
|
package/dist/index.d.mts
CHANGED
|
@@ -3538,6 +3538,17 @@ declare class SequentialAgent extends BaseAgent {
|
|
|
3538
3538
|
protected runLiveImpl(ctx: InvocationContext): AsyncGenerator<Event, void, unknown>;
|
|
3539
3539
|
}
|
|
3540
3540
|
|
|
3541
|
+
/**
|
|
3542
|
+
* Create isolated branch for every sub-agent.
|
|
3543
|
+
*/
|
|
3544
|
+
declare function createBranchContextForSubAgent(agent: BaseAgent, subAgent: BaseAgent, invocationContext: InvocationContext): InvocationContext;
|
|
3545
|
+
/**
|
|
3546
|
+
* Merges the agent run event generator.
|
|
3547
|
+
*
|
|
3548
|
+
* This implementation guarantees for each agent, it won't move on until the
|
|
3549
|
+
* generated event is processed by upstream runner.
|
|
3550
|
+
*/
|
|
3551
|
+
declare function mergeAgentRun(agentRuns: AsyncGenerator<Event, void, unknown>[]): AsyncGenerator<Event, void, unknown>;
|
|
3541
3552
|
/**
|
|
3542
3553
|
* Configuration for ParallelAgent
|
|
3543
3554
|
*/
|
|
@@ -3749,97 +3760,6 @@ declare class LangGraphAgent extends BaseAgent {
|
|
|
3749
3760
|
setMaxSteps(maxSteps: number): void;
|
|
3750
3761
|
}
|
|
3751
3762
|
|
|
3752
|
-
/**
|
|
3753
|
-
* The Runner class is used to run agents.
|
|
3754
|
-
* It manages the execution of an agent within a session, handling message
|
|
3755
|
-
* processing, event generation, and interaction with various services like
|
|
3756
|
-
* artifact storage, session management, and memory.
|
|
3757
|
-
*/
|
|
3758
|
-
declare class Runner<T extends BaseAgent = BaseAgent> {
|
|
3759
|
-
/**
|
|
3760
|
-
* The app name of the runner.
|
|
3761
|
-
*/
|
|
3762
|
-
appName: string;
|
|
3763
|
-
/**
|
|
3764
|
-
* The root agent to run.
|
|
3765
|
-
*/
|
|
3766
|
-
agent: T;
|
|
3767
|
-
/**
|
|
3768
|
-
* The artifact service for the runner.
|
|
3769
|
-
*/
|
|
3770
|
-
artifactService?: BaseArtifactService;
|
|
3771
|
-
/**
|
|
3772
|
-
* The session service for the runner.
|
|
3773
|
-
*/
|
|
3774
|
-
sessionService: BaseSessionService;
|
|
3775
|
-
/**
|
|
3776
|
-
* The memory service for the runner.
|
|
3777
|
-
*/
|
|
3778
|
-
memoryService?: BaseMemoryService;
|
|
3779
|
-
protected logger: Logger;
|
|
3780
|
-
/**
|
|
3781
|
-
* Initializes the Runner.
|
|
3782
|
-
*/
|
|
3783
|
-
constructor({ appName, agent, artifactService, sessionService, memoryService, }: {
|
|
3784
|
-
appName: string;
|
|
3785
|
-
agent: T;
|
|
3786
|
-
artifactService?: BaseArtifactService;
|
|
3787
|
-
sessionService: BaseSessionService;
|
|
3788
|
-
memoryService?: BaseMemoryService;
|
|
3789
|
-
});
|
|
3790
|
-
/**
|
|
3791
|
-
* Runs the agent synchronously.
|
|
3792
|
-
* NOTE: This sync interface is only for local testing and convenience purpose.
|
|
3793
|
-
* Consider using `runAsync` for production usage.
|
|
3794
|
-
*/
|
|
3795
|
-
run({ userId, sessionId, newMessage, runConfig, }: {
|
|
3796
|
-
userId: string;
|
|
3797
|
-
sessionId: string;
|
|
3798
|
-
newMessage: Content$1;
|
|
3799
|
-
runConfig?: RunConfig;
|
|
3800
|
-
}): Generator<Event, void, unknown>;
|
|
3801
|
-
/**
|
|
3802
|
-
* Main entry method to run the agent in this runner.
|
|
3803
|
-
*/
|
|
3804
|
-
runAsync({ userId, sessionId, newMessage, runConfig, }: {
|
|
3805
|
-
userId: string;
|
|
3806
|
-
sessionId: string;
|
|
3807
|
-
newMessage: Content$1;
|
|
3808
|
-
runConfig?: RunConfig;
|
|
3809
|
-
}): AsyncGenerator<Event, void, unknown>;
|
|
3810
|
-
/**
|
|
3811
|
-
* Appends a new message to the session.
|
|
3812
|
-
*/
|
|
3813
|
-
private _appendNewMessageToSession;
|
|
3814
|
-
/**
|
|
3815
|
-
* Finds the agent to run to continue the session.
|
|
3816
|
-
*/
|
|
3817
|
-
private _findAgentToRun;
|
|
3818
|
-
/**
|
|
3819
|
-
* Whether the agent to run can transfer to any other agent in the agent tree.
|
|
3820
|
-
*/
|
|
3821
|
-
private _isTransferableAcrossAgentTree;
|
|
3822
|
-
/**
|
|
3823
|
-
* Creates a new invocation context.
|
|
3824
|
-
*/
|
|
3825
|
-
private _newInvocationContext;
|
|
3826
|
-
}
|
|
3827
|
-
/**
|
|
3828
|
-
* An in-memory Runner for testing and development.
|
|
3829
|
-
*/
|
|
3830
|
-
declare class InMemoryRunner<T extends BaseAgent = BaseAgent> extends Runner<T> {
|
|
3831
|
-
/**
|
|
3832
|
-
* Deprecated. Please don't use. The in-memory session service for the runner.
|
|
3833
|
-
*/
|
|
3834
|
-
private _inMemorySessionService;
|
|
3835
|
-
/**
|
|
3836
|
-
* Initializes the InMemoryRunner.
|
|
3837
|
-
*/
|
|
3838
|
-
constructor(agent: T, { appName }?: {
|
|
3839
|
-
appName?: string;
|
|
3840
|
-
});
|
|
3841
|
-
}
|
|
3842
|
-
|
|
3843
3763
|
/**
|
|
3844
3764
|
* Configuration options for the AgentBuilder
|
|
3845
3765
|
*/
|
|
@@ -3865,12 +3785,35 @@ interface SessionConfig {
|
|
|
3865
3785
|
memoryService?: BaseMemoryService;
|
|
3866
3786
|
artifactService?: BaseArtifactService;
|
|
3867
3787
|
}
|
|
3788
|
+
/**
|
|
3789
|
+
* Message part interface for flexible message input
|
|
3790
|
+
*/
|
|
3791
|
+
interface MessagePart extends Part {
|
|
3792
|
+
image?: string;
|
|
3793
|
+
}
|
|
3794
|
+
/**
|
|
3795
|
+
* Full message interface for advanced usage
|
|
3796
|
+
*/
|
|
3797
|
+
interface FullMessage extends Content$1 {
|
|
3798
|
+
parts?: MessagePart[];
|
|
3799
|
+
}
|
|
3800
|
+
/**
|
|
3801
|
+
* Enhanced runner interface with simplified API
|
|
3802
|
+
*/
|
|
3803
|
+
interface EnhancedRunner {
|
|
3804
|
+
ask(message: string | FullMessage): Promise<string>;
|
|
3805
|
+
runAsync(params: {
|
|
3806
|
+
userId: string;
|
|
3807
|
+
sessionId: string;
|
|
3808
|
+
newMessage: FullMessage;
|
|
3809
|
+
}): AsyncIterable<Event>;
|
|
3810
|
+
}
|
|
3868
3811
|
/**
|
|
3869
3812
|
* Built agent result containing the agent and optional runner/session
|
|
3870
3813
|
*/
|
|
3871
3814
|
interface BuiltAgent {
|
|
3872
3815
|
agent: BaseAgent;
|
|
3873
|
-
runner?:
|
|
3816
|
+
runner?: EnhancedRunner;
|
|
3874
3817
|
session?: Session;
|
|
3875
3818
|
}
|
|
3876
3819
|
/**
|
|
@@ -3878,36 +3821,30 @@ interface BuiltAgent {
|
|
|
3878
3821
|
*/
|
|
3879
3822
|
type AgentType = "llm" | "sequential" | "parallel" | "loop" | "langgraph";
|
|
3880
3823
|
/**
|
|
3881
|
-
* AgentBuilder - A fluent interface for
|
|
3824
|
+
* AgentBuilder - A fluent interface for creating AI agents with automatic session management
|
|
3882
3825
|
*
|
|
3883
|
-
*
|
|
3884
|
-
*
|
|
3885
|
-
*
|
|
3826
|
+
* Provides a simple, chainable API for building different types of agents (LLM, Sequential,
|
|
3827
|
+
* Parallel, Loop, LangGraph) with tools, custom instructions, and multi-agent workflows.
|
|
3828
|
+
* Sessions are automatically created using in-memory storage by default.
|
|
3886
3829
|
*
|
|
3887
|
-
*
|
|
3830
|
+
* @example
|
|
3888
3831
|
* ```typescript
|
|
3889
|
-
* //
|
|
3890
|
-
* const response = await AgentBuilder
|
|
3891
|
-
* .withModel("gemini-2.5-flash")
|
|
3892
|
-
* .ask("What is the capital of Australia?");
|
|
3832
|
+
* // Simple usage
|
|
3833
|
+
* const response = await AgentBuilder.withModel("gemini-2.5-flash").ask("Hello");
|
|
3893
3834
|
*
|
|
3894
|
-
* //
|
|
3895
|
-
* const {
|
|
3896
|
-
* .create("
|
|
3835
|
+
* // With tools and instructions
|
|
3836
|
+
* const { runner } = await AgentBuilder
|
|
3837
|
+
* .create("research-agent")
|
|
3897
3838
|
* .withModel("gemini-2.5-flash")
|
|
3898
|
-
* .
|
|
3839
|
+
* .withTools(new GoogleSearch())
|
|
3840
|
+
* .withInstruction("You are a research assistant")
|
|
3899
3841
|
* .build();
|
|
3900
3842
|
*
|
|
3901
|
-
* //
|
|
3902
|
-
* const {
|
|
3903
|
-
* .create("
|
|
3904
|
-
* .
|
|
3905
|
-
* .withSession(sessionService, "user123", "myApp")
|
|
3843
|
+
* // Multi-agent workflow
|
|
3844
|
+
* const { runner } = await AgentBuilder
|
|
3845
|
+
* .create("workflow")
|
|
3846
|
+
* .asSequential([agent1, agent2])
|
|
3906
3847
|
* .build();
|
|
3907
|
-
*
|
|
3908
|
-
* // Using an AI SDK provider directly
|
|
3909
|
-
* import { google } from "@ai-sdk/google";
|
|
3910
|
-
* const response = await AgentBuilder.withModel(google()).ask("Hi");
|
|
3911
3848
|
* ```
|
|
3912
3849
|
*/
|
|
3913
3850
|
declare class AgentBuilder {
|
|
@@ -3987,22 +3924,23 @@ declare class AgentBuilder {
|
|
|
3987
3924
|
*/
|
|
3988
3925
|
asLangGraph(nodes: LangGraphNode[], rootNode: string): this;
|
|
3989
3926
|
/**
|
|
3990
|
-
* Configure session management
|
|
3927
|
+
* Configure session management with optional smart defaults
|
|
3991
3928
|
* @param service Session service to use
|
|
3992
|
-
* @param userId User identifier
|
|
3993
|
-
* @param appName Application name
|
|
3929
|
+
* @param userId User identifier (optional, defaults to agent-based ID)
|
|
3930
|
+
* @param appName Application name (optional, defaults to agent-based name)
|
|
3994
3931
|
* @param memoryService Optional memory service
|
|
3995
3932
|
* @param artifactService Optional artifact service
|
|
3996
3933
|
* @returns This builder instance for chaining
|
|
3997
3934
|
*/
|
|
3998
|
-
withSession(service: BaseSessionService, userId
|
|
3935
|
+
withSession(service: BaseSessionService, userId?: string, appName?: string, memoryService?: BaseMemoryService, artifactService?: BaseArtifactService): this;
|
|
3999
3936
|
/**
|
|
4000
|
-
* Configure with an in-memory session
|
|
4001
|
-
*
|
|
4002
|
-
* @param
|
|
3937
|
+
* Configure with an in-memory session with custom IDs
|
|
3938
|
+
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
|
3939
|
+
* @param appName Application name (optional, defaults to agent-based name)
|
|
3940
|
+
* @param userId User identifier (optional, defaults to agent-based ID)
|
|
4003
3941
|
* @returns This builder instance for chaining
|
|
4004
3942
|
*/
|
|
4005
|
-
withQuickSession(appName
|
|
3943
|
+
withQuickSession(appName?: string, userId?: string): this;
|
|
4006
3944
|
/**
|
|
4007
3945
|
* Build the agent and optionally create runner and session
|
|
4008
3946
|
* @returns Built agent with optional runner and session
|
|
@@ -4010,15 +3948,32 @@ declare class AgentBuilder {
|
|
|
4010
3948
|
build(): Promise<BuiltAgent>;
|
|
4011
3949
|
/**
|
|
4012
3950
|
* Quick execution helper - build and run a message
|
|
4013
|
-
* @param message Message to send to the agent
|
|
3951
|
+
* @param message Message to send to the agent (string or full message object)
|
|
4014
3952
|
* @returns Agent response
|
|
4015
3953
|
*/
|
|
4016
|
-
ask(message: string): Promise<string>;
|
|
3954
|
+
ask(message: string | FullMessage): Promise<string>;
|
|
4017
3955
|
/**
|
|
4018
3956
|
* Create the appropriate agent type based on configuration
|
|
4019
3957
|
* @returns Created agent instance
|
|
4020
3958
|
*/
|
|
4021
3959
|
private createAgent;
|
|
3960
|
+
/**
|
|
3961
|
+
* Generate default user ID based on agent name and id
|
|
3962
|
+
* @returns Generated user ID
|
|
3963
|
+
*/
|
|
3964
|
+
private generateDefaultUserId;
|
|
3965
|
+
/**
|
|
3966
|
+
* Generate default app name based on agent name
|
|
3967
|
+
* @returns Generated app name
|
|
3968
|
+
*/
|
|
3969
|
+
private generateDefaultAppName;
|
|
3970
|
+
/**
|
|
3971
|
+
* Create enhanced runner with simplified API
|
|
3972
|
+
* @param baseRunner The base runner instance
|
|
3973
|
+
* @param session The session instance
|
|
3974
|
+
* @returns Enhanced runner with simplified API
|
|
3975
|
+
*/
|
|
3976
|
+
private createEnhancedRunner;
|
|
4022
3977
|
}
|
|
4023
3978
|
|
|
4024
3979
|
type index$4_AfterAgentCallback = AfterAgentCallback;
|
|
@@ -4032,6 +3987,8 @@ type index$4_BeforeAgentCallback = BeforeAgentCallback;
|
|
|
4032
3987
|
type index$4_BuiltAgent = BuiltAgent;
|
|
4033
3988
|
type index$4_CallbackContext = CallbackContext;
|
|
4034
3989
|
declare const index$4_CallbackContext: typeof CallbackContext;
|
|
3990
|
+
type index$4_EnhancedRunner = EnhancedRunner;
|
|
3991
|
+
type index$4_FullMessage = FullMessage;
|
|
4035
3992
|
type index$4_InstructionProvider = InstructionProvider;
|
|
4036
3993
|
type index$4_InvocationContext = InvocationContext;
|
|
4037
3994
|
declare const index$4_InvocationContext: typeof InvocationContext;
|
|
@@ -4047,6 +4004,7 @@ declare const index$4_LlmCallsLimitExceededError: typeof LlmCallsLimitExceededEr
|
|
|
4047
4004
|
type index$4_LoopAgent = LoopAgent;
|
|
4048
4005
|
declare const index$4_LoopAgent: typeof LoopAgent;
|
|
4049
4006
|
type index$4_LoopAgentConfig = LoopAgentConfig;
|
|
4007
|
+
type index$4_MessagePart = MessagePart;
|
|
4050
4008
|
type index$4_ParallelAgent = ParallelAgent;
|
|
4051
4009
|
declare const index$4_ParallelAgent: typeof ParallelAgent;
|
|
4052
4010
|
type index$4_ParallelAgentConfig = ParallelAgentConfig;
|
|
@@ -4062,9 +4020,11 @@ type index$4_SingleAgentCallback = SingleAgentCallback;
|
|
|
4062
4020
|
type index$4_StreamingMode = StreamingMode;
|
|
4063
4021
|
declare const index$4_StreamingMode: typeof StreamingMode;
|
|
4064
4022
|
type index$4_ToolUnion = ToolUnion;
|
|
4023
|
+
declare const index$4_createBranchContextForSubAgent: typeof createBranchContextForSubAgent;
|
|
4024
|
+
declare const index$4_mergeAgentRun: typeof mergeAgentRun;
|
|
4065
4025
|
declare const index$4_newInvocationContextId: typeof newInvocationContextId;
|
|
4066
4026
|
declare namespace index$4 {
|
|
4067
|
-
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 };
|
|
4027
|
+
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_SessionConfig as SessionConfig, 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 };
|
|
4068
4028
|
}
|
|
4069
4029
|
|
|
4070
4030
|
/**
|
|
@@ -4848,6 +4808,101 @@ declare class PlanReActPlanner extends BasePlanner {
|
|
|
4848
4808
|
private _buildNlPlannerInstruction;
|
|
4849
4809
|
}
|
|
4850
4810
|
|
|
4811
|
+
/**
|
|
4812
|
+
* Find function call event if last event is function response.
|
|
4813
|
+
*/
|
|
4814
|
+
declare function _findFunctionCallEventIfLastEventIsFunctionResponse(session: Session): Event | null;
|
|
4815
|
+
/**
|
|
4816
|
+
* The Runner class is used to run agents.
|
|
4817
|
+
* It manages the execution of an agent within a session, handling message
|
|
4818
|
+
* processing, event generation, and interaction with various services like
|
|
4819
|
+
* artifact storage, session management, and memory.
|
|
4820
|
+
*/
|
|
4821
|
+
declare class Runner<T extends BaseAgent = BaseAgent> {
|
|
4822
|
+
/**
|
|
4823
|
+
* The app name of the runner.
|
|
4824
|
+
*/
|
|
4825
|
+
appName: string;
|
|
4826
|
+
/**
|
|
4827
|
+
* The root agent to run.
|
|
4828
|
+
*/
|
|
4829
|
+
agent: T;
|
|
4830
|
+
/**
|
|
4831
|
+
* The artifact service for the runner.
|
|
4832
|
+
*/
|
|
4833
|
+
artifactService?: BaseArtifactService;
|
|
4834
|
+
/**
|
|
4835
|
+
* The session service for the runner.
|
|
4836
|
+
*/
|
|
4837
|
+
sessionService: BaseSessionService;
|
|
4838
|
+
/**
|
|
4839
|
+
* The memory service for the runner.
|
|
4840
|
+
*/
|
|
4841
|
+
memoryService?: BaseMemoryService;
|
|
4842
|
+
protected logger: Logger;
|
|
4843
|
+
/**
|
|
4844
|
+
* Initializes the Runner.
|
|
4845
|
+
*/
|
|
4846
|
+
constructor({ appName, agent, artifactService, sessionService, memoryService, }: {
|
|
4847
|
+
appName: string;
|
|
4848
|
+
agent: T;
|
|
4849
|
+
artifactService?: BaseArtifactService;
|
|
4850
|
+
sessionService: BaseSessionService;
|
|
4851
|
+
memoryService?: BaseMemoryService;
|
|
4852
|
+
});
|
|
4853
|
+
/**
|
|
4854
|
+
* Runs the agent synchronously.
|
|
4855
|
+
* NOTE: This sync interface is only for local testing and convenience purpose.
|
|
4856
|
+
* Consider using `runAsync` for production usage.
|
|
4857
|
+
*/
|
|
4858
|
+
run({ userId, sessionId, newMessage, runConfig, }: {
|
|
4859
|
+
userId: string;
|
|
4860
|
+
sessionId: string;
|
|
4861
|
+
newMessage: Content$1;
|
|
4862
|
+
runConfig?: RunConfig;
|
|
4863
|
+
}): Generator<Event, void, unknown>;
|
|
4864
|
+
/**
|
|
4865
|
+
* Main entry method to run the agent in this runner.
|
|
4866
|
+
*/
|
|
4867
|
+
runAsync({ userId, sessionId, newMessage, runConfig, }: {
|
|
4868
|
+
userId: string;
|
|
4869
|
+
sessionId: string;
|
|
4870
|
+
newMessage: Content$1;
|
|
4871
|
+
runConfig?: RunConfig;
|
|
4872
|
+
}): AsyncGenerator<Event, void, unknown>;
|
|
4873
|
+
/**
|
|
4874
|
+
* Appends a new message to the session.
|
|
4875
|
+
*/
|
|
4876
|
+
private _appendNewMessageToSession;
|
|
4877
|
+
/**
|
|
4878
|
+
* Finds the agent to run to continue the session.
|
|
4879
|
+
*/
|
|
4880
|
+
private _findAgentToRun;
|
|
4881
|
+
/**
|
|
4882
|
+
* Whether the agent to run can transfer to any other agent in the agent tree.
|
|
4883
|
+
*/
|
|
4884
|
+
private _isTransferableAcrossAgentTree;
|
|
4885
|
+
/**
|
|
4886
|
+
* Creates a new invocation context.
|
|
4887
|
+
*/
|
|
4888
|
+
private _newInvocationContext;
|
|
4889
|
+
}
|
|
4890
|
+
/**
|
|
4891
|
+
* An in-memory Runner for testing and development.
|
|
4892
|
+
*/
|
|
4893
|
+
declare class InMemoryRunner<T extends BaseAgent = BaseAgent> extends Runner<T> {
|
|
4894
|
+
/**
|
|
4895
|
+
* Deprecated. Please don't use. The in-memory session service for the runner.
|
|
4896
|
+
*/
|
|
4897
|
+
private _inMemorySessionService;
|
|
4898
|
+
/**
|
|
4899
|
+
* Initializes the InMemoryRunner.
|
|
4900
|
+
*/
|
|
4901
|
+
constructor(agent: T, { appName }?: {
|
|
4902
|
+
appName?: string;
|
|
4903
|
+
});
|
|
4904
|
+
}
|
|
4905
|
+
|
|
4851
4906
|
interface TelemetryConfig {
|
|
4852
4907
|
appName: string;
|
|
4853
4908
|
appVersion?: string;
|
|
@@ -4920,4 +4975,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
|
|
|
4920
4975
|
|
|
4921
4976
|
declare const VERSION = "0.1.0";
|
|
4922
4977
|
|
|
4923
|
-
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, DatabaseSessionService, EnhancedAuthConfig, Event, EventActions, index$1 as Events, ExitLoopTool, type File, 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, McpCoinGecko, 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 };
|
|
4978
|
+
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, 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, 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 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, _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, 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 };
|