@aigne/core 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/LICENSE +93 -0
- package/README.md +90 -0
- package/README.zh.md +90 -0
- package/lib/cjs/agents/agent.d.ts +21 -20
- package/lib/cjs/agents/agent.js +29 -26
- package/lib/cjs/agents/ai-agent.d.ts +9 -8
- package/lib/cjs/agents/ai-agent.js +20 -14
- package/lib/cjs/agents/mcp-agent.d.ts +10 -4
- package/lib/cjs/agents/mcp-agent.js +12 -6
- package/lib/cjs/agents/memory.d.ts +1 -1
- package/lib/cjs/agents/team-agent.d.ts +28 -0
- package/lib/cjs/agents/team-agent.js +93 -0
- package/lib/cjs/agents/user-agent.d.ts +9 -10
- package/lib/cjs/agents/user-agent.js +10 -13
- package/lib/{esm/execution-engine/execution-engine.d.ts → cjs/aigne/aigne.d.ts} +9 -12
- package/lib/cjs/{execution-engine/execution-engine.js → aigne/aigne.js} +19 -19
- package/lib/cjs/{execution-engine → aigne}/context.d.ts +31 -32
- package/lib/cjs/{execution-engine → aigne}/context.js +30 -40
- package/lib/cjs/aigne/index.d.ts +4 -0
- package/lib/cjs/{execution-engine → aigne}/index.js +2 -2
- package/lib/cjs/{execution-engine → aigne}/usage.d.ts +1 -1
- package/lib/cjs/client/client.d.ts +19 -0
- package/lib/cjs/client/client.js +49 -0
- package/lib/cjs/index.d.ts +2 -1
- package/lib/cjs/index.js +2 -1
- package/lib/cjs/loader/agent-js.d.ts +2 -2
- package/lib/cjs/loader/agent-js.js +4 -5
- package/lib/cjs/loader/agent-yaml.d.ts +8 -5
- package/lib/cjs/loader/agent-yaml.js +21 -2
- package/lib/cjs/loader/index.d.ts +5 -5
- package/lib/cjs/loader/index.js +8 -19
- package/lib/cjs/models/chat-model.d.ts +1 -1
- package/lib/cjs/models/claude-chat-model.d.ts +3 -1
- package/lib/cjs/models/claude-chat-model.js +75 -60
- package/lib/cjs/models/openai-chat-model.d.ts +3 -3
- package/lib/cjs/models/openai-chat-model.js +1 -3
- package/lib/cjs/prompt/prompt-builder.d.ts +1 -1
- package/lib/cjs/prompt/prompt-builder.js +3 -3
- package/lib/cjs/server/error.d.ts +4 -0
- package/lib/cjs/server/error.js +11 -0
- package/lib/cjs/server/server.d.ts +54 -0
- package/lib/cjs/server/server.js +130 -0
- package/lib/cjs/utils/camelize.d.ts +13 -0
- package/lib/cjs/utils/camelize.js +16 -0
- package/lib/cjs/utils/event-stream.d.ts +11 -0
- package/lib/cjs/utils/event-stream.js +91 -0
- package/lib/cjs/utils/mcp-utils.js +4 -1
- package/lib/cjs/utils/stream-utils.d.ts +10 -3
- package/lib/cjs/utils/stream-utils.js +51 -36
- package/lib/cjs/utils/type-utils.d.ts +4 -2
- package/lib/cjs/utils/type-utils.js +10 -2
- package/lib/dts/agents/agent.d.ts +21 -20
- package/lib/dts/agents/ai-agent.d.ts +9 -8
- package/lib/dts/agents/mcp-agent.d.ts +10 -4
- package/lib/dts/agents/memory.d.ts +1 -1
- package/lib/dts/agents/team-agent.d.ts +28 -0
- package/lib/dts/agents/user-agent.d.ts +9 -10
- package/lib/dts/{execution-engine/execution-engine.d.ts → aigne/aigne.d.ts} +9 -12
- package/lib/dts/{execution-engine → aigne}/context.d.ts +31 -32
- package/lib/dts/aigne/index.d.ts +4 -0
- package/lib/dts/{execution-engine → aigne}/usage.d.ts +1 -1
- package/lib/dts/client/client.d.ts +19 -0
- package/lib/dts/index.d.ts +2 -1
- package/lib/dts/loader/agent-js.d.ts +2 -2
- package/lib/dts/loader/agent-yaml.d.ts +8 -5
- package/lib/dts/loader/index.d.ts +5 -5
- package/lib/dts/models/chat-model.d.ts +1 -1
- package/lib/dts/models/claude-chat-model.d.ts +3 -1
- package/lib/dts/models/openai-chat-model.d.ts +3 -3
- package/lib/dts/prompt/prompt-builder.d.ts +1 -1
- package/lib/dts/server/error.d.ts +4 -0
- package/lib/dts/server/server.d.ts +54 -0
- package/lib/dts/utils/camelize.d.ts +13 -0
- package/lib/dts/utils/event-stream.d.ts +11 -0
- package/lib/dts/utils/stream-utils.d.ts +10 -3
- package/lib/dts/utils/type-utils.d.ts +4 -2
- package/lib/esm/agents/agent.d.ts +21 -20
- package/lib/esm/agents/agent.js +29 -27
- package/lib/esm/agents/ai-agent.d.ts +9 -8
- package/lib/esm/agents/ai-agent.js +20 -14
- package/lib/esm/agents/mcp-agent.d.ts +10 -4
- package/lib/esm/agents/mcp-agent.js +12 -6
- package/lib/esm/agents/memory.d.ts +1 -1
- package/lib/esm/agents/team-agent.d.ts +28 -0
- package/lib/esm/agents/team-agent.js +89 -0
- package/lib/esm/agents/user-agent.d.ts +9 -10
- package/lib/esm/agents/user-agent.js +11 -14
- package/lib/{cjs/execution-engine/execution-engine.d.ts → esm/aigne/aigne.d.ts} +9 -12
- package/lib/esm/{execution-engine/execution-engine.js → aigne/aigne.js} +18 -18
- package/lib/esm/{execution-engine → aigne}/context.d.ts +31 -32
- package/lib/esm/{execution-engine → aigne}/context.js +28 -38
- package/lib/esm/aigne/index.d.ts +4 -0
- package/lib/esm/aigne/index.js +4 -0
- package/lib/esm/{execution-engine → aigne}/usage.d.ts +1 -1
- package/lib/esm/client/client.d.ts +19 -0
- package/lib/esm/client/client.js +45 -0
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/loader/agent-js.d.ts +2 -2
- package/lib/esm/loader/agent-js.js +4 -5
- package/lib/esm/loader/agent-yaml.d.ts +8 -5
- package/lib/esm/loader/agent-yaml.js +21 -2
- package/lib/esm/loader/index.d.ts +5 -5
- package/lib/esm/loader/index.js +8 -19
- package/lib/esm/models/chat-model.d.ts +1 -1
- package/lib/esm/models/claude-chat-model.d.ts +3 -1
- package/lib/esm/models/claude-chat-model.js +75 -60
- package/lib/esm/models/openai-chat-model.d.ts +3 -3
- package/lib/esm/models/openai-chat-model.js +1 -3
- package/lib/esm/prompt/prompt-builder.d.ts +1 -1
- package/lib/esm/prompt/prompt-builder.js +3 -3
- package/lib/esm/server/error.d.ts +4 -0
- package/lib/esm/server/error.js +7 -0
- package/lib/esm/server/server.d.ts +54 -0
- package/lib/esm/server/server.js +123 -0
- package/lib/esm/utils/camelize.d.ts +13 -0
- package/lib/esm/utils/camelize.js +10 -0
- package/lib/esm/utils/event-stream.d.ts +11 -0
- package/lib/esm/utils/event-stream.js +85 -0
- package/lib/esm/utils/mcp-utils.js +4 -1
- package/lib/esm/utils/stream-utils.d.ts +10 -3
- package/lib/esm/utils/stream-utils.js +49 -35
- package/lib/esm/utils/type-utils.d.ts +4 -2
- package/lib/esm/utils/type-utils.js +9 -2
- package/package.json +15 -5
- package/lib/cjs/execution-engine/index.d.ts +0 -4
- package/lib/cjs/execution-engine/utils.d.ts +0 -4
- package/lib/cjs/execution-engine/utils.js +0 -34
- package/lib/dts/execution-engine/index.d.ts +0 -4
- package/lib/dts/execution-engine/utils.d.ts +0 -4
- package/lib/esm/execution-engine/index.d.ts +0 -4
- package/lib/esm/execution-engine/index.js +0 -4
- package/lib/esm/execution-engine/utils.d.ts +0 -4
- package/lib/esm/execution-engine/utils.js +0 -30
- /package/lib/cjs/{execution-engine → aigne}/message-queue.d.ts +0 -0
- /package/lib/cjs/{execution-engine → aigne}/message-queue.js +0 -0
- /package/lib/cjs/{execution-engine → aigne}/usage.js +0 -0
- /package/lib/dts/{execution-engine → aigne}/message-queue.d.ts +0 -0
- /package/lib/esm/{execution-engine → aigne}/message-queue.d.ts +0 -0
- /package/lib/esm/{execution-engine → aigne}/message-queue.js +0 -0
- /package/lib/esm/{execution-engine → aigne}/usage.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -22,6 +22,34 @@
|
|
|
22
22
|
* rename @aigne/core-next to @aigne/core ([3a81009](https://github.com/AIGNE-io/aigne-framework/commit/3a8100962c81813217b687ae28e8de604419c622))
|
|
23
23
|
* use text resource from MCP correctly ([8b9eba8](https://github.com/AIGNE-io/aigne-framework/commit/8b9eba83352ec096a2a5d4f410d4c4bde7420bce))
|
|
24
24
|
|
|
25
|
+
## [1.12.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.11.0...core-v1.12.0) (2025-04-27)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* add AIGNEServer/AIGNEClient api to serve agents via network ([#96](https://github.com/AIGNE-io/aigne-framework/issues/96)) ([1f2dfa3](https://github.com/AIGNE-io/aigne-framework/commit/1f2dfa3a6a2568373063cea3c874b573d0a248d3))
|
|
31
|
+
* **core:** support streamable http transport for mcp agents ([#92](https://github.com/AIGNE-io/aigne-framework/issues/92)) ([37da490](https://github.com/AIGNE-io/aigne-framework/commit/37da490538298d882ec328e4b3304395a6cd8cf7))
|
|
32
|
+
* support TeamAgent and finalize API naming ([#91](https://github.com/AIGNE-io/aigne-framework/issues/91)) ([033d1b6](https://github.com/AIGNE-io/aigne-framework/commit/033d1b6a7dc5460807476abb35a413ba89a2a664))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* **core:** prioritize self model before falling back to context ([#97](https://github.com/AIGNE-io/aigne-framework/issues/97)) ([2a3d067](https://github.com/AIGNE-io/aigne-framework/commit/2a3d067442200657d8ef3b5314930cc14302f6bf))
|
|
38
|
+
* upgrade to streamable api for serve mcp command ([#98](https://github.com/AIGNE-io/aigne-framework/issues/98)) ([ae32bda](https://github.com/AIGNE-io/aigne-framework/commit/ae32bda20e57c2a2eb8b49fad034b0b2a5ebb15e))
|
|
39
|
+
|
|
40
|
+
## [1.11.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.10.0...core-v1.11.0) (2025-04-23)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
|
|
45
|
+
* **core:** enhance ClaudeChatModel to support streaming responses ([#85](https://github.com/AIGNE-io/aigne-framework/issues/85)) ([5433240](https://github.com/AIGNE-io/aigne-framework/commit/5433240e7b663ec9e9f4a79dffa05038088d54fc))
|
|
46
|
+
* support set memory in agent yaml ([#90](https://github.com/AIGNE-io/aigne-framework/issues/90)) ([215118f](https://github.com/AIGNE-io/aigne-framework/commit/215118f1dc55f02322d59a3f18395a459198e031))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* **core:** router model should support streaming response ([#88](https://github.com/AIGNE-io/aigne-framework/issues/88)) ([4fb4d92](https://github.com/AIGNE-io/aigne-framework/commit/4fb4d92f8b36011437efba3265591b2477f2d680))
|
|
52
|
+
|
|
25
53
|
## [1.10.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.9.0...core-v1.10.0) (2025-04-22)
|
|
26
54
|
|
|
27
55
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
14
|
+
the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
27
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
28
|
+
to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
+
also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that
|
|
84
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
85
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @aigne/core
|
|
2
|
+
|
|
3
|
+
[](https://star-history.com/#AIGNE-io/aigne-framework)
|
|
4
|
+
[](https://github.com/AIGNE-io/aigne-framework/issues)
|
|
5
|
+
[](https://codecov.io/gh/AIGNE-io/aigne-framework)
|
|
6
|
+
[](https://www.npmjs.com/package/@aigne/core)
|
|
7
|
+
[](https://github.com/AIGNE-io/aigne-framework/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
**English** | [中文](README.zh.md)
|
|
10
|
+
|
|
11
|
+
Core library of [AIGNE Framework](https://github.com/AIGNE-io/aigne-framework) for building AI-powered applications.
|
|
12
|
+
|
|
13
|
+
## Introduction
|
|
14
|
+
|
|
15
|
+
`@aigne/core` is the foundation component of [AIGNE Framework](https://github.com/AIGNE-io/aigne-framework), providing the essential modules and tools needed to build AI-driven applications. This package implements the core functionalities of the framework, including agent systems, aigne environment, model integrations, and workflow pattern support.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Multiple AI Model Support**: Built-in support for OpenAI, Gemini, Claude, and other mainstream AI models, easily extensible to support additional models
|
|
20
|
+
- **Agent System**: Powerful agent abstractions supporting AI agents, function agents, MCP agents, and more
|
|
21
|
+
- **AIGNE Environment**: Flexible handling communication between agents and workflow execution
|
|
22
|
+
- **Workflow Patterns**: Support for sequential, concurrent, routing, handoff, and other workflow patterns
|
|
23
|
+
- **MCP Protocol Integration**: Seamless integration with external systems through the Model Context Protocol
|
|
24
|
+
- **TypeScript Support**: Comprehensive type definitions providing an excellent development experience
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Using npm
|
|
30
|
+
npm install @aigne/core
|
|
31
|
+
|
|
32
|
+
# Using yarn
|
|
33
|
+
yarn add @aigne/core
|
|
34
|
+
|
|
35
|
+
# Using pnpm
|
|
36
|
+
pnpm add @aigne/core
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Basic Usage
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { AIAgent, AIGNE } from "@aigne/core";
|
|
43
|
+
import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
|
|
44
|
+
|
|
45
|
+
// Create AI model instance
|
|
46
|
+
const model = new OpenAIChatModel({
|
|
47
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
48
|
+
model: process.env.DEFAULT_CHAT_MODEL || "gpt-4-turbo",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Create AI agent
|
|
52
|
+
const agent = AIAgent.from({
|
|
53
|
+
name: "Assistant",
|
|
54
|
+
instructions: "You are a helpful assistant.",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Create AIGNE
|
|
58
|
+
const aigne = new AIGNE({ model });
|
|
59
|
+
|
|
60
|
+
// Use the AIGNE to invoke the agent
|
|
61
|
+
const userAgent = await aigne.invoke(agent);
|
|
62
|
+
|
|
63
|
+
// Send a message to the agent
|
|
64
|
+
const response = await userAgent.invoke("Hello, can you help me write a short article?");
|
|
65
|
+
console.log(response);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Module Structure
|
|
69
|
+
|
|
70
|
+
- `agents/`: Agent implementations, including AI agents, function agents, MCP agents, etc.
|
|
71
|
+
- `aigne/`: AIGNE is agents execution environment
|
|
72
|
+
- `loader/`: Loader-related functionality
|
|
73
|
+
- `models/`: Integration with various AI models
|
|
74
|
+
- `prompt/`: Prompt handling functionality
|
|
75
|
+
- `utils/`: Utility functions and helper methods
|
|
76
|
+
|
|
77
|
+
## Documentation
|
|
78
|
+
|
|
79
|
+
For more detailed API documentation, please refer to:
|
|
80
|
+
|
|
81
|
+
- [Agent API](../../docs/apis/agent-api.md)
|
|
82
|
+
- [AI Agent API](../../docs/apis/ai-agent-api.md)
|
|
83
|
+
- [Function Agent API](../../docs/apis/function-agent-api.md)
|
|
84
|
+
- [MCP Agent API](../../docs/apis/mcp-agent-api.md)
|
|
85
|
+
- [AIGNE API](../../docs/apis/aigne-api.md)
|
|
86
|
+
- [Server/Client API](../../docs/apis/server-client-api.md)
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
Elastic-2.0
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @aigne/core
|
|
2
|
+
|
|
3
|
+
[](https://star-history.com/#AIGNE-io/aigne-framework)
|
|
4
|
+
[](https://github.com/AIGNE-io/aigne-framework/issues)
|
|
5
|
+
[](https://codecov.io/gh/AIGNE-io/aigne-framework)
|
|
6
|
+
[](https://www.npmjs.com/package/@aigne/core)
|
|
7
|
+
[](https://github.com/AIGNE-io/aigne-framework/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
[English](README.md) | **中文**
|
|
10
|
+
|
|
11
|
+
[AIGNE 框架](https://github.com/AIGNE-io/aigne-framework)的核心库,用于构建 AI 驱动的应用程序。
|
|
12
|
+
|
|
13
|
+
## 简介
|
|
14
|
+
|
|
15
|
+
`@aigne/core` 是 [AIGNE 框架](https://github.com/AIGNE-io/aigne-framework)的基础核心组件,提供了构建 AI 驱动应用程序所需的基本模块和工具。该包实现了框架的核心功能,包括代理系统、执行引擎、模型集成以及工作流模式支持等。
|
|
16
|
+
|
|
17
|
+
## 特性
|
|
18
|
+
|
|
19
|
+
- **多种 AI 模型支持**:内置支持 OpenAI、Gemini、Claude 等主流 AI 模型,可轻松扩展支持其他模型
|
|
20
|
+
- **代理系统**:强大的代理抽象,支持 AI 代理、函数代理、MCP 代理等多种类型
|
|
21
|
+
- **执行引擎**:灵活的执行引擎,处理代理之间的通信和工作流执行
|
|
22
|
+
- **工作流模式**:支持顺序、并发、路由、交接等多种工作流模式
|
|
23
|
+
- **MCP 协议集成**:通过模型上下文协议(Model Context Protocol)实现与外部系统的无缝集成
|
|
24
|
+
- **TypeScript 支持**:完善的类型定义,提供良好的开发体验
|
|
25
|
+
|
|
26
|
+
## 安装
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# 使用 npm
|
|
30
|
+
npm install @aigne/core
|
|
31
|
+
|
|
32
|
+
# 使用 yarn
|
|
33
|
+
yarn add @aigne/core
|
|
34
|
+
|
|
35
|
+
# 使用 pnpm
|
|
36
|
+
pnpm add @aigne/core
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 基本用法
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { AIAgent, AIGNE } from "@aigne/core";
|
|
43
|
+
import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
|
|
44
|
+
|
|
45
|
+
// 创建 AI 模型实例
|
|
46
|
+
const model = new OpenAIChatModel({
|
|
47
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
48
|
+
model: process.env.DEFAULT_CHAT_MODEL || "gpt-4-turbo",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// 创建 AI 代理
|
|
52
|
+
const agent = AIAgent.from({
|
|
53
|
+
name: "助手",
|
|
54
|
+
instructions: "你是一个有帮助的助手。",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// 创建执行引擎
|
|
58
|
+
const aigne = new AIGNE({ model });
|
|
59
|
+
|
|
60
|
+
// 使用执行引擎调用代理
|
|
61
|
+
const userAgent = await aigne.invoke(agent);
|
|
62
|
+
|
|
63
|
+
// 向代理发送消息
|
|
64
|
+
const response = await userAgent.invoke("你好,能帮我写一篇短文吗?");
|
|
65
|
+
console.log(response);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 模块结构
|
|
69
|
+
|
|
70
|
+
- `agents/`: 代理相关的实现,包括 AI 代理、函数代理、MCP 代理等
|
|
71
|
+
- `aigne/`: AIGNE 提供 Agents 执行环境
|
|
72
|
+
- `loader/`: 加载器相关功能
|
|
73
|
+
- `models/`: 各种 AI 模型的集成
|
|
74
|
+
- `prompt/`: 提示词处理相关功能
|
|
75
|
+
- `utils/`: 工具函数和辅助方法
|
|
76
|
+
|
|
77
|
+
## 文档
|
|
78
|
+
|
|
79
|
+
更多详细的 API 文档,请参考:
|
|
80
|
+
|
|
81
|
+
- [Agent API](../../docs/apis/agent-api.zh.md)
|
|
82
|
+
- [AI Agent API](../../docs/apis/ai-agent-api.zh.md)
|
|
83
|
+
- [Function Agent API](../../docs/apis/function-agent-api.zh.md)
|
|
84
|
+
- [MCP Agent API](../../docs/apis/mcp-agent-api.zh.md)
|
|
85
|
+
- [AIGNE API](../../docs/apis/aigne-api.zh.md)
|
|
86
|
+
- [服务器/客户端 API](../../docs/apis/server-client-api.zh.md)
|
|
87
|
+
|
|
88
|
+
## 协议
|
|
89
|
+
|
|
90
|
+
Elastic-2.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inspect } from "node:util";
|
|
2
2
|
import { type ZodType } from "zod";
|
|
3
|
-
import type { Context } from "../
|
|
3
|
+
import type { Context } from "../aigne/context.js";
|
|
4
4
|
import { type Nullish, type PromiseOrValue } from "../utils/type-utils.js";
|
|
5
5
|
import { AgentMemory, type AgentMemoryOptions } from "./memory.js";
|
|
6
6
|
import { type TransferAgentOutput } from "./types.js";
|
|
@@ -15,11 +15,11 @@ export interface AgentOptions<I extends Message = Message, O extends Message = M
|
|
|
15
15
|
inputSchema?: AgentInputOutputSchema<I>;
|
|
16
16
|
outputSchema?: AgentInputOutputSchema<O>;
|
|
17
17
|
includeInputInOutput?: boolean;
|
|
18
|
-
|
|
18
|
+
skills?: (Agent | FunctionAgentFn)[];
|
|
19
19
|
disableEvents?: boolean;
|
|
20
20
|
memory?: AgentMemory | AgentMemoryOptions | true;
|
|
21
21
|
}
|
|
22
|
-
export interface
|
|
22
|
+
export interface AgentInvokeOptions {
|
|
23
23
|
streaming?: boolean;
|
|
24
24
|
}
|
|
25
25
|
export declare abstract class Agent<I extends Message = Message, O extends Message = Message> {
|
|
@@ -38,52 +38,53 @@ export declare abstract class Agent<I extends Message = Message, O extends Messa
|
|
|
38
38
|
readonly includeInputInOutput?: boolean;
|
|
39
39
|
readonly subscribeTopic?: SubscribeTopic;
|
|
40
40
|
readonly publishTopic?: PublishTopic<Message>;
|
|
41
|
-
readonly
|
|
41
|
+
readonly skills: Agent<Message, Message>[] & {
|
|
42
42
|
[key: string]: Agent<Message, Message>;
|
|
43
43
|
};
|
|
44
44
|
private disableEvents?;
|
|
45
45
|
/**
|
|
46
46
|
* Attach agent to context:
|
|
47
|
-
* - subscribe to topic and
|
|
47
|
+
* - subscribe to topic and invoke process method when message received
|
|
48
48
|
* - subscribe to memory topic if memory is enabled
|
|
49
49
|
* @param context Context to attach
|
|
50
50
|
*/
|
|
51
51
|
attach(context: Pick<Context, "subscribe">): void;
|
|
52
|
-
|
|
53
|
-
get
|
|
52
|
+
addSkill(...skills: (Agent | FunctionAgentFn)[]): void;
|
|
53
|
+
get isInvokable(): boolean;
|
|
54
54
|
private checkContextStatus;
|
|
55
55
|
private newDefaultContext;
|
|
56
|
-
|
|
56
|
+
invoke(input: I | string, context: Context | undefined, options: AgentInvokeOptions & {
|
|
57
57
|
streaming: true;
|
|
58
58
|
}): Promise<AgentResponseStream<O>>;
|
|
59
|
-
|
|
59
|
+
invoke(input: I | string, context?: Context, options?: AgentInvokeOptions & {
|
|
60
60
|
streaming?: false;
|
|
61
61
|
}): Promise<O>;
|
|
62
|
-
|
|
62
|
+
invoke(input: I | string, context?: Context, options?: AgentInvokeOptions): Promise<AgentResponse<O>>;
|
|
63
63
|
private processAgentOutput;
|
|
64
64
|
private processAgentError;
|
|
65
|
-
protected
|
|
65
|
+
protected checkAgentInvokesUsage(context: Context): void;
|
|
66
66
|
protected preprocess(_: I, context: Context): void;
|
|
67
67
|
protected postprocess(input: I, output: O, context: Context): void;
|
|
68
|
-
abstract process(input: I, context: Context, options?:
|
|
68
|
+
abstract process(input: I, context: Context, options?: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<O>>;
|
|
69
69
|
shutdown(): Promise<void>;
|
|
70
70
|
[inspect.custom](): string;
|
|
71
71
|
}
|
|
72
|
-
export type AgentResponse<T> = T | AgentResponseStream<T>;
|
|
72
|
+
export type AgentResponse<T> = T | TransferAgentOutput | AgentResponseStream<T>;
|
|
73
73
|
export type AgentResponseStream<T> = ReadableStream<AgentResponseChunk<T>>;
|
|
74
74
|
export type AgentResponseChunk<T> = AgentResponseDelta<T>;
|
|
75
|
+
export declare function isEmptyChunk<T>(chunk: AgentResponseChunk<T>): boolean;
|
|
75
76
|
export interface AgentResponseDelta<T> {
|
|
76
77
|
delta: {
|
|
77
78
|
text?: Partial<{
|
|
78
79
|
[key in keyof T as Extract<T[key], string> extends string ? key : never]: string;
|
|
79
|
-
}> | {
|
|
80
|
+
}> | Partial<{
|
|
80
81
|
[key: string]: string;
|
|
81
|
-
}
|
|
82
|
-
json?: Partial<T>;
|
|
82
|
+
}>;
|
|
83
|
+
json?: Partial<T | TransferAgentOutput>;
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
|
-
export type AgentProcessAsyncGenerator<O extends Message> = AsyncGenerator<AgentResponseChunk<O>, Partial<O> | undefined | void>;
|
|
86
|
-
export type AgentProcessResult<O extends Message> =
|
|
86
|
+
export type AgentProcessAsyncGenerator<O extends Message> = AsyncGenerator<AgentResponseChunk<O>, Partial<O | TransferAgentOutput> | undefined | void>;
|
|
87
|
+
export type AgentProcessResult<O extends Message> = AgentResponse<O> | AgentProcessAsyncGenerator<O> | Agent;
|
|
87
88
|
export type AgentInputOutputSchema<I extends Message = Message> = ZodType<I> | ((agent: Agent) => ZodType<I>);
|
|
88
89
|
export interface FunctionAgentOptions<I extends Message = Message, O extends Message = Message> extends AgentOptions<I, O> {
|
|
89
90
|
fn?: FunctionAgentFn<I, O>;
|
|
@@ -92,6 +93,6 @@ export declare class FunctionAgent<I extends Message = Message, O extends Messag
|
|
|
92
93
|
static from<I extends Message, O extends Message>(options: FunctionAgentOptions<I, O> | FunctionAgentFn<I, O>): FunctionAgent<I, O>;
|
|
93
94
|
constructor(options: FunctionAgentOptions<I, O>);
|
|
94
95
|
fn: FunctionAgentFn<I, O>;
|
|
95
|
-
process(input: I, context: Context
|
|
96
|
+
process(input: I, context: Context): PromiseOrValue<AgentProcessResult<O>>;
|
|
96
97
|
}
|
|
97
|
-
export type FunctionAgentFn<I extends Message =
|
|
98
|
+
export type FunctionAgentFn<I extends Message = any, O extends Message = any> = (input: I, context: Context) => PromiseOrValue<AgentProcessResult<O>>;
|
package/lib/cjs/agents/agent.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.FunctionAgent = exports.Agent = void 0;
|
|
37
|
+
exports.isEmptyChunk = isEmptyChunk;
|
|
37
38
|
const node_util_1 = require("node:util");
|
|
38
39
|
const zod_1 = require("zod");
|
|
39
40
|
const prompt_builder_js_1 = require("../prompt/prompt-builder.js");
|
|
@@ -55,8 +56,8 @@ class Agent {
|
|
|
55
56
|
this.includeInputInOutput = options.includeInputInOutput;
|
|
56
57
|
this.subscribeTopic = options.subscribeTopic;
|
|
57
58
|
this.publishTopic = options.publishTopic;
|
|
58
|
-
if (options.
|
|
59
|
-
this.
|
|
59
|
+
if (options.skills?.length)
|
|
60
|
+
this.skills.push(...options.skills.map(functionToAgent));
|
|
60
61
|
this.disableEvents = options.disableEvents;
|
|
61
62
|
if (options.memory) {
|
|
62
63
|
this.memory =
|
|
@@ -93,11 +94,11 @@ class Agent {
|
|
|
93
94
|
includeInputInOutput;
|
|
94
95
|
subscribeTopic;
|
|
95
96
|
publishTopic;
|
|
96
|
-
|
|
97
|
+
skills = (0, type_utils_js_1.createAccessorArray)([], (arr, name) => arr.find((t) => t.name === name));
|
|
97
98
|
disableEvents;
|
|
98
99
|
/**
|
|
99
100
|
* Attach agent to context:
|
|
100
|
-
* - subscribe to topic and
|
|
101
|
+
* - subscribe to topic and invoke process method when message received
|
|
101
102
|
* - subscribe to memory topic if memory is enabled
|
|
102
103
|
* @param context Context to attach
|
|
103
104
|
*/
|
|
@@ -106,7 +107,7 @@ class Agent {
|
|
|
106
107
|
for (const topic of (0, type_utils_js_1.orArrayToArray)(this.subscribeTopic).concat(this.topic)) {
|
|
107
108
|
context.subscribe(topic, async ({ message, context }) => {
|
|
108
109
|
try {
|
|
109
|
-
await context.
|
|
110
|
+
await context.invoke(this, message);
|
|
110
111
|
}
|
|
111
112
|
catch (error) {
|
|
112
113
|
context.emit("agentFailed", { agent: this, error });
|
|
@@ -114,34 +115,37 @@ class Agent {
|
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
-
this.
|
|
118
|
+
addSkill(...skills) {
|
|
119
|
+
this.skills.push(...skills.map((skill) => (typeof skill === "function" ? functionToAgent(skill) : skill)));
|
|
119
120
|
}
|
|
120
|
-
get
|
|
121
|
+
get isInvokable() {
|
|
121
122
|
return !!this.process;
|
|
122
123
|
}
|
|
123
124
|
checkContextStatus(context) {
|
|
124
125
|
if (context) {
|
|
125
126
|
const { status } = context;
|
|
126
127
|
if (status === "timeout") {
|
|
127
|
-
throw new Error(`
|
|
128
|
+
throw new Error(`AIGNE for agent ${this.name} has timed out`);
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
async newDefaultContext() {
|
|
132
|
-
return Promise.resolve().then(() => __importStar(require("../
|
|
133
|
+
return Promise.resolve().then(() => __importStar(require("../aigne/context.js"))).then((m) => new m.AIGNEContext());
|
|
133
134
|
}
|
|
134
|
-
async
|
|
135
|
+
async invoke(input, context, options) {
|
|
135
136
|
const ctx = context ?? (await this.newDefaultContext());
|
|
136
137
|
const message = typeof input === "string" ? (0, prompt_builder_js_1.createMessage)(input) : input;
|
|
137
|
-
logger_js_1.logger.core("
|
|
138
|
+
logger_js_1.logger.core("Invoke agent %s started with input: %O", this.name, input);
|
|
138
139
|
if (!this.disableEvents)
|
|
139
140
|
ctx.emit("agentStarted", { agent: this, input: message });
|
|
140
141
|
try {
|
|
141
142
|
const parsedInput = (0, type_utils_js_1.checkArguments)(`Agent ${this.name} input`, this.inputSchema, message);
|
|
142
143
|
this.preprocess(parsedInput, ctx);
|
|
143
144
|
this.checkContextStatus(ctx);
|
|
144
|
-
|
|
145
|
+
let response = await this.process(parsedInput, ctx, options);
|
|
146
|
+
if (response instanceof Agent) {
|
|
147
|
+
response = (0, types_js_1.transferToAgentOutput)(response);
|
|
148
|
+
}
|
|
145
149
|
if (options?.streaming) {
|
|
146
150
|
const stream = response instanceof ReadableStream
|
|
147
151
|
? response
|
|
@@ -175,27 +179,27 @@ class Agent {
|
|
|
175
179
|
const parsedOutput = (0, type_utils_js_1.checkArguments)(`Agent ${this.name} output`, this.outputSchema, output);
|
|
176
180
|
const finalOutput = this.includeInputInOutput ? { ...input, ...parsedOutput } : parsedOutput;
|
|
177
181
|
this.postprocess(input, finalOutput, context);
|
|
178
|
-
logger_js_1.logger.core("
|
|
182
|
+
logger_js_1.logger.core("Invoke agent %s succeed with output: %O", this.name, finalOutput);
|
|
179
183
|
if (!this.disableEvents)
|
|
180
184
|
context.emit("agentSucceed", { agent: this, output: finalOutput });
|
|
181
185
|
return finalOutput;
|
|
182
186
|
}
|
|
183
187
|
processAgentError(error, context) {
|
|
184
|
-
logger_js_1.logger.core("
|
|
188
|
+
logger_js_1.logger.core("Invoke agent %s failed with error: %O", this.name, error);
|
|
185
189
|
if (!this.disableEvents)
|
|
186
190
|
context.emit("agentFailed", { agent: this, error });
|
|
187
191
|
throw error;
|
|
188
192
|
}
|
|
189
|
-
|
|
193
|
+
checkAgentInvokesUsage(context) {
|
|
190
194
|
const { limits, usage } = context;
|
|
191
|
-
if (limits?.
|
|
192
|
-
throw new Error(`Exceeded max agent
|
|
195
|
+
if (limits?.maxAgentInvokes && usage.agentCalls >= limits.maxAgentInvokes) {
|
|
196
|
+
throw new Error(`Exceeded max agent invokes ${usage.agentCalls}/${limits.maxAgentInvokes}`);
|
|
193
197
|
}
|
|
194
198
|
usage.agentCalls++;
|
|
195
199
|
}
|
|
196
200
|
preprocess(_, context) {
|
|
197
201
|
this.checkContextStatus(context);
|
|
198
|
-
this.
|
|
202
|
+
this.checkAgentInvokesUsage(context);
|
|
199
203
|
}
|
|
200
204
|
postprocess(input, output, context) {
|
|
201
205
|
this.checkContextStatus(context);
|
|
@@ -214,9 +218,12 @@ class Agent {
|
|
|
214
218
|
}
|
|
215
219
|
}
|
|
216
220
|
exports.Agent = Agent;
|
|
221
|
+
function isEmptyChunk(chunk) {
|
|
222
|
+
return (0, type_utils_js_1.isEmpty)(chunk.delta.json) && (0, type_utils_js_1.isEmpty)(chunk.delta.text);
|
|
223
|
+
}
|
|
217
224
|
function checkAgentInputOutputSchema(schema) {
|
|
218
225
|
if (!(schema instanceof zod_1.ZodObject) && typeof schema !== "function") {
|
|
219
|
-
throw new Error(
|
|
226
|
+
throw new Error(`schema must be a zod object or function return a zod object, got: ${typeof schema}`);
|
|
220
227
|
}
|
|
221
228
|
}
|
|
222
229
|
class FunctionAgent extends Agent {
|
|
@@ -228,12 +235,8 @@ class FunctionAgent extends Agent {
|
|
|
228
235
|
this.fn = options.fn ?? (() => ({}));
|
|
229
236
|
}
|
|
230
237
|
fn;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (result instanceof Agent) {
|
|
234
|
-
result = (0, types_js_1.transferToAgentOutput)(result);
|
|
235
|
-
}
|
|
236
|
-
return options?.streaming ? (0, stream_utils_js_1.objectToAgentResponseStream)(result) : result;
|
|
238
|
+
process(input, context) {
|
|
239
|
+
return this.fn(input, context);
|
|
237
240
|
}
|
|
238
241
|
}
|
|
239
242
|
exports.FunctionAgent = FunctionAgent;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { Context } from "../
|
|
2
|
+
import type { Context } from "../aigne/context.js";
|
|
3
3
|
import { ChatModel } from "../models/chat-model.js";
|
|
4
|
+
import type { ChatModelInput } from "../models/chat-model.js";
|
|
4
5
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
5
6
|
import { Agent, type AgentOptions, type AgentProcessAsyncGenerator, type Message } from "./agent.js";
|
|
6
|
-
import { type TransferAgentOutput } from "./types.js";
|
|
7
7
|
export interface AIAgentOptions<I extends Message = Message, O extends Message = Message> extends AgentOptions<I, O> {
|
|
8
8
|
model?: ChatModel;
|
|
9
9
|
instructions?: string | PromptBuilder;
|
|
@@ -24,18 +24,18 @@ export declare const aiAgentOptionsSchema: z.ZodObject<{
|
|
|
24
24
|
publishTopic: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>]>>;
|
|
25
25
|
name: z.ZodOptional<z.ZodString>;
|
|
26
26
|
description: z.ZodOptional<z.ZodString>;
|
|
27
|
-
|
|
27
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodType<Agent<Message, Message>, z.ZodTypeDef, Agent<Message, Message>>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>]>, "many">>;
|
|
28
28
|
disableLogging: z.ZodOptional<z.ZodBoolean>;
|
|
29
29
|
memory: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodAny, z.ZodAny]>>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
description?: string | undefined;
|
|
32
32
|
memory?: any;
|
|
33
|
+
name?: string | undefined;
|
|
33
34
|
includeInputInOutput?: boolean | undefined;
|
|
34
35
|
subscribeTopic?: string | string[] | undefined;
|
|
35
36
|
publishTopic?: string | string[] | ((...args: unknown[]) => unknown) | undefined;
|
|
36
|
-
|
|
37
|
+
skills?: (Agent<Message, Message> | ((...args: unknown[]) => unknown))[] | undefined;
|
|
37
38
|
toolChoice?: Agent<Message, Message> | "auto" | "none" | "required" | "router" | undefined;
|
|
38
|
-
name?: string | undefined;
|
|
39
39
|
model?: ChatModel | undefined;
|
|
40
40
|
instructions?: string | PromptBuilder | undefined;
|
|
41
41
|
outputKey?: string | undefined;
|
|
@@ -45,12 +45,12 @@ export declare const aiAgentOptionsSchema: z.ZodObject<{
|
|
|
45
45
|
}, {
|
|
46
46
|
description?: string | undefined;
|
|
47
47
|
memory?: any;
|
|
48
|
+
name?: string | undefined;
|
|
48
49
|
includeInputInOutput?: boolean | undefined;
|
|
49
50
|
subscribeTopic?: string | string[] | undefined;
|
|
50
51
|
publishTopic?: string | string[] | ((...args: unknown[]) => unknown) | undefined;
|
|
51
|
-
|
|
52
|
+
skills?: (Agent<Message, Message> | ((...args: unknown[]) => unknown))[] | undefined;
|
|
52
53
|
toolChoice?: Agent<Message, Message> | "auto" | "none" | "required" | "router" | undefined;
|
|
53
|
-
name?: string | undefined;
|
|
54
54
|
model?: ChatModel | undefined;
|
|
55
55
|
instructions?: string | PromptBuilder | undefined;
|
|
56
56
|
outputKey?: string | undefined;
|
|
@@ -65,5 +65,6 @@ export declare class AIAgent<I extends Message = Message, O extends Message = Me
|
|
|
65
65
|
instructions: PromptBuilder;
|
|
66
66
|
outputKey?: string;
|
|
67
67
|
toolChoice?: AIAgentToolChoice;
|
|
68
|
-
process(input: I, context: Context): AgentProcessAsyncGenerator<O
|
|
68
|
+
process(input: I, context: Context): AgentProcessAsyncGenerator<O>;
|
|
69
|
+
processRouter(input: I, model: ChatModel, modelInput: ChatModelInput, context: Context, toolsMap: Map<string, Agent>): AgentProcessAsyncGenerator<O>;
|
|
69
70
|
}
|