@ai.ntellect/core 0.3.1 → 0.4.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/.nvmrc +1 -0
- package/README.FR.md +201 -261
- package/README.md +208 -260
- package/agent/index.ts +204 -185
- package/agent/tools/get-rss.ts +64 -0
- package/bull.ts +5 -0
- package/dist/agent/index.d.ts +29 -22
- package/dist/agent/index.js +124 -97
- package/dist/agent/tools/get-rss.d.ts +16 -0
- package/dist/agent/tools/get-rss.js +62 -0
- package/dist/bull.d.ts +1 -0
- package/dist/bull.js +9 -0
- package/dist/examples/index.d.ts +2 -0
- package/dist/examples/index.js +89 -0
- package/dist/llm/interpreter/context.d.ts +5 -22
- package/dist/llm/interpreter/context.js +8 -9
- package/dist/llm/interpreter/index.d.ts +9 -5
- package/dist/llm/interpreter/index.js +55 -48
- package/dist/llm/memory-manager/context.d.ts +2 -0
- package/dist/llm/memory-manager/context.js +22 -0
- package/dist/llm/memory-manager/index.d.ts +17 -0
- package/dist/llm/memory-manager/index.js +107 -0
- package/dist/llm/orchestrator/context.d.ts +2 -10
- package/dist/llm/orchestrator/context.js +19 -16
- package/dist/llm/orchestrator/index.d.ts +36 -21
- package/dist/llm/orchestrator/index.js +122 -88
- package/dist/llm/orchestrator/types.d.ts +12 -0
- package/dist/llm/orchestrator/types.js +2 -0
- package/dist/memory/cache.d.ts +6 -6
- package/dist/memory/cache.js +35 -42
- package/dist/memory/persistent.d.ts +9 -13
- package/dist/memory/persistent.js +94 -114
- package/dist/services/redis-cache.d.ts +37 -0
- package/dist/services/redis-cache.js +93 -0
- package/dist/services/scheduler.d.ts +40 -0
- package/dist/services/scheduler.js +99 -0
- package/dist/services/telegram-monitor.d.ts +0 -0
- package/dist/services/telegram-monitor.js +118 -0
- package/dist/test.d.ts +0 -167
- package/dist/test.js +437 -372
- package/dist/types.d.ts +60 -9
- package/dist/utils/generate-object.d.ts +12 -0
- package/dist/utils/generate-object.js +90 -0
- package/dist/utils/header-builder.d.ts +11 -0
- package/dist/utils/header-builder.js +34 -0
- package/dist/utils/inject-actions.js +2 -2
- package/dist/utils/queue-item-transformer.d.ts +2 -2
- package/dist/utils/schema-generator.d.ts +16 -0
- package/dist/utils/schema-generator.js +46 -0
- package/examples/index.ts +103 -0
- package/llm/interpreter/context.ts +20 -8
- package/llm/interpreter/index.ts +81 -54
- package/llm/memory-manager/context.ts +21 -0
- package/llm/memory-manager/index.ts +163 -0
- package/llm/orchestrator/context.ts +20 -13
- package/llm/orchestrator/index.ts +210 -130
- package/llm/orchestrator/types.ts +14 -0
- package/memory/cache.ts +41 -55
- package/memory/persistent.ts +121 -149
- package/package.json +11 -2
- package/services/redis-cache.ts +128 -0
- package/services/scheduler.ts +128 -0
- package/services/telegram-monitor.ts +138 -0
- package/t.py +79 -0
- package/t.spec +38 -0
- package/types.ts +64 -9
- package/utils/generate-object.ts +105 -0
- package/utils/header-builder.ts +40 -0
- package/utils/inject-actions.ts +4 -6
- package/utils/queue-item-transformer.ts +2 -1
- package/utils/schema-generator.ts +73 -0
- package/agent/handlers/ActionHandler.ts +0 -48
- package/agent/handlers/ConfirmationHandler.ts +0 -37
- package/agent/handlers/EventHandler.ts +0 -35
- package/dist/agent/handlers/ActionHandler.d.ts +0 -8
- package/dist/agent/handlers/ActionHandler.js +0 -36
- package/dist/agent/handlers/ConfirmationHandler.d.ts +0 -7
- package/dist/agent/handlers/ConfirmationHandler.js +0 -31
- package/dist/agent/handlers/EventHandler.d.ts +0 -10
- package/dist/agent/handlers/EventHandler.js +0 -34
- package/dist/llm/evaluator/context.d.ts +0 -10
- package/dist/llm/evaluator/context.js +0 -22
- package/dist/llm/evaluator/index.d.ts +0 -16
- package/dist/llm/evaluator/index.js +0 -151
- package/llm/evaluator/context.ts +0 -21
- package/llm/evaluator/index.ts +0 -194
package/README.md
CHANGED
@@ -1,362 +1,310 @@
|
|
1
1
|
# AI.ntellect Core Framework
|
2
2
|
|
3
|
-
##
|
4
|
-
|
5
|
-
1. [Main components](#main-components)
|
6
|
-
- [Agent](#agent)
|
7
|
-
- [Orchestrator](#orchestrator)
|
8
|
-
- [Evaluator](#evaluator)
|
9
|
-
- [Interpreter](#interpreter)
|
10
|
-
- [Memory](#memory-architecture)
|
11
|
-
2. [Action creation and management](#action-creation-and-management)
|
12
|
-
3. [Agent processing](#agent-processing)
|
13
|
-
4. [WIP (Work in Progress)](#wip-work-in-progress)
|
14
|
-
|
15
|
-
---
|
3
|
+
## Overview
|
16
4
|
|
17
|
-
|
5
|
+
This framework is designed to execute complex workflows using advanced orchestration, memory management, and actionable intelligence. It integrates tools, interpreters, and memory systems to:
|
18
6
|
|
19
|
-
|
7
|
+
- Contextually analyze user inputs.
|
8
|
+
- Execute predefined workflows and dynamic actions.
|
9
|
+
- Efficiently manage short-term and long-term memory.
|
10
|
+
- Seamlessly integrate with external APIs and tools.
|
20
11
|
|
21
|
-
|
12
|
+
---
|
22
13
|
|
23
|
-
|
14
|
+
## Table of contents
|
24
15
|
|
25
|
-
|
26
|
-
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
1. [Architecture components](#architecture-components)
|
17
|
+
- [Agent runtime](#agent-runtime)
|
18
|
+
- [Orchestrator](#orchestrator)
|
19
|
+
- [Queue manager](#queue-manager)
|
20
|
+
- [Interpreter](#interpreter)
|
21
|
+
- [Memory system](#memory-system)
|
22
|
+
2. [Defining and executing actions](#defining-and-executing-actions)
|
23
|
+
3. [State management and recursion](#state-management-and-recursion)
|
24
|
+
4. [Installation and setup](#installation-and-setup)
|
25
|
+
5. [Example usage](#example-usage)
|
26
|
+
6. [Work in progress (WIP)](#work-in-progress)
|
32
27
|
|
33
|
-
|
28
|
+
---
|
34
29
|
|
35
|
-
|
30
|
+
## Architecture components
|
36
31
|
|
37
|
-
|
38
|
-
- **Interactions**:
|
39
|
-
- Manages available tools/actions
|
40
|
-
- Executes actions based on agent requests
|
41
|
-
- Uses memory for context and caching
|
42
|
-
- Coordinates with evaluator for result assessment
|
32
|
+
### Agent runtime
|
43
33
|
|
44
|
-
|
34
|
+
The `AgentRuntime` is the core engine that coordinates the global workflow. It connects all components and ensures tasks are executed efficiently.
|
45
35
|
|
46
|
-
|
36
|
+
**Responsibilities:**
|
47
37
|
|
48
|
-
-
|
49
|
-
-
|
50
|
-
|
51
|
-
- Determines if additional actions are needed
|
52
|
-
- Routes results to appropriate Interpreter
|
53
|
-
- Ensures completion of user requirements
|
54
|
-
- **Interactions**:
|
55
|
-
- Works with orchestrator to manage workflow
|
56
|
-
- Coordinates with Interpreters for specialized processing
|
57
|
-
- Can trigger additional action cycles if needed
|
38
|
+
- Build context for the current state using memory systems (RAG and CAG).
|
39
|
+
- Orchestrate actions using the Queue Manager.
|
40
|
+
- Leverage interpreters to analyze results and generate responses.
|
58
41
|
|
59
|
-
|
42
|
+
#### Context building
|
60
43
|
|
61
|
-
The
|
44
|
+
The `buildContext` method constructs a comprehensive context by:
|
62
45
|
|
63
|
-
|
46
|
+
1. Adding tools and user requests.
|
47
|
+
2. Retrieving recent actions using cache memory (CAG).
|
48
|
+
3. Fetching relevant knowledge from persistent memory (RAG).
|
49
|
+
4. Including available interpreters for the request.
|
64
50
|
|
65
|
-
|
66
|
-
- Domain-adapted response formatting
|
67
|
-
- Specialized data processing based on context
|
51
|
+
#### Processing workflows
|
68
52
|
|
69
|
-
|
53
|
+
The `process` method:
|
70
54
|
|
71
|
-
|
72
|
-
|
73
|
-
|
55
|
+
1. Generates responses based on the context using a language model.
|
56
|
+
2. Handles recursive workflows for action execution.
|
57
|
+
3. Selects appropriate interpreters for result analysis.
|
74
58
|
|
75
|
-
|
59
|
+
---
|
76
60
|
|
77
|
-
|
61
|
+
### Orchestrator
|
78
62
|
|
79
|
-
|
80
|
-
- Format adapted for financial analysis
|
63
|
+
The **orchestrator** directs workflows by analyzing user inputs and planning actions. It interacts with tools, memory systems, and interpreters to ensure logical execution.
|
81
64
|
|
82
|
-
|
65
|
+
**Key features:**
|
83
66
|
|
84
|
-
|
85
|
-
|
67
|
+
- Dynamic selection of actions based on context.
|
68
|
+
- Management of memory interactions for RAG and CAG operations.
|
69
|
+
- Multi-step workflow handling with iterative refinement.
|
86
70
|
|
87
|
-
|
88
|
-
- Handles general purpose requests
|
89
|
-
- Flexible formatting based on context
|
71
|
+
---
|
90
72
|
|
91
|
-
|
73
|
+
### Queue manager
|
92
74
|
|
93
|
-
|
75
|
+
The **queue manager** organizes and executes actions in the correct order, whether sequentially or in parallel. It acts as the central mechanism for managing workflows, ensuring that each action is properly queued, validated, and executed.
|
94
76
|
|
95
|
-
|
77
|
+
**Responsibilities:**
|
96
78
|
|
97
|
-
|
79
|
+
1. **Queueing actions:**
|
98
80
|
|
99
|
-
|
81
|
+
- Actions are added to a queue for execution, either individually or as a batch.
|
82
|
+
- Logs queued actions for debugging and traceability.
|
100
83
|
|
101
|
-
|
84
|
+
2. **Processing actions:**
|
102
85
|
|
103
|
-
|
86
|
+
- Executes actions in the queue while maintaining the correct order.
|
87
|
+
- Ensures dependencies between actions are respected.
|
88
|
+
- Handles errors or confirmations via callbacks.
|
104
89
|
|
105
|
-
|
106
|
-
|
107
|
-
|
90
|
+
3. **Confirmation handling:**
|
91
|
+
- Supports confirmation prompts for critical actions.
|
92
|
+
- Relies on callbacks to decide whether to proceed with specific actions.
|
108
93
|
|
109
|
-
|
110
|
-
./meilisearch --master-key="YOUR_MASTER_KEY"
|
111
|
-
```
|
94
|
+
**Example:**
|
112
95
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
```bash
|
118
|
-
# Using Docker
|
119
|
-
docker run --name redis -d -p 6379:6379 redis
|
96
|
+
```typescript
|
97
|
+
import { ActionQueueManager } from "@ai-ntellect/core";
|
98
|
+
import { actions, callbacks } from "@ai-ntellect/core/examples";
|
120
99
|
|
121
|
-
|
122
|
-
|
100
|
+
const queueManager = new ActionQueueManager(actions, callbacks);
|
101
|
+
queueManager.addToQueue([{ name: "fetch-data", parameters: [...] }]);
|
102
|
+
const results = await queueManager.processQueue();
|
103
|
+
console.log("Results:", results);
|
123
104
|
```
|
124
105
|
|
125
|
-
|
126
|
-
- Default port: 6379
|
127
|
-
- Configure memory limits
|
128
|
-
- Enable persistence if needed
|
129
|
-
|
130
|
-
#### Memory types
|
131
|
-
|
132
|
-
#### Short-term memory (Redis)
|
133
|
-
|
134
|
-
1. **Procedural Memory**:
|
135
|
-
|
136
|
-
- Stored in Redis for fast access
|
137
|
-
- Contains reusable action sequences and workflows
|
138
|
-
- Optimizes performance through caching
|
139
|
-
- Example: "Common token approval + swap sequence"
|
140
|
-
|
141
|
-
2. **Short-term episodic memory**:
|
142
|
-
- Recent messages and interactions
|
143
|
-
- Temporary context for ongoing conversations
|
144
|
-
- Stored in Redis for quick retrieval
|
145
|
-
- Example: "Last 10 messages in current conversation"
|
146
|
-
|
147
|
-
#### Long-term memory (Meilisearch)
|
148
|
-
|
149
|
-
1. **Semantic memory**:
|
150
|
-
|
151
|
-
- Permanent storage of facts and knowledge
|
152
|
-
- Indexed for efficient retrieval
|
153
|
-
- Stores relationships between concepts
|
154
|
-
- Example: "Token X has contract address Y on network Z"
|
106
|
+
---
|
155
107
|
|
156
|
-
|
157
|
-
- Historical interactions and experiences
|
158
|
-
- Persistent context across sessions
|
159
|
-
- Searchable through vector similarity
|
160
|
-
- Example: "User X's past successful transactions"
|
108
|
+
### Interpreter
|
161
109
|
|
162
|
-
|
110
|
+
The **interpreter** specializes in analyzing results and generating domain-specific insights. Each interpreter is tailored to a specific use case and uses its own character configuration.
|
163
111
|
|
164
|
-
|
112
|
+
**Examples:**
|
165
113
|
|
166
|
-
|
167
|
-
|
114
|
+
1. **MarketInterpreter**: Analyzes financial market data.
|
115
|
+
2. **SecurityInterpreter**: Conducts security checks.
|
116
|
+
3. **GeneralInterpreter**: Processes general-purpose requests.
|
168
117
|
|
169
|
-
|
170
|
-
- Stores action sequences and their results
|
171
|
-
- Enables quick retrieval of common patterns
|
118
|
+
#### Interpretation workflow
|
172
119
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
- Optimizes resource usage
|
120
|
+
1. Builds context with the current state, including results and user requests.
|
121
|
+
2. Uses the language model to generate actionable insights.
|
122
|
+
3. Provides detailed responses for the final user.
|
177
123
|
|
178
|
-
|
124
|
+
---
|
179
125
|
|
180
|
-
|
126
|
+
### Memory system
|
181
127
|
|
182
|
-
-
|
128
|
+
The memory architecture combines short-term and long-term memory to provide contextual processing.
|
183
129
|
|
184
|
-
|
185
|
-
- Dual indexing (global and user-specific)
|
186
|
-
- Combines with traditional text search
|
130
|
+
#### Types of memory
|
187
131
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
132
|
+
1. **Cache memory (Redis):**
|
133
|
+
- Stores temporary data for fast retrieval.
|
134
|
+
- Examples: Recent actions, session data.
|
135
|
+
2. **Persistent memory (Meilisearch):**
|
136
|
+
- Stores long-term data such as historical interactions and knowledge.
|
137
|
+
- Enables semantic searches and vector-based retrieval.
|
192
138
|
|
193
139
|
---
|
194
140
|
|
195
|
-
##
|
141
|
+
## Defining and executing actions
|
142
|
+
|
143
|
+
### What are actions?
|
196
144
|
|
197
|
-
Actions are
|
145
|
+
Actions are fundamental tasks executed by the framework. Each action includes:
|
198
146
|
|
199
|
-
|
147
|
+
- A unique name and description.
|
148
|
+
- Input parameters validated using schemas.
|
149
|
+
- Execution logic encapsulated in the `execute` method.
|
200
150
|
|
201
|
-
### Example
|
151
|
+
### Example action
|
202
152
|
|
203
153
|
```typescript
|
204
|
-
import { networkConfigs } from "@config/network";
|
205
|
-
import { parseEther } from "ethers";
|
206
154
|
import { z } from "zod";
|
155
|
+
import { parseEther } from "ethers";
|
207
156
|
|
208
157
|
export const prepareTransaction = {
|
209
158
|
name: "prepare-transaction",
|
210
|
-
description: "Prepare a transfer for
|
159
|
+
description: "Prepare a token transfer for user approval.",
|
211
160
|
parameters: z.object({
|
212
161
|
walletAddress: z.string(),
|
213
|
-
amount: z.string()
|
214
|
-
networkId: z.string()
|
162
|
+
amount: z.string(),
|
163
|
+
networkId: z.string(),
|
215
164
|
}),
|
216
|
-
execute: async ({
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
amount: string;
|
223
|
-
networkId: string;
|
224
|
-
}) => {
|
225
|
-
try {
|
226
|
-
const networkConfig = networkConfigs[networkId];
|
227
|
-
if (!networkConfig) {
|
228
|
-
throw new Error(`Network ${network} not found`);
|
229
|
-
}
|
230
|
-
|
231
|
-
return {
|
232
|
-
to: walletAddress,
|
233
|
-
value: parseEther(amount).toString(),
|
234
|
-
chain: {
|
235
|
-
id: networkConfig.id,
|
236
|
-
rpc: networkConfig.rpc,
|
237
|
-
},
|
238
|
-
type: "transfer",
|
239
|
-
};
|
240
|
-
} catch (error) {
|
241
|
-
return "Error preparing the transaction";
|
242
|
-
}
|
165
|
+
execute: async ({ walletAddress, amount, networkId }) => {
|
166
|
+
return {
|
167
|
+
to: walletAddress,
|
168
|
+
value: parseEther(amount).toString(),
|
169
|
+
network: networkId,
|
170
|
+
};
|
243
171
|
},
|
244
172
|
};
|
245
173
|
```
|
246
174
|
|
247
|
-
### How to define an action:
|
248
|
-
|
249
|
-
1. **Name**: Unique identifier for the action.
|
250
|
-
2. **Description**: Brief description of what the action does.
|
251
|
-
3. **Parameters**: Parameters required to execute the action, validated by `zod`.
|
252
|
-
4. **Execution**: `execute` function that performs the action.
|
253
|
-
|
254
175
|
---
|
255
176
|
|
256
|
-
##
|
177
|
+
## State management and recursion
|
257
178
|
|
258
|
-
The agent
|
179
|
+
The agent manages state and recursive workflows to ensure actions are executed in an orderly manner until completion, while respecting a maximum iteration limit to avoid infinite loops.
|
259
180
|
|
260
|
-
|
261
|
-
const memory = new PersistentMemory({
|
262
|
-
host: "http://localhost:7700",
|
263
|
-
apiKey: "YOUR_API_KEY",
|
264
|
-
});
|
181
|
+
### State management
|
265
182
|
|
266
|
-
|
267
|
-
[
|
268
|
-
getChainsTVL,
|
269
|
-
getRssNews,
|
270
|
-
// other tools...
|
271
|
-
],
|
272
|
-
memory
|
273
|
-
);
|
183
|
+
The state (`State`) includes:
|
274
184
|
|
275
|
-
|
276
|
-
|
277
|
-
orchestrator,
|
278
|
-
persistentMemory: memory,
|
279
|
-
stream: false,
|
280
|
-
maxEvaluatorIteration: 1,
|
281
|
-
});
|
185
|
+
- `currentContext`: Current context of the user request.
|
186
|
+
- `previousActions`: List of previously executed actions.
|
282
187
|
|
283
|
-
|
284
|
-
const result = await agent.process(prompt, context, {
|
285
|
-
onMessage: (message) => {
|
286
|
-
console.log({ message });
|
287
|
-
},
|
288
|
-
});
|
289
|
-
```
|
188
|
+
When an action is completed, the state is updated to include:
|
290
189
|
|
291
|
-
|
190
|
+
- Results of previous actions.
|
191
|
+
- Remaining context to process.
|
292
192
|
|
293
|
-
|
294
|
-
2. Agent analyzes the prompt and context
|
295
|
-
3. Orchestrator executes required tools/actions
|
296
|
-
4. Evaluator assesses results
|
297
|
-
5. Agent generates final response
|
193
|
+
### Controlled recursion
|
298
194
|
|
299
|
-
|
195
|
+
To prevent infinite loops, the system limits the number of iterations using the `maxIterations` configuration.
|
300
196
|
|
301
|
-
|
197
|
+
**Workflow:**
|
302
198
|
|
303
|
-
|
199
|
+
1. **Initialization:** At each iteration, the agent:
|
304
200
|
|
305
|
-
|
201
|
+
- Executes actions in the queue.
|
202
|
+
- Updates the state with new results.
|
306
203
|
|
307
|
-
**
|
204
|
+
2. **Limit validation:**
|
308
205
|
|
309
|
-
|
310
|
-
efficiency and quality of results. It also enables better resource management and faster adaptation to changes.
|
206
|
+
- If the iteration count exceeds `maxIterations`, processing is stopped with a "Max iterations reached" message.
|
311
207
|
|
312
|
-
**
|
208
|
+
3. **Recursion:**
|
209
|
+
- If actions remain to be executed, the agent recursively calls the `process` method with the updated state.
|
313
210
|
|
314
|
-
|
315
|
-
- [ ] Shared context management.
|
316
|
-
- [ ] Conflict resolution protocols.
|
211
|
+
**Example:**
|
317
212
|
|
318
|
-
|
213
|
+
```typescript
|
214
|
+
const updatedNextState: State = {
|
215
|
+
...state,
|
216
|
+
currentContext: state.currentContext,
|
217
|
+
previousActions: [...(state.previousActions || []), ...(results || [])],
|
218
|
+
};
|
219
|
+
|
220
|
+
if (countIterations < this.config.maxIterations) {
|
221
|
+
return this.process(updatedNextState);
|
222
|
+
} else {
|
223
|
+
console.log("Max iterations reached");
|
224
|
+
response.shouldContinue = false;
|
225
|
+
}
|
226
|
+
```
|
319
227
|
|
320
228
|
---
|
321
229
|
|
322
|
-
##
|
230
|
+
## Installation and setup
|
231
|
+
|
232
|
+
### Install dependencies
|
233
|
+
|
234
|
+
```bash
|
235
|
+
npm install
|
236
|
+
```
|
323
237
|
|
324
|
-
|
238
|
+
### Configure external services
|
325
239
|
|
326
|
-
|
327
|
-
facilitating the execution of complex actions on the blockchain. It improves accessibility and efficiency in
|
328
|
-
interacting with smart contracts.
|
240
|
+
#### Redis (cache memory)
|
329
241
|
|
330
|
-
|
242
|
+
```bash
|
243
|
+
docker run --name redis -d -p 6379:6379 redis
|
244
|
+
```
|
331
245
|
|
332
|
-
|
333
|
-
- [ ] Filtering of relevant functions.
|
334
|
-
- [ ] Generation of hypothetical queries in natural language.
|
335
|
-
- [ ] Conversion of queries into vector embeddings.
|
336
|
-
- [ ] Storing embeddings and associated queries.
|
337
|
-
- [ ] Similarity search based on cosine.
|
338
|
-
- [ ] Ranking results based on relevance.
|
246
|
+
#### Meilisearch (persistent memory)
|
339
247
|
|
340
|
-
|
248
|
+
```bash
|
249
|
+
curl -L https://install.meilisearch.com | sh
|
250
|
+
./meilisearch --master-key="YOUR_MASTER_KEY"
|
251
|
+
```
|
341
252
|
|
342
253
|
---
|
343
254
|
|
344
|
-
##
|
255
|
+
## Example usage
|
345
256
|
|
346
|
-
|
347
|
-
network.
|
257
|
+
### Initialize the agent
|
348
258
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
259
|
+
```typescript
|
260
|
+
import { deepseek } from "@ai-ntellect/core";
|
261
|
+
import { Agent } from "@ai-ntellect/core";
|
262
|
+
import { checkHoneypot, fetchMarkPrice } from "@ai-ntellect/core/actions";
|
263
|
+
import {
|
264
|
+
generalInterpreterCharacter,
|
265
|
+
marketInterpreterCharacter,
|
266
|
+
securityInterpreterCharacter,
|
267
|
+
} from "@ai-ntellect/core/interpreter/context";
|
353
268
|
|
354
|
-
|
269
|
+
const model = deepseek("deepseek-reasoner");
|
355
270
|
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
271
|
+
const agent = new Agent({
|
272
|
+
orchestrator: {
|
273
|
+
model,
|
274
|
+
tools: [checkHoneypot, fetchMarkPrice],
|
275
|
+
},
|
276
|
+
interpreters: [
|
277
|
+
new Interpreter({
|
278
|
+
name: "security",
|
279
|
+
model,
|
280
|
+
character: securityInterpreterCharacter,
|
281
|
+
}),
|
282
|
+
new Interpreter({
|
283
|
+
name: "market",
|
284
|
+
model,
|
285
|
+
character: marketInterpreterCharacter,
|
286
|
+
}),
|
287
|
+
new Interpreter({
|
288
|
+
name: "general",
|
289
|
+
model,
|
290
|
+
character: generalInterpreterCharacter,
|
291
|
+
}),
|
292
|
+
],
|
293
|
+
memoryManager: {
|
294
|
+
model,
|
295
|
+
},
|
296
|
+
maxIterations: 3,
|
297
|
+
});
|
298
|
+
```
|
299
|
+
|
300
|
+
### Process a request
|
360
301
|
|
361
|
-
|
362
|
-
|
302
|
+
```typescript
|
303
|
+
const state = {
|
304
|
+
currentContext: "Analyze XRP/USD market trends",
|
305
|
+
previousActions: [],
|
306
|
+
};
|
307
|
+
|
308
|
+
const result = await agent.process(state);
|
309
|
+
console.log("Result:", result);
|
310
|
+
```
|