@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.
Files changed (86) hide show
  1. package/.nvmrc +1 -0
  2. package/README.FR.md +201 -261
  3. package/README.md +208 -260
  4. package/agent/index.ts +204 -185
  5. package/agent/tools/get-rss.ts +64 -0
  6. package/bull.ts +5 -0
  7. package/dist/agent/index.d.ts +29 -22
  8. package/dist/agent/index.js +124 -97
  9. package/dist/agent/tools/get-rss.d.ts +16 -0
  10. package/dist/agent/tools/get-rss.js +62 -0
  11. package/dist/bull.d.ts +1 -0
  12. package/dist/bull.js +9 -0
  13. package/dist/examples/index.d.ts +2 -0
  14. package/dist/examples/index.js +89 -0
  15. package/dist/llm/interpreter/context.d.ts +5 -22
  16. package/dist/llm/interpreter/context.js +8 -9
  17. package/dist/llm/interpreter/index.d.ts +9 -5
  18. package/dist/llm/interpreter/index.js +55 -48
  19. package/dist/llm/memory-manager/context.d.ts +2 -0
  20. package/dist/llm/memory-manager/context.js +22 -0
  21. package/dist/llm/memory-manager/index.d.ts +17 -0
  22. package/dist/llm/memory-manager/index.js +107 -0
  23. package/dist/llm/orchestrator/context.d.ts +2 -10
  24. package/dist/llm/orchestrator/context.js +19 -16
  25. package/dist/llm/orchestrator/index.d.ts +36 -21
  26. package/dist/llm/orchestrator/index.js +122 -88
  27. package/dist/llm/orchestrator/types.d.ts +12 -0
  28. package/dist/llm/orchestrator/types.js +2 -0
  29. package/dist/memory/cache.d.ts +6 -6
  30. package/dist/memory/cache.js +35 -42
  31. package/dist/memory/persistent.d.ts +9 -13
  32. package/dist/memory/persistent.js +94 -114
  33. package/dist/services/redis-cache.d.ts +37 -0
  34. package/dist/services/redis-cache.js +93 -0
  35. package/dist/services/scheduler.d.ts +40 -0
  36. package/dist/services/scheduler.js +99 -0
  37. package/dist/services/telegram-monitor.d.ts +0 -0
  38. package/dist/services/telegram-monitor.js +118 -0
  39. package/dist/test.d.ts +0 -167
  40. package/dist/test.js +437 -372
  41. package/dist/types.d.ts +60 -9
  42. package/dist/utils/generate-object.d.ts +12 -0
  43. package/dist/utils/generate-object.js +90 -0
  44. package/dist/utils/header-builder.d.ts +11 -0
  45. package/dist/utils/header-builder.js +34 -0
  46. package/dist/utils/inject-actions.js +2 -2
  47. package/dist/utils/queue-item-transformer.d.ts +2 -2
  48. package/dist/utils/schema-generator.d.ts +16 -0
  49. package/dist/utils/schema-generator.js +46 -0
  50. package/examples/index.ts +103 -0
  51. package/llm/interpreter/context.ts +20 -8
  52. package/llm/interpreter/index.ts +81 -54
  53. package/llm/memory-manager/context.ts +21 -0
  54. package/llm/memory-manager/index.ts +163 -0
  55. package/llm/orchestrator/context.ts +20 -13
  56. package/llm/orchestrator/index.ts +210 -130
  57. package/llm/orchestrator/types.ts +14 -0
  58. package/memory/cache.ts +41 -55
  59. package/memory/persistent.ts +121 -149
  60. package/package.json +11 -2
  61. package/services/redis-cache.ts +128 -0
  62. package/services/scheduler.ts +128 -0
  63. package/services/telegram-monitor.ts +138 -0
  64. package/t.py +79 -0
  65. package/t.spec +38 -0
  66. package/types.ts +64 -9
  67. package/utils/generate-object.ts +105 -0
  68. package/utils/header-builder.ts +40 -0
  69. package/utils/inject-actions.ts +4 -6
  70. package/utils/queue-item-transformer.ts +2 -1
  71. package/utils/schema-generator.ts +73 -0
  72. package/agent/handlers/ActionHandler.ts +0 -48
  73. package/agent/handlers/ConfirmationHandler.ts +0 -37
  74. package/agent/handlers/EventHandler.ts +0 -35
  75. package/dist/agent/handlers/ActionHandler.d.ts +0 -8
  76. package/dist/agent/handlers/ActionHandler.js +0 -36
  77. package/dist/agent/handlers/ConfirmationHandler.d.ts +0 -7
  78. package/dist/agent/handlers/ConfirmationHandler.js +0 -31
  79. package/dist/agent/handlers/EventHandler.d.ts +0 -10
  80. package/dist/agent/handlers/EventHandler.js +0 -34
  81. package/dist/llm/evaluator/context.d.ts +0 -10
  82. package/dist/llm/evaluator/context.js +0 -22
  83. package/dist/llm/evaluator/index.d.ts +0 -16
  84. package/dist/llm/evaluator/index.js +0 -151
  85. package/llm/evaluator/context.ts +0 -21
  86. package/llm/evaluator/index.ts +0 -194
