@ggakila/agentx-framework 0.1.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 (228) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/LICENSE +21 -0
  3. package/README.md +335 -0
  4. package/dist/agent/Agent.d.ts +110 -0
  5. package/dist/agent/Agent.d.ts.map +1 -0
  6. package/dist/agent/Agent.js +291 -0
  7. package/dist/agent/Agent.js.map +1 -0
  8. package/dist/agent/index.d.ts +5 -0
  9. package/dist/agent/index.d.ts.map +1 -0
  10. package/dist/agent/index.js +11 -0
  11. package/dist/agent/index.js.map +1 -0
  12. package/dist/cli/CLI.d.ts +74 -0
  13. package/dist/cli/CLI.d.ts.map +1 -0
  14. package/dist/cli/CLI.js +255 -0
  15. package/dist/cli/CLI.js.map +1 -0
  16. package/dist/cli/InteractiveSetup.d.ts +104 -0
  17. package/dist/cli/InteractiveSetup.d.ts.map +1 -0
  18. package/dist/cli/InteractiveSetup.js +2225 -0
  19. package/dist/cli/InteractiveSetup.js.map +1 -0
  20. package/dist/cli/bin.d.ts +7 -0
  21. package/dist/cli/bin.d.ts.map +1 -0
  22. package/dist/cli/bin.js +35 -0
  23. package/dist/cli/bin.js.map +1 -0
  24. package/dist/cli/commands/ProjectCommands.d.ts +23 -0
  25. package/dist/cli/commands/ProjectCommands.d.ts.map +1 -0
  26. package/dist/cli/commands/ProjectCommands.js +504 -0
  27. package/dist/cli/commands/ProjectCommands.js.map +1 -0
  28. package/dist/cli/index.d.ts +7 -0
  29. package/dist/cli/index.d.ts.map +1 -0
  30. package/dist/cli/index.js +21 -0
  31. package/dist/cli/index.js.map +1 -0
  32. package/dist/credential/CredentialManager.d.ts +112 -0
  33. package/dist/credential/CredentialManager.d.ts.map +1 -0
  34. package/dist/credential/CredentialManager.js +343 -0
  35. package/dist/credential/CredentialManager.js.map +1 -0
  36. package/dist/credential/OAuth2Manager.d.ts +206 -0
  37. package/dist/credential/OAuth2Manager.d.ts.map +1 -0
  38. package/dist/credential/OAuth2Manager.js +463 -0
  39. package/dist/credential/OAuth2Manager.js.map +1 -0
  40. package/dist/credential/index.d.ts +6 -0
  41. package/dist/credential/index.d.ts.map +1 -0
  42. package/dist/credential/index.js +16 -0
  43. package/dist/credential/index.js.map +1 -0
  44. package/dist/error/ErrorHandler.d.ts +74 -0
  45. package/dist/error/ErrorHandler.d.ts.map +1 -0
  46. package/dist/error/ErrorHandler.js +279 -0
  47. package/dist/error/ErrorHandler.js.map +1 -0
  48. package/dist/index.d.ts +30 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +100 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/integrations/DatabaseTool.d.ts +149 -0
  53. package/dist/integrations/DatabaseTool.d.ts.map +1 -0
  54. package/dist/integrations/DatabaseTool.js +900 -0
  55. package/dist/integrations/DatabaseTool.js.map +1 -0
  56. package/dist/integrations/EmailTool.d.ts +142 -0
  57. package/dist/integrations/EmailTool.d.ts.map +1 -0
  58. package/dist/integrations/EmailTool.js +259 -0
  59. package/dist/integrations/EmailTool.js.map +1 -0
  60. package/dist/integrations/FileSystemTool.d.ts +153 -0
  61. package/dist/integrations/FileSystemTool.d.ts.map +1 -0
  62. package/dist/integrations/FileSystemTool.js +835 -0
  63. package/dist/integrations/FileSystemTool.js.map +1 -0
  64. package/dist/integrations/GoogleWorkspaceTool.d.ts +125 -0
  65. package/dist/integrations/GoogleWorkspaceTool.d.ts.map +1 -0
  66. package/dist/integrations/GoogleWorkspaceTool.js +765 -0
  67. package/dist/integrations/GoogleWorkspaceTool.js.map +1 -0
  68. package/dist/integrations/HttpTool.d.ts +55 -0
  69. package/dist/integrations/HttpTool.d.ts.map +1 -0
  70. package/dist/integrations/HttpTool.js +209 -0
  71. package/dist/integrations/HttpTool.js.map +1 -0
  72. package/dist/integrations/MessagingTool.d.ts +136 -0
  73. package/dist/integrations/MessagingTool.d.ts.map +1 -0
  74. package/dist/integrations/MessagingTool.js +503 -0
  75. package/dist/integrations/MessagingTool.js.map +1 -0
  76. package/dist/integrations/SchedulerTool.d.ts +147 -0
  77. package/dist/integrations/SchedulerTool.d.ts.map +1 -0
  78. package/dist/integrations/SchedulerTool.js +471 -0
  79. package/dist/integrations/SchedulerTool.js.map +1 -0
  80. package/dist/integrations/WebhookTool.d.ts +97 -0
  81. package/dist/integrations/WebhookTool.d.ts.map +1 -0
  82. package/dist/integrations/WebhookTool.js +351 -0
  83. package/dist/integrations/WebhookTool.js.map +1 -0
  84. package/dist/integrations/index.d.ts +13 -0
  85. package/dist/integrations/index.d.ts.map +1 -0
  86. package/dist/integrations/index.js +60 -0
  87. package/dist/integrations/index.js.map +1 -0
  88. package/dist/llm/LLMProvider.d.ts +83 -0
  89. package/dist/llm/LLMProvider.d.ts.map +1 -0
  90. package/dist/llm/LLMProvider.js +370 -0
  91. package/dist/llm/LLMProvider.js.map +1 -0
  92. package/dist/llm/index.d.ts +5 -0
  93. package/dist/llm/index.d.ts.map +1 -0
  94. package/dist/llm/index.js +14 -0
  95. package/dist/llm/index.js.map +1 -0
  96. package/dist/payment/PaymentProvider.d.ts +157 -0
  97. package/dist/payment/PaymentProvider.d.ts.map +1 -0
  98. package/dist/payment/PaymentProvider.js +525 -0
  99. package/dist/payment/PaymentProvider.js.map +1 -0
  100. package/dist/payment/index.d.ts +5 -0
  101. package/dist/payment/index.d.ts.map +1 -0
  102. package/dist/payment/index.js +16 -0
  103. package/dist/payment/index.js.map +1 -0
  104. package/dist/plugin/PluginManager.d.ts +156 -0
  105. package/dist/plugin/PluginManager.d.ts.map +1 -0
  106. package/dist/plugin/PluginManager.js +288 -0
  107. package/dist/plugin/PluginManager.js.map +1 -0
  108. package/dist/plugin/index.d.ts +5 -0
  109. package/dist/plugin/index.d.ts.map +1 -0
  110. package/dist/plugin/index.js +10 -0
  111. package/dist/plugin/index.js.map +1 -0
  112. package/dist/runtime/AgentXRuntime.d.ts +90 -0
  113. package/dist/runtime/AgentXRuntime.d.ts.map +1 -0
  114. package/dist/runtime/AgentXRuntime.js +469 -0
  115. package/dist/runtime/AgentXRuntime.js.map +1 -0
  116. package/dist/security/SecurityManager.d.ts +245 -0
  117. package/dist/security/SecurityManager.d.ts.map +1 -0
  118. package/dist/security/SecurityManager.js +512 -0
  119. package/dist/security/SecurityManager.js.map +1 -0
  120. package/dist/security/index.d.ts +5 -0
  121. package/dist/security/index.d.ts.map +1 -0
  122. package/dist/security/index.js +14 -0
  123. package/dist/security/index.js.map +1 -0
  124. package/dist/tool/ToolRegistry.d.ts +58 -0
  125. package/dist/tool/ToolRegistry.d.ts.map +1 -0
  126. package/dist/tool/ToolRegistry.js +173 -0
  127. package/dist/tool/ToolRegistry.js.map +1 -0
  128. package/dist/tool/ToolValidator.d.ts +41 -0
  129. package/dist/tool/ToolValidator.d.ts.map +1 -0
  130. package/dist/tool/ToolValidator.js +158 -0
  131. package/dist/tool/ToolValidator.js.map +1 -0
  132. package/dist/tool/index.d.ts +6 -0
  133. package/dist/tool/index.d.ts.map +1 -0
  134. package/dist/tool/index.js +11 -0
  135. package/dist/tool/index.js.map +1 -0
  136. package/dist/transport/BaseTransport.d.ts +66 -0
  137. package/dist/transport/BaseTransport.d.ts.map +1 -0
  138. package/dist/transport/BaseTransport.js +103 -0
  139. package/dist/transport/BaseTransport.js.map +1 -0
  140. package/dist/transport/HttpTransport.d.ts +41 -0
  141. package/dist/transport/HttpTransport.d.ts.map +1 -0
  142. package/dist/transport/HttpTransport.js +160 -0
  143. package/dist/transport/HttpTransport.js.map +1 -0
  144. package/dist/transport/LocalTransport.d.ts +40 -0
  145. package/dist/transport/LocalTransport.d.ts.map +1 -0
  146. package/dist/transport/LocalTransport.js +157 -0
  147. package/dist/transport/LocalTransport.js.map +1 -0
  148. package/dist/transport/QueueTransport.d.ts +63 -0
  149. package/dist/transport/QueueTransport.d.ts.map +1 -0
  150. package/dist/transport/QueueTransport.js +194 -0
  151. package/dist/transport/QueueTransport.js.map +1 -0
  152. package/dist/transport/StdioTransport.d.ts +51 -0
  153. package/dist/transport/StdioTransport.d.ts.map +1 -0
  154. package/dist/transport/StdioTransport.js +216 -0
  155. package/dist/transport/StdioTransport.js.map +1 -0
  156. package/dist/transport/TransportFactory.d.ts +35 -0
  157. package/dist/transport/TransportFactory.d.ts.map +1 -0
  158. package/dist/transport/TransportFactory.js +100 -0
  159. package/dist/transport/TransportFactory.js.map +1 -0
  160. package/dist/transport/index.d.ts +10 -0
  161. package/dist/transport/index.d.ts.map +1 -0
  162. package/dist/transport/index.js +19 -0
  163. package/dist/transport/index.js.map +1 -0
  164. package/dist/types/agent.d.ts +66 -0
  165. package/dist/types/agent.d.ts.map +1 -0
  166. package/dist/types/agent.js +3 -0
  167. package/dist/types/agent.js.map +1 -0
  168. package/dist/types/config.d.ts +60 -0
  169. package/dist/types/config.d.ts.map +1 -0
  170. package/dist/types/config.js +6 -0
  171. package/dist/types/config.js.map +1 -0
  172. package/dist/types/credential.d.ts +38 -0
  173. package/dist/types/credential.d.ts.map +1 -0
  174. package/dist/types/credential.js +3 -0
  175. package/dist/types/credential.js.map +1 -0
  176. package/dist/types/error.d.ts +136 -0
  177. package/dist/types/error.d.ts.map +1 -0
  178. package/dist/types/error.js +223 -0
  179. package/dist/types/error.js.map +1 -0
  180. package/dist/types/index.d.ts +10 -0
  181. package/dist/types/index.d.ts.map +1 -0
  182. package/dist/types/index.js +27 -0
  183. package/dist/types/index.js.map +1 -0
  184. package/dist/types/llm.d.ts +43 -0
  185. package/dist/types/llm.d.ts.map +1 -0
  186. package/dist/types/llm.js +3 -0
  187. package/dist/types/llm.js.map +1 -0
  188. package/dist/types/payment.d.ts +129 -0
  189. package/dist/types/payment.d.ts.map +1 -0
  190. package/dist/types/payment.js +6 -0
  191. package/dist/types/payment.js.map +1 -0
  192. package/dist/types/runtime.d.ts +31 -0
  193. package/dist/types/runtime.d.ts.map +1 -0
  194. package/dist/types/runtime.js +3 -0
  195. package/dist/types/runtime.js.map +1 -0
  196. package/dist/types/tool.d.ts +72 -0
  197. package/dist/types/tool.d.ts.map +1 -0
  198. package/dist/types/tool.js +3 -0
  199. package/dist/types/tool.js.map +1 -0
  200. package/dist/types/transport.d.ts +53 -0
  201. package/dist/types/transport.d.ts.map +1 -0
  202. package/dist/types/transport.js +3 -0
  203. package/dist/types/transport.js.map +1 -0
  204. package/dist/types/workflow.d.ts +72 -0
  205. package/dist/types/workflow.d.ts.map +1 -0
  206. package/dist/types/workflow.js +6 -0
  207. package/dist/types/workflow.js.map +1 -0
  208. package/dist/utils/factory.d.ts +14 -0
  209. package/dist/utils/factory.d.ts.map +1 -0
  210. package/dist/utils/factory.js +146 -0
  211. package/dist/utils/factory.js.map +1 -0
  212. package/dist/workflow/StateManager.d.ts +93 -0
  213. package/dist/workflow/StateManager.d.ts.map +1 -0
  214. package/dist/workflow/StateManager.js +223 -0
  215. package/dist/workflow/StateManager.js.map +1 -0
  216. package/dist/workflow/WorkflowDefinition.d.ts +49 -0
  217. package/dist/workflow/WorkflowDefinition.d.ts.map +1 -0
  218. package/dist/workflow/WorkflowDefinition.js +264 -0
  219. package/dist/workflow/WorkflowDefinition.js.map +1 -0
  220. package/dist/workflow/WorkflowExecutor.d.ts +42 -0
  221. package/dist/workflow/WorkflowExecutor.d.ts.map +1 -0
  222. package/dist/workflow/WorkflowExecutor.js +372 -0
  223. package/dist/workflow/WorkflowExecutor.js.map +1 -0
  224. package/dist/workflow/index.d.ts +7 -0
  225. package/dist/workflow/index.d.ts.map +1 -0
  226. package/dist/workflow/index.js +17 -0
  227. package/dist/workflow/index.js.map +1 -0
  228. package/package.json +122 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,107 @@
1
+ # Changelog
2
+
3
+ All notable changes to the AgentX Framework will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2024-01-11
9
+
10
+ ### Added
11
+
12
+ #### Core Framework
13
+ - 🚀 **Initial release** of AgentX Framework
14
+ - 🤖 **AI Agent System** with native LLM integration
15
+ - 🔄 **Workflow Engine** with DAG-based execution
16
+ - 🛠️ **Tool Registry** for extensible integrations
17
+ - 🚌 **Transport Layer** (HTTP, WebSocket, Queue, Local)
18
+ - 🔐 **Security System** with RBAC, rate limiting, and audit logging
19
+
20
+ #### LLM Providers
21
+ - ✅ **OpenAI** integration (GPT-4, GPT-3.5)
22
+ - ✅ **Anthropic** integration (Claude 3)
23
+ - ✅ **Local Model** support (Ollama, LM Studio)
24
+
25
+ #### Integrations (15+)
26
+ - 🌐 **HTTP/REST** - API calls and responses
27
+ - 🔗 **Webhooks** - Send and receive webhooks
28
+ - 💬 **Slack** - Complete Slack API integration
29
+ - 📱 **WhatsApp** - WhatsApp Business API
30
+ - 🤖 **Telegram** - Telegram Bot API
31
+ - 📧 **Email** - SMTP email sending
32
+ - 🗄️ **SQL Databases** - PostgreSQL, MySQL, SQLite
33
+ - 🍃 **MongoDB** - NoSQL database integration
34
+ - ⚡ **Redis** - Caching and session storage
35
+ - ☁️ **Amazon S3** - File storage and retrieval
36
+ - 📁 **File System** - Local file operations
37
+ - 📝 **Google Docs** - Document creation and editing
38
+ - 📊 **Google Sheets** - Spreadsheet operations
39
+ - 💾 **Google Drive** - File management
40
+ - ⏰ **Scheduler** - Cron jobs and scheduled tasks
41
+
42
+ #### Payment Processing
43
+ - 💳 **Stripe** - Global card payments and subscriptions
44
+ - 🏦 **PayPal** - Digital wallet and card processing
45
+ - 📱 **M-Pesa** - Kenya mobile money (Safaricom STK Push)
46
+
47
+ #### Security Features
48
+ - 🔑 **JWT Authentication** - Token-based authentication
49
+ - 🗝️ **API Key Authentication** - Secure API access
50
+ - 👥 **RBAC** - Role-based access control
51
+ - 🚦 **Rate Limiting** - API abuse prevention
52
+ - ✅ **Input Validation** - Schema-based validation with Joi
53
+ - 📋 **Audit Logging** - Security event tracking
54
+ - 🔒 **HTTPS Only** - Security headers and TLS enforcement
55
+ - 🔐 **Credential Manager** - Encrypted credential storage with AES-256-GCM
56
+
57
+ #### CLI Tools
58
+ - 🎯 **Interactive Setup** - `create-next-app` style project creation
59
+ - 🏗️ **Project Scaffolding** - Complete project templates
60
+ - 🔧 **Code Generation** - Boilerplate generation for tools, workflows, agents
61
+ - 🚀 **Deployment Support** - Docker, Kubernetes, AWS Lambda, Vercel configs
62
+
63
+ #### Deployment Options
64
+ - 🐳 **Docker** - Multi-stage builds with security best practices
65
+ - ☸️ **Kubernetes** - Complete K8s manifests
66
+ - λ **AWS Lambda** - Serverless deployment
67
+ - ▲ **Vercel** - Edge deployment
68
+ - 🚂 **Railway** - One-click deployment
69
+ - 🐧 **Systemd** - Linux service configuration
70
+
71
+ #### Developer Experience
72
+ - 📘 **TypeScript First** - Full type safety and IntelliSense
73
+ - 🧪 **Property-Based Testing** - 136 tests with fast-check
74
+ - 📚 **Comprehensive Documentation** - README, API docs, examples
75
+ - 🔍 **Error Handling** - Detailed error messages and logging
76
+ - 🎨 **Code Quality** - ESLint, Prettier, strict TypeScript
77
+
78
+ ### Technical Details
79
+ - **Node.js**: >=18.0.0 required
80
+ - **TypeScript**: 5.0+ with strict mode
81
+ - **Testing**: Jest with 136 passing tests
82
+ - **Package**: Scoped as `@agentx/framework`
83
+ - **License**: MIT
84
+
85
+ ### Breaking Changes
86
+ - None (initial release)
87
+
88
+ ### Migration Guide
89
+ - None (initial release)
90
+
91
+ ---
92
+
93
+ ## [Unreleased]
94
+
95
+ ### Planned Features
96
+ - 🔄 **Workflow Visual Editor** - Web-based workflow designer
97
+ - 📊 **Monitoring Dashboard** - Real-time metrics and logging
98
+ - 🔌 **Plugin Marketplace** - Community-driven integrations
99
+ - 🌍 **Multi-language Support** - Python, Go, Rust SDKs
100
+ - 🔄 **Workflow Templates** - Pre-built automation templates
101
+ - 📱 **Mobile SDK** - React Native integration
102
+ - 🎯 **A/B Testing** - Built-in experimentation framework
103
+ - 🔍 **Advanced Analytics** - Usage metrics and insights
104
+
105
+ ---
106
+
107
+ For more details, see the [GitHub releases](https://github.com/agentx/agentx/releases).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 AgentX Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,335 @@
1
+ # AgentX Framework
2
+
3
+ [![npm version](https://badge.fury.io/js/%40ggakila%2Fagentx-framework.svg)](https://badge.fury.io/js/%40ggakila%2Fagentx-framework)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/)
7
+
8
+ > Production-grade, TypeScript-based AI agent framework with n8n parity and native AI agent support
9
+
10
+ AgentX is a comprehensive framework for building AI-powered automation workflows and autonomous agents. It provides a code-first alternative to n8n with native LLM integration, 15+ built-in integrations, and enterprise-grade security features.
11
+
12
+ ## ✨ Features
13
+
14
+ - 🤖 **Native AI Agent Support** - Built-in LLM integration (OpenAI, Anthropic, Local models)
15
+ - 🔄 **Workflow Engine** - DAG-based workflow execution with parallel processing
16
+ - 🔌 **15+ Integrations** - HTTP, Webhooks, Slack, WhatsApp, Telegram, Google Workspace, Databases, AWS S3, and more
17
+ - 💳 **Payment Processing** - Stripe, PayPal, and M-Pesa integration out of the box
18
+ - 🔒 **Enterprise Security** - RBAC, rate limiting, audit logging, input validation
19
+ - 🐳 **Deployment Ready** - Docker, Kubernetes, AWS Lambda, Vercel support
20
+ - 📦 **Interactive CLI** - `create-next-app` style project scaffolding
21
+ - 🎯 **TypeScript First** - Full type safety and IntelliSense support
22
+
23
+ ## 🚀 Quick Start
24
+
25
+ ### Create a New Project
26
+
27
+ ```bash
28
+ # Interactive setup (recommended)
29
+ npx @ggakila/agentx-framework create my-agent-app
30
+
31
+ # Or with defaults
32
+ npx @ggakila/agentx-framework create my-agent-app -y
33
+ ```
34
+
35
+ ### Install in Existing Project
36
+
37
+ ```bash
38
+ npm install @ggakila/agentx-framework
39
+ ```
40
+
41
+ ## 📖 Basic Usage
42
+
43
+ ### 1. Simple AI Agent
44
+
45
+ ```typescript
46
+ import { AgentXRuntime, AIAgent } from '@ggakila/agentx-framework';
47
+
48
+ const agent = new AIAgent({
49
+ name: 'my-assistant',
50
+ llmProvider: 'openai',
51
+ model: 'gpt-4',
52
+ systemPrompt: 'You are a helpful assistant.',
53
+ allowedTools: ['http', 'email'],
54
+ });
55
+
56
+ const runtime = new AgentXRuntime({
57
+ llm: {
58
+ providers: {
59
+ openai: { apiKey: process.env.OPENAI_API_KEY }
60
+ }
61
+ }
62
+ });
63
+
64
+ await runtime.start();
65
+ const result = await agent.execute('Send a welcome email to new users');
66
+ ```
67
+
68
+ ### 2. Workflow Automation
69
+
70
+ ```typescript
71
+ import { WorkflowExecutor } from '@ggakila/agentx-framework';
72
+
73
+ const workflow = {
74
+ id: 'user-onboarding',
75
+ steps: [
76
+ {
77
+ id: 'fetch-user',
78
+ type: 'tool',
79
+ tool: 'http',
80
+ config: { method: 'GET', url: 'https://api.example.com/users/{{userId}}' }
81
+ },
82
+ {
83
+ id: 'send-welcome',
84
+ type: 'tool',
85
+ tool: 'email',
86
+ config: {
87
+ to: '{{user.email}}',
88
+ subject: 'Welcome!',
89
+ body: 'Welcome {{user.name}}!'
90
+ }
91
+ }
92
+ ]
93
+ };
94
+
95
+ const executor = new WorkflowExecutor(toolRegistry);
96
+ await executor.execute(workflow, { userId: '123' });
97
+ ```
98
+
99
+ ### 3. M-Pesa Payment Integration
100
+
101
+ ```typescript
102
+ import { MPesaProvider } from '@ggakila/agentx-framework';
103
+
104
+ const mpesa = new MPesaProvider(logger);
105
+ await mpesa.initialize({
106
+ credentials: {
107
+ consumerKey: process.env.MPESA_CONSUMER_KEY,
108
+ consumerSecret: process.env.MPESA_CONSUMER_SECRET,
109
+ shortcode: process.env.MPESA_SHORTCODE,
110
+ passkey: process.env.MPESA_PASSKEY,
111
+ },
112
+ environment: 'sandbox'
113
+ });
114
+
115
+ const result = await mpesa.processPayment({
116
+ amount: 100,
117
+ currency: 'KES',
118
+ metadata: { phoneNumber: '254712345678' },
119
+ description: 'Payment for services'
120
+ });
121
+ ```
122
+
123
+ ## 🔧 Configuration
124
+
125
+ ### Environment Variables
126
+
127
+ ```bash
128
+ # LLM Providers
129
+ OPENAI_API_KEY=your-openai-key
130
+ ANTHROPIC_API_KEY=your-anthropic-key
131
+
132
+ # M-Pesa (Safaricom)
133
+ MPESA_CONSUMER_KEY=your-consumer-key
134
+ MPESA_CONSUMER_SECRET=your-consumer-secret
135
+ MPESA_SHORTCODE=174379
136
+ MPESA_PASSKEY=your-passkey
137
+
138
+ # Integrations
139
+ SLACK_BOT_TOKEN=xoxb-your-token
140
+ DATABASE_URL=postgresql://user:pass@localhost:5432/db
141
+ REDIS_URL=redis://localhost:6379
142
+ ```
143
+
144
+ ### Runtime Configuration
145
+
146
+ ```typescript
147
+ const config = {
148
+ llm: {
149
+ defaultProvider: 'openai',
150
+ providers: {
151
+ openai: { apiKey: process.env.OPENAI_API_KEY },
152
+ anthropic: { apiKey: process.env.ANTHROPIC_API_KEY }
153
+ }
154
+ },
155
+ security: {
156
+ rateLimit: { windowMs: 900000, max: 100 },
157
+ cors: { origin: ['https://yourdomain.com'] }
158
+ },
159
+ features: {
160
+ workflows: true,
161
+ agents: true,
162
+ payments: true,
163
+ security: true
164
+ }
165
+ };
166
+ ```
167
+
168
+ ## 🏗️ Architecture
169
+
170
+ AgentX follows a modular architecture:
171
+
172
+ - **Runtime** - Core execution environment and lifecycle management
173
+ - **Agents** - AI-powered autonomous agents with LLM integration
174
+ - **Workflows** - DAG-based workflow execution engine
175
+ - **Tools** - Extensible integration system (HTTP, databases, messaging, etc.)
176
+ - **Transport** - Communication layer (HTTP, WebSocket, Queue, etc.)
177
+ - **Security** - Authentication, authorization, rate limiting, audit logging
178
+ - **Payments** - Multi-provider payment processing
179
+
180
+ ## 🔌 Available Integrations
181
+
182
+ ### Communication
183
+ - **HTTP/REST** - Make API calls and handle responses
184
+ - **Webhooks** - Receive and send webhook notifications
185
+ - **Slack** - Send messages, create channels, manage users
186
+ - **WhatsApp** - WhatsApp Business API integration
187
+ - **Telegram** - Telegram Bot API integration
188
+ - **Email** - SMTP email sending
189
+
190
+ ### Data & Storage
191
+ - **SQL Databases** - PostgreSQL, MySQL, SQLite support
192
+ - **MongoDB** - NoSQL database integration
193
+ - **Redis** - Caching and session storage
194
+ - **Amazon S3** - File storage and retrieval
195
+ - **File System** - Local file operations
196
+
197
+ ### Productivity
198
+ - **Google Docs** - Create and edit documents
199
+ - **Google Sheets** - Spreadsheet operations
200
+ - **Google Drive** - File management
201
+
202
+ ### Payments
203
+ - **Stripe** - Global card payments and subscriptions
204
+ - **PayPal** - Digital wallet and card processing
205
+ - **M-Pesa** - Kenya mobile money (Safaricom)
206
+
207
+ ### Automation
208
+ - **Scheduler** - Cron jobs and scheduled tasks
209
+ - **Workflow Engine** - Complex automation workflows
210
+
211
+ ## 🚀 Deployment
212
+
213
+ ### Docker
214
+
215
+ ```dockerfile
216
+ FROM node:18-alpine
217
+ WORKDIR /app
218
+ COPY package*.json ./
219
+ RUN npm ci --only=production
220
+ COPY . .
221
+ RUN npm run build
222
+ EXPOSE 3000
223
+ CMD ["npm", "start"]
224
+ ```
225
+
226
+ ### Kubernetes
227
+
228
+ ```yaml
229
+ apiVersion: apps/v1
230
+ kind: Deployment
231
+ metadata:
232
+ name: agentx-app
233
+ spec:
234
+ replicas: 3
235
+ selector:
236
+ matchLabels:
237
+ app: agentx-app
238
+ template:
239
+ metadata:
240
+ labels:
241
+ app: agentx-app
242
+ spec:
243
+ containers:
244
+ - name: agentx-app
245
+ image: your-registry/agentx-app:latest
246
+ ports:
247
+ - containerPort: 3000
248
+ env:
249
+ - name: OPENAI_API_KEY
250
+ valueFrom:
251
+ secretKeyRef:
252
+ name: agentx-secrets
253
+ key: openai-api-key
254
+ ```
255
+
256
+ ### AWS Lambda
257
+
258
+ ```typescript
259
+ import { APIGatewayProxyHandler } from 'aws-lambda';
260
+ import { AgentXRuntime } from '@ggakila/agentx-framework';
261
+
262
+ export const handler: APIGatewayProxyHandler = async (event) => {
263
+ const runtime = new AgentXRuntime(config);
264
+ await runtime.start();
265
+
266
+ // Handle the request
267
+ const result = await runtime.processRequest(event);
268
+
269
+ return {
270
+ statusCode: 200,
271
+ body: JSON.stringify(result)
272
+ };
273
+ };
274
+ ```
275
+
276
+ ## 🔒 Security
277
+
278
+ AgentX includes enterprise-grade security features:
279
+
280
+ - **Authentication** - JWT, API keys, OAuth2
281
+ - **Authorization** - Role-based access control (RBAC)
282
+ - **Rate Limiting** - Prevent API abuse and DoS attacks
283
+ - **Input Validation** - Schema-based validation with Joi
284
+ - **Audit Logging** - Security event tracking
285
+ - **HTTPS Only** - Security headers and TLS enforcement
286
+
287
+ ## 📚 Documentation
288
+
289
+ - [Getting Started Guide](https://agentx.dev/docs/getting-started)
290
+ - [API Reference](https://agentx.dev/docs/api)
291
+ - [Integration Guides](https://agentx.dev/docs/integrations)
292
+ - [Deployment Guide](https://agentx.dev/docs/deployment)
293
+ - [Security Best Practices](https://agentx.dev/docs/security)
294
+
295
+ ## 🤝 Contributing
296
+
297
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
298
+
299
+ ### Development Setup
300
+
301
+ ```bash
302
+ git clone https://github.com/agentx/agentx.git
303
+ cd agentx
304
+ npm install
305
+ npm run dev
306
+ ```
307
+
308
+ ### Running Tests
309
+
310
+ ```bash
311
+ npm test # Run all tests
312
+ npm run test:watch # Watch mode
313
+ npm run test:coverage # Coverage report
314
+ ```
315
+
316
+ ## 📄 License
317
+
318
+ MIT License - see the [LICENSE](LICENSE) file for details.
319
+
320
+ ## 🙏 Acknowledgments
321
+
322
+ - Inspired by n8n's workflow automation approach
323
+ - Built with TypeScript and modern Node.js practices
324
+ - Integrates with leading AI providers and services
325
+
326
+ ## 📞 Support
327
+
328
+ - 📧 Email: support@agentx.dev
329
+ - 💬 Discord: [Join our community](https://discord.gg/agentx)
330
+ - 🐛 Issues: [GitHub Issues](https://github.com/agentx/agentx/issues)
331
+ - 📖 Docs: [agentx.dev](https://agentx.dev)
332
+
333
+ ---
334
+
335
+ **AgentX** - Build the future of AI automation 🚀
@@ -0,0 +1,110 @@
1
+ /**
2
+ * AI Agent System Implementation
3
+ * Provides goal-based execution with tool calling and memory
4
+ */
5
+ import { Agent, AgentConfig, AgentContext, AgentResult, ChatMessage, ChatResponse } from '../types/agent';
6
+ import { ToolResult, Logger } from '../types/tool';
7
+ import { LLMProvider } from '../types/llm';
8
+ export interface AgentDependencies {
9
+ llmProvider: LLMProvider;
10
+ toolExecutor: (toolName: string, args: Record<string, unknown>, context: AgentContext) => Promise<ToolResult>;
11
+ logger: Logger;
12
+ }
13
+ /**
14
+ * Memory store interface
15
+ */
16
+ export interface MemoryStore {
17
+ save(key: string, value: unknown): Promise<void>;
18
+ get(key: string): Promise<unknown | null>;
19
+ delete(key: string): Promise<void>;
20
+ clear(): Promise<void>;
21
+ list(): Promise<string[]>;
22
+ }
23
+ /**
24
+ * In-memory store implementation
25
+ */
26
+ export declare class InMemoryStore implements MemoryStore {
27
+ private store;
28
+ save(key: string, value: unknown): Promise<void>;
29
+ get(key: string): Promise<unknown | null>;
30
+ delete(key: string): Promise<void>;
31
+ clear(): Promise<void>;
32
+ list(): Promise<string[]>;
33
+ }
34
+ /**
35
+ * AI Agent implementation
36
+ */
37
+ export declare class AIAgent implements Agent {
38
+ readonly id: string;
39
+ readonly name: string;
40
+ readonly config: AgentConfig;
41
+ private llmProvider;
42
+ private toolExecutor;
43
+ private logger;
44
+ private memory;
45
+ private conversationHistory;
46
+ constructor(config: AgentConfig, deps: AgentDependencies, memory?: MemoryStore);
47
+ /**
48
+ * Execute a goal-based task
49
+ */
50
+ execute(goal: string, context: AgentContext): Promise<AgentResult>;
51
+ /**
52
+ * Chat with the agent
53
+ */
54
+ chat(messages: ChatMessage[], context: AgentContext): Promise<ChatResponse>;
55
+ /**
56
+ * Save to agent memory
57
+ */
58
+ saveMemory(key: string, value: unknown): Promise<void>;
59
+ /**
60
+ * Get from agent memory
61
+ */
62
+ getMemory(key: string): Promise<unknown>;
63
+ /**
64
+ * Clear agent memory
65
+ */
66
+ clearMemory(): Promise<void>;
67
+ /**
68
+ * Get conversation history
69
+ */
70
+ getConversationHistory(): ChatMessage[];
71
+ /**
72
+ * Filter tools to only those allowed for this agent
73
+ */
74
+ private filterAllowedTools;
75
+ /**
76
+ * Extract reasoning from conversation
77
+ */
78
+ private extractReasoning;
79
+ }
80
+ /**
81
+ * Agent Manager for creating and managing agents
82
+ */
83
+ export declare class AgentManager {
84
+ private agents;
85
+ private llmProviders;
86
+ private toolExecutor;
87
+ private logger;
88
+ constructor(toolExecutor: AgentDependencies['toolExecutor'], logger: Logger);
89
+ /**
90
+ * Register an LLM provider
91
+ */
92
+ registerProvider(name: string, provider: LLMProvider): void;
93
+ /**
94
+ * Create a new agent
95
+ */
96
+ createAgent(config: AgentConfig, memory?: MemoryStore): AIAgent;
97
+ /**
98
+ * Get an agent by ID
99
+ */
100
+ getAgent(id: string): AIAgent | undefined;
101
+ /**
102
+ * List all agents
103
+ */
104
+ listAgents(): AIAgent[];
105
+ /**
106
+ * Remove an agent
107
+ */
108
+ removeAgent(id: string): Promise<void>;
109
+ }
110
+ //# sourceMappingURL=Agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../src/agent/Agent.ts"],"names":[],"mappings":"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"}