package/README.md CHANGED
@@ -1,362 +1,310 @@
1
1
  # AI.ntellect Core Framework
2
2
 
3
- ## Table of contents
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
- ## 1. Main components
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
- The system relies on several key components that ensure smooth and efficient processing of user requests through an AI agent architecture.
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
- ### Agent
12
+ ---
22
13
 
23
- The agent is the core component that processes user requests and manages the entire interaction flow. It coordinates with other components to understand user needs, execute appropriate actions, and generate relevant responses.
14
+ ## Table of contents
24
15
 
25
- - **Main role**: Process user requests and coordinate system components
26
- - **Key features**:
27
- - Processes user prompts
28
- - Manages conversation context
29
- - Coordinates with orchestrator for action execution
30
- - Handles response generation
31
- - Maintains user state and memory
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
- ### Orchestrator
28
+ ---
34
29
 
35
- The orchestrator works under the agent's direction to manage the execution of actions. It analyzes requirements based on the agent's interpretation of user needs and coordinates the execution of appropriate tools.
30
+ ## Architecture components
36
31
 
37
- - **Main role**: Organize and direct the execution of actions
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
- ### Evaluator
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
- The evaluator now collaborates with Interpreters to process action results and determine the next steps in the workflow.
36
+ **Responsibilities:**
47
37
 
48
- - **Main role**: Evaluate action results and coordinate with appropriate Interpreters
49
- - **Main functions**:
50
- - Analyzes results from executed actions
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
- ### Interpreter
42
+ #### Context building
60
43
 
61
- The Interpreter is a specialized component responsible for interpreting action results and generating appropriate responses. Each Interpreter is configured with a specific business context and produces responses in a format adapted to its domain of expertise.
44
+ The `buildContext` method constructs a comprehensive context by:
62
45
 
63
- **Key characteristics**:
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
- - Business-specific context configuration
66
- - Domain-adapted response formatting
67
- - Specialized data processing based on context
51
+ #### Processing workflows
68
52
 
69
- **Operation flow**:
53
+ The `process` method:
70
54
 
71
- - Receives action results via the Evaluator
72
- - Analyzes data according to its specific context
73
- - Produces formatted responses following domain rules
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
- Examples of Interpreter implementations:
59
+ ---
76
60
 
77
- 1. **MarketInterpreter**
61
+ ### Orchestrator
78
62
 
79
- - Specialized in market data analysis
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
- 2. **SecurityInterpreter**
65
+ **Key features:**
83
66
 
84
- - Dedicated to security verifications
85
- - Optimized format for security reports
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
- 3. **GeneralInterpreter**
88
- - Handles general purpose requests
89
- - Flexible formatting based on context
71
+ ---
90
72
 
91
- These examples demonstrate the system's flexibility, which can be extended with additional Interpreter types as needed.
73
+ ### Queue manager
92
74
 
93
- [![Sans-titre-2024-11-08-0220.png](https://i.postimg.cc/nryjsx5y/Sans-titre-2024-11-08-0220.png)](https://postimg.cc/rR9FbBqj)
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
- ### Memory
77
+ **Responsibilities:**
96
78
 
97
- The system implements a sophisticated memory architecture that combines different storage solutions for various types of memory:
79
+ 1. **Queueing actions:**
98
80
 
99
- #### Installation and setup
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
- ##### Meilisearch (Long-term memory)
84
+ 2. **Processing actions:**
102
85
 
103
- Meilisearch can be self-hosted for complete control over the agent's long-term memory:
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
- ```bash
106
- # Install Meilisearch
107
- curl -L https://install.meilisearch.com | sh
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
- # Launch Meilisearch with a master key
110
- ./meilisearch --master-key="YOUR_MASTER_KEY"
111
- ```
94
+ **Example:**
112
95
 
113
- ##### Redis (Short-term memory)
114
-
115
- Redis handles the short-term memory components:
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
- # Or install locally
122
- sudo apt-get install redis-server
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
- 2. **Configuration**:
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
- 2. **Long-term episodic Memory**:
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
- ### Cache Augmented Generation (CAG)
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
- CAG optimizes workflow execution through Redis-based caching:
112
+ **Examples:**
165
113
 
166
- - **Main role**: Cache frequently used procedural patterns
167
- - **Implementation**:
114
+ 1. **MarketInterpreter**: Analyzes financial market data.
115
+ 2. **SecurityInterpreter**: Conducts security checks.
116
+ 3. **GeneralInterpreter**: Processes general-purpose requests.
168
117
 
169
- - Uses Redis for high-performance storage
170
- - Stores action sequences and their results
171
- - Enables quick retrieval of common patterns
118
+ #### Interpretation workflow
172
119
 
173
- - **Benefits**:
174
- - Reduces computation overhead
175
- - Speeds up repeated operations
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
- ### Retrieval Augmented Generation (RAG)
124
+ ---
179
125
 
180
- The RAG system enhances long-term memory access through Meilisearch:
126
+ ### Memory system
181
127
 
182
- - **Implementation**:
128
+ The memory architecture combines short-term and long-term memory to provide contextual processing.
183
129
 
184
- - Vector-based search for semantic similarity
185
- - Dual indexing (global and user-specific)
186
- - Combines with traditional text search
130
+ #### Types of memory
187
131
 
188
- - **Features**:
189
- - Semantic and episodic memory retrieval
190
- - Context-aware search capabilities
191
- - Relevance-based result ranking
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
- ## 2. Action creation and management
141
+ ## Defining and executing actions
142
+
143
+ ### What are actions?
196
144
 
197
- Actions are specific tasks to be performed within a workflow. They can involve interactions with APIs, blockchain transactions, or any other necessary operations.
145
+ Actions are fundamental tasks executed by the framework. Each action includes:
198
146
 
199
- Each action is defined as an object containing a name, description, parameters, and an execution function.
147
+ - A unique name and description.
148
+ - Input parameters validated using schemas.
149
+ - Execution logic encapsulated in the `execute` method.
200
150
 
201
- ### Example of an action
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 the user to sign.",
159
+ description: "Prepare a token transfer for user approval.",
211
160
  parameters: z.object({
212
161
  walletAddress: z.string(),
213
- amount: z.string().describe("Amount to send"),
214
- networkId: z.string().describe("Target network (e.g., ethereum, arbitrum)"),
162
+ amount: z.string(),
163
+ networkId: z.string(),
215
164
  }),
216
- execute: async ({
217
- walletAddress,
218
- amount,
219
- network,
220
- }: {
221
- walletAddress: string;
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
- ## 3. Agent processing
177
+ ## State management and recursion
257
178
 
258
- The agent handles the entire process of understanding user requests and coordinating responses. Here's an example of how to use 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
- ```typescript
261
- const memory = new PersistentMemory({
262
- host: "http://localhost:7700",
263
- apiKey: "YOUR_API_KEY",
264
- });
181
+ ### State management
265
182
 
266
- const orchestrator = new Orchestrator(
267
- [
268
- getChainsTVL,
269
- getRssNews,
270
- // other tools...
271
- ],
272
- memory
273
- );
183
+ The state (`State`) includes:
274
184
 
275
- const agent = new Agent({
276
- user: { id: "user_id" },
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
- // Process a user request
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
- ### Agent process flow:
190
+ - Results of previous actions.
191
+ - Remaining context to process.
292
192
 
293
- 1. User sends a prompt
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
- ## 4. WIP (Work in Progress)
195
+ To prevent infinite loops, the system limits the number of iterations using the `maxIterations` configuration.
300
196
 
301
- Here are the elements currently in development or improvement:
197
+ **Workflow:**
302
198
 
303
- ---
199
+ 1. **Initialization:** At each iteration, the agent:
304
200
 
305
- ## Multi-agent collaboration
201
+ - Executes actions in the queue.
202
+ - Updates the state with new results.
306
203
 
307
- **Objective**: Enable multiple agents to collaborate on complex tasks with specialization and coordination.
204
+ 2. **Limit validation:**
308
205
 
309
- **Interest**: Collaboration between agents allows breaking down complex tasks into specialized subtasks, enhancing the
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
- **Steps to implement**:
208
+ 3. **Recursion:**
209
+ - If actions remain to be executed, the agent recursively calls the `process` method with the updated state.
313
210
 
314
- - [ ] Task delegation framework.
315
- - [ ] Shared context management.
316
- - [ ] Conflict resolution protocols.
211
+ **Example:**
317
212
 
318
- **Status**: Research phase, architectural planning in progress.
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
- ## Complex on-chain interactions management
230
+ ## Installation and setup
231
+
232
+ ### Install dependencies
233
+
234
+ ```bash
235
+ npm install
236
+ ```
323
237
 
324
- **Objective**: Create a model for recognizing on-chain interactions and creating workflows for complex interactions.
238
+ ### Configure external services
325
239
 
326
- **Interest**: This feature allows the agent to understand and interact with smart contracts more intuitively,
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
- **Steps to implement**:
242
+ ```bash
243
+ docker run --name redis -d -p 6379:6379 redis
244
+ ```
331
245
 
332
- - [ ] Extraction and processing of relevant contract ABIs.
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
- **Status**: Ongoing study to determine the best approach and technologies to use.
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
- ## Lit Protocol implementation
255
+ ## Example usage
345
256
 
346
- **Objective**: Add the ability to execute Lit actions, enabling decentralized and secure calculations on the Lit
347
- network.
257
+ ### Initialize the agent
348
258
 
349
- **Interest**: Integrating the Lit Protocol allows executing Lit actions in a decentralized manner, using cryptographic
350
- keys to validate operations. These actions can be used to run JavaScript scripts in a decentralized environment,
351
- offering transparency as all interactions are recorded on the blockchain. The main benefit lies in automation and
352
- security while preserving user privacy, which enhances trust in on-chain interactions.
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
- **Steps to Implement**:
269
+ const model = deepseek("deepseek-reasoner");
355
270
 
356
- - [x] Study Lit Protocol documentation, especially the section on Lit actions and their implementation.
357
- - [ ] Integrate the protocol into the existing architecture to allow execution of Lit actions.
358
- - [ ] Develop modules for executing Lit actions, including signature management and secure script execution.
359
- - [ ] Test the integration, security, and transparency of Lit actions to ensure they function properly.
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
- **Status**: Under study to determine feasibility and technical implications, particularly regarding integrating
362
- decentralization into the existing system.
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
+ ```