@agenticmail/enterprise 0.4.3 → 0.5.1

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 (159) hide show
  1. package/README.md +608 -923
  2. package/dashboards/django/app.py +12 -0
  3. package/dashboards/django/static/styles.css +449 -246
  4. package/dashboards/django/templates/activity.html +130 -0
  5. package/dashboards/django/templates/approvals.html +115 -0
  6. package/dashboards/django/templates/community-skills.html +89 -0
  7. package/dashboards/django/templates/domain-status.html +59 -0
  8. package/dashboards/django/templates/knowledge-contributions.html +58 -0
  9. package/dashboards/django/templates/knowledge.html +104 -0
  10. package/dashboards/django/templates/layout.html +161 -36
  11. package/dashboards/django/templates/skill-connections.html +73 -0
  12. package/dashboards/django/templates/workforce.html +116 -0
  13. package/dashboards/django/views/__init__.py +14 -0
  14. package/dashboards/django/views/new_pages.py +38 -0
  15. package/dashboards/dotnet/Program.cs +8 -0
  16. package/dashboards/dotnet/Routes/ActivityRoutes.cs +35 -0
  17. package/dashboards/dotnet/Routes/ApprovalRoutes.cs +36 -0
  18. package/dashboards/dotnet/Routes/CommunitySkillRoutes.cs +36 -0
  19. package/dashboards/dotnet/Routes/DomainStatusRoutes.cs +49 -0
  20. package/dashboards/dotnet/Routes/KnowledgeContributionRoutes.cs +42 -0
  21. package/dashboards/dotnet/Routes/KnowledgeRoutes.cs +40 -0
  22. package/dashboards/dotnet/Routes/SkillConnectionRoutes.cs +52 -0
  23. package/dashboards/dotnet/Routes/WorkforceRoutes.cs +55 -0
  24. package/dashboards/dotnet/Services/HtmlBuilder.cs +17 -8
  25. package/dashboards/dotnet/wwwroot/styles.css +508 -246
  26. package/dashboards/express/app.js +8 -0
  27. package/dashboards/express/public/styles.css +163 -272
  28. package/dashboards/express/routes/activity.js +101 -0
  29. package/dashboards/express/routes/approvals.js +100 -0
  30. package/dashboards/express/routes/community-skills.js +83 -0
  31. package/dashboards/express/routes/domain-status.js +78 -0
  32. package/dashboards/express/routes/knowledge-contributions.js +85 -0
  33. package/dashboards/express/routes/knowledge.js +83 -0
  34. package/dashboards/express/routes/skill-connections.js +86 -0
  35. package/dashboards/express/routes/workforce.js +126 -0
  36. package/dashboards/express/views/layout.js +54 -33
  37. package/dashboards/go/handlers/activity.go +30 -0
  38. package/dashboards/go/handlers/approvals.go +31 -0
  39. package/dashboards/go/handlers/community_skills.go +32 -0
  40. package/dashboards/go/handlers/domain_status.go +62 -0
  41. package/dashboards/go/handlers/knowledge.go +35 -0
  42. package/dashboards/go/handlers/knowledge_contributions.go +37 -0
  43. package/dashboards/go/handlers/skill_connections.go +59 -0
  44. package/dashboards/go/handlers/workforce.go +60 -0
  45. package/dashboards/go/main.go +8 -0
  46. package/dashboards/go/static/styles.css +508 -246
  47. package/dashboards/go/templates/layout.go +16 -11
  48. package/dashboards/html/index.html +136 -15
  49. package/dashboards/html/public/styles.css +531 -134
  50. package/dashboards/html/src/pages/activity.js +137 -0
  51. package/dashboards/html/src/pages/approvals.js +155 -0
  52. package/dashboards/html/src/pages/community-skills.js +236 -0
  53. package/dashboards/html/src/pages/domain-status.js +182 -0
  54. package/dashboards/html/src/pages/knowledge-contributions.js +319 -0
  55. package/dashboards/html/src/pages/knowledge.js +251 -0
  56. package/dashboards/html/src/pages/skill-connections.js +293 -0
  57. package/dashboards/html/src/pages/workforce.js +418 -0
  58. package/dashboards/html/src/router.js +51 -0
  59. package/dashboards/java/AgenticMailDashboard.java +8 -0
  60. package/dashboards/java/handlers/ActivityHandler.java +42 -0
  61. package/dashboards/java/handlers/ApprovalsHandler.java +43 -0
  62. package/dashboards/java/handlers/CommunitySkillsHandler.java +45 -0
  63. package/dashboards/java/handlers/DomainStatusHandler.java +58 -0
  64. package/dashboards/java/handlers/KnowledgeContributionsHandler.java +51 -0
  65. package/dashboards/java/handlers/KnowledgeHandler.java +49 -0
  66. package/dashboards/java/handlers/SkillConnectionsHandler.java +61 -0
  67. package/dashboards/java/handlers/WorkforceHandler.java +64 -0
  68. package/dashboards/java/static/styles.css +508 -250
  69. package/dashboards/java/templates/Layout.java +14 -6
  70. package/dashboards/laravel/controllers/ActivityController.php +18 -0
  71. package/dashboards/laravel/controllers/ApprovalsController.php +18 -0
  72. package/dashboards/laravel/controllers/CommunitySkillsController.php +18 -0
  73. package/dashboards/laravel/controllers/DomainStatusController.php +18 -0
  74. package/dashboards/laravel/controllers/KnowledgeContributionsController.php +18 -0
  75. package/dashboards/laravel/controllers/KnowledgeController.php +18 -0
  76. package/dashboards/laravel/controllers/SkillConnectionsController.php +18 -0
  77. package/dashboards/laravel/controllers/WorkforceController.php +18 -0
  78. package/dashboards/laravel/index.php +56 -0
  79. package/dashboards/laravel/public/styles.css +163 -279
  80. package/dashboards/laravel/views/activity.php +127 -0
  81. package/dashboards/laravel/views/approvals.php +152 -0
  82. package/dashboards/laravel/views/community-skills.php +131 -0
  83. package/dashboards/laravel/views/domain-status.php +167 -0
  84. package/dashboards/laravel/views/knowledge-contributions.php +185 -0
  85. package/dashboards/laravel/views/knowledge.php +167 -0
  86. package/dashboards/laravel/views/layout.php +54 -41
  87. package/dashboards/laravel/views/skill-connections.php +192 -0
  88. package/dashboards/laravel/views/workforce.php +265 -0
  89. package/dashboards/php/components/layout.php +21 -16
  90. package/dashboards/php/index.php +1 -1
  91. package/dashboards/php/pages/activity.php +35 -0
  92. package/dashboards/php/pages/approvals.php +36 -0
  93. package/dashboards/php/pages/community-skills.php +39 -0
  94. package/dashboards/php/pages/domain-status.php +87 -0
  95. package/dashboards/php/pages/knowledge-contributions.php +47 -0
  96. package/dashboards/php/pages/knowledge.php +43 -0
  97. package/dashboards/php/pages/skill-connections.php +94 -0
  98. package/dashboards/php/pages/workforce.php +89 -0
  99. package/dashboards/php/public/styles.css +168 -74
  100. package/dashboards/python/app.py +16 -0
  101. package/dashboards/python/routes/activity.py +11 -0
  102. package/dashboards/python/routes/approvals.py +11 -0
  103. package/dashboards/python/routes/community_skills.py +11 -0
  104. package/dashboards/python/routes/domain_status.py +11 -0
  105. package/dashboards/python/routes/knowledge.py +11 -0
  106. package/dashboards/python/routes/knowledge_contributions.py +11 -0
  107. package/dashboards/python/routes/skill_connections.py +11 -0
  108. package/dashboards/python/routes/workforce.py +11 -0
  109. package/dashboards/python/static/styles.css +163 -276
  110. package/dashboards/python/templates/activity.html +87 -0
  111. package/dashboards/python/templates/approvals.html +86 -0
  112. package/dashboards/python/templates/community-skills.html +69 -0
  113. package/dashboards/python/templates/domain-status.html +64 -0
  114. package/dashboards/python/templates/knowledge-contributions.html +71 -0
  115. package/dashboards/python/templates/knowledge.html +69 -0
  116. package/dashboards/python/templates/layout.html +103 -68
  117. package/dashboards/python/templates/skill-connections.html +72 -0
  118. package/dashboards/python/templates/workforce.html +112 -0
  119. package/dashboards/rails/app.rb +8 -0
  120. package/dashboards/rails/public/styles.css +506 -259
  121. package/dashboards/rails/routes/activity.rb +10 -0
  122. package/dashboards/rails/routes/approvals.rb +10 -0
  123. package/dashboards/rails/routes/community_skills.rb +11 -0
  124. package/dashboards/rails/routes/domain_status.rb +16 -0
  125. package/dashboards/rails/routes/knowledge.rb +11 -0
  126. package/dashboards/rails/routes/knowledge_contributions.rb +12 -0
  127. package/dashboards/rails/routes/skill_connections.rb +15 -0
  128. package/dashboards/rails/routes/workforce.rb +16 -0
  129. package/dashboards/rails/views/activity.erb +56 -0
  130. package/dashboards/rails/views/approvals.erb +60 -0
  131. package/dashboards/rails/views/community_skills.erb +69 -0
  132. package/dashboards/rails/views/domain_status.erb +75 -0
  133. package/dashboards/rails/views/knowledge.erb +67 -0
  134. package/dashboards/rails/views/knowledge_contributions.erb +70 -0
  135. package/dashboards/rails/views/layout.erb +23 -15
  136. package/dashboards/rails/views/skill_connections.erb +109 -0
  137. package/dashboards/rails/views/workforce.erb +124 -0
  138. package/dashboards/ruby/app.rb +8 -0
  139. package/dashboards/ruby/public/styles.css +506 -254
  140. package/dashboards/ruby/routes/activity.rb +10 -0
  141. package/dashboards/ruby/routes/approvals.rb +10 -0
  142. package/dashboards/ruby/routes/community_skills.rb +11 -0
  143. package/dashboards/ruby/routes/domain_status.rb +16 -0
  144. package/dashboards/ruby/routes/knowledge.rb +11 -0
  145. package/dashboards/ruby/routes/knowledge_contributions.rb +12 -0
  146. package/dashboards/ruby/routes/skill_connections.rb +15 -0
  147. package/dashboards/ruby/routes/workforce.rb +16 -0
  148. package/dashboards/ruby/views/activity.erb +56 -0
  149. package/dashboards/ruby/views/approvals.erb +60 -0
  150. package/dashboards/ruby/views/community_skills.erb +69 -0
  151. package/dashboards/ruby/views/domain_status.erb +75 -0
  152. package/dashboards/ruby/views/knowledge.erb +67 -0
  153. package/dashboards/ruby/views/knowledge_contributions.erb +70 -0
  154. package/dashboards/ruby/views/layout.erb +22 -13
  155. package/dashboards/ruby/views/skill_connections.erb +109 -0
  156. package/dashboards/ruby/views/workforce.erb +124 -0
  157. package/dashboards/shared/styles.css +505 -281
  158. package/dashboards/shared-styles.css +534 -45
  159. package/package.json +1 -1
package/README.md CHANGED
@@ -1,1120 +1,805 @@
1
1
  # @agenticmail/enterprise
2
2
 
3
- **Deploy and manage AI agents as employees in your organization.** Full platform for configuring agent skills, permissions, deployment targets, lifecycle management, and compliance — with a web dashboard and REST API.
3
+ **AI Agent Identity, Email & Workforce Platform for Organizations**
4
4
 
5
- AgenticMail Enterprise turns AI agents into managed employees. You define what an agent can do (skills, tools, permissions), where it runs (Docker, VPS, Fly.io, Railway), and how it's supervised (approval workflows, activity tracking, audit logs). The platform handles provisioning, health monitoring, auto-recovery, and multi-tenant isolation. Each agent gets its own email, workspace, and tool access — governed by policies you control from a single dashboard.
5
+ Deploy, manage, and govern AI agents as first-class employees each with their own email address, skills, permissions, memory, and lifecycle. Built on [AgenticMail](https://agenticmail.io) + [OpenClaw](https://openclaw.ai).
6
6
 
7
- [![npm](https://img.shields.io/npm/v/@agenticmail/enterprise)](https://www.npmjs.com/package/@agenticmail/enterprise)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
9
- [![Node.js](https://img.shields.io/badge/Node.js-20%2B-green)](https://nodejs.org)
7
+ ```bash
8
+ npx @agenticmail/enterprise
9
+ ```
10
+
11
+ One command. Interactive setup wizard. Dashboard URL in under 2 minutes.
10
12
 
11
13
  ---
12
14
 
13
15
  ## Table of Contents
14
16
 
17
+ - [Overview](#overview)
15
18
  - [Quick Start](#quick-start)
16
- - [What This Does (Plain English)](#what-this-does-plain-english)
17
- - [Architecture](#architecture)
18
19
  - [Setup Wizard](#setup-wizard)
19
- - [Database Support](#database-support)
20
- - [The Engine](#the-engine)
21
- - [Skills & Permissions](#1-skills--permissions)
22
- - [Agent Configuration](#2-agent-configuration)
23
- - [Deployment Engine](#3-deployment-engine)
24
- - [Approval Workflows](#4-approval-workflows)
25
- - [Agent Lifecycle](#5-agent-lifecycle)
26
- - [Knowledge Base](#6-knowledge-base)
27
- - [Multi-Tenant Isolation](#7-multi-tenant-isolation)
28
- - [Activity Tracking](#8-activity-tracking)
29
- - [Tool Catalog](#9-tool-catalog)
30
- - [Runtime Hooks](#10-runtime-hooks)
31
- - [AgenticMail Bridge](#11-agenticmail-bridge)
32
- - [REST API](#rest-api)
33
- - [Authentication](#authentication)
34
- - [Admin Endpoints](#admin-endpoints)
35
- - [Engine Endpoints](#engine-endpoints)
20
+ - [Architecture](#architecture)
21
+ - [Database Backends](#database-backends)
22
+ - [Engine Modules](#engine-modules)
23
+ - [Agent Runtime](#agent-runtime)
24
+ - [MCP Integration Adapters](#mcp-integration-adapters)
25
+ - [Agent Tools](#agent-tools)
26
+ - [Enterprise Skills](#enterprise-skills)
36
27
  - [Dashboard](#dashboard)
28
+ - [API Reference](#api-reference)
37
29
  - [Deployment](#deployment)
38
- - [AgenticMail Cloud](#agenticmail-cloud)
39
- - [Fly.io](#flyio)
40
- - [Docker](#docker)
41
- - [Local Development](#local-development)
42
- - [Server Configuration](#server-configuration)
43
- - [Middleware](#middleware)
44
- - [Resilience](#resilience)
45
- - [Programmatic Usage](#programmatic-usage)
30
+ - [CLI Commands](#cli-commands)
46
31
  - [Security](#security)
32
+ - [Community Skills](#community-skills)
33
+ - [Configuration](#configuration)
47
34
  - [License](#license)
48
35
 
49
36
  ---
50
37
 
51
- ## Quick Start
52
-
53
- ```bash
54
- npx @agenticmail/enterprise
55
- ```
56
-
57
- The interactive wizard walks you through:
58
- 1. Company name and admin credentials
59
- 2. Database selection (10 backends supported)
60
- 3. Deployment target (Cloud, Fly.io, Docker, Railway, or Local)
61
- 4. Optional custom domain
62
-
63
- Within 2 minutes you get a live dashboard URL with your admin account ready.
38
+ ## Overview
39
+
40
+ AgenticMail Enterprise turns your organization's AI agents into managed employees:
41
+
42
+ - **Identity** — Each agent gets a real email address, phone number, and digital identity
43
+ - **Skills** — 47 enterprise skill definitions (Google Workspace, Microsoft 365, custom) + 147 SaaS integration adapters
44
+ - **Permissions** Fine-grained tool-level access control with 5 preset profiles
45
+ - **Governance** DLP scanning, guardrails, anomaly detection, compliance reporting, action journaling with rollback
46
+ - **Workforce** Shifts, schedules, on-call rotations, capacity planning, birthday automation
47
+ - **Runtime** Full agent execution loop with LLM streaming, session management, sub-agents, budget gates
48
+ - **Dashboard** Admin UI with dark/light themes, real-time activity tracking, agent creation wizard
49
+
50
+ ### By the Numbers
51
+
52
+ | Metric | Count |
53
+ |--------|-------|
54
+ | Source files | 342 |
55
+ | Engine modules | 25+ |
56
+ | API routes | 328 |
57
+ | Database backends | 10 |
58
+ | SaaS integration adapters | 147 |
59
+ | Enterprise skill definitions | 47 |
60
+ | Agent tools | 28 |
61
+ | Route sub-apps | 22 |
62
+ | Soul templates | 51 (14 categories) |
63
+ | Community skill marketplace | Built-in |
64
64
 
65
65
  ---
66
66
 
67
- ## What This Does (Plain English)
68
-
69
- Think of AgenticMail Enterprise as an HR department for AI agents.
70
-
71
- **The problem:** You want to deploy AI agents that do real work — answer customer emails, research topics, write reports, manage schedules. But right now, setting up each agent means manually configuring tools, permissions, credentials, deployment, and monitoring. Scale that to 10 or 50 agents across a team, and it becomes unmanageable.
72
-
73
- **What Enterprise does:**
74
-
75
- - **Hiring** — You pick from 38 pre-built skill sets (email management, web research, coding, customer support, etc.) and assign them to a new agent. The platform generates all the config files, workspace setup, and tool permissions automatically.
76
-
77
- - **Onboarding** — The agent gets deployed to your chosen infrastructure (a Docker container, a VPS, Fly.io, Railway, or our managed cloud). It gets its own email address, API keys, and workspace. No manual setup.
78
-
79
- - **Permissions** — You control exactly what each agent can and can't do. "This agent can send emails but not access the filesystem." "This agent can browse the web but needs approval before making purchases." Five preset permission profiles (Research Assistant, Customer Support, Developer, Full Access, Sandbox) or fully custom.
80
-
81
- - **Supervision** — Sensitive actions trigger approval workflows. An agent wants to send an email to a client? It gets queued for human review first. You set the policies.
67
+ ## Quick Start
82
68
 
83
- - **Health & Recovery** The platform monitors every agent. If one crashes, it auto-restarts. If it's stuck, it gets flagged. You see everything in the dashboard — which agents are running, what they're doing, how much they cost.
69
+ ### Option A: Interactive Wizard (Recommended)
84
70
 
85
- - **Knowledge** — Agents can share knowledge bases. Upload documents, and the platform chunks them for retrieval. Agents search the knowledge base as part of their workflow.
71
+ ```bash
72
+ npx @agenticmail/enterprise
73
+ ```
86
74
 
87
- - **Teams** Multi-tenant isolation means different teams or clients get their own agents, data, and billing. Plan tiers (Free, Team, Enterprise, Self-Hosted) enforce limits.
75
+ The wizard walks you through:
76
+ 1. **Company Info** — Name, admin email, password, subdomain selection
77
+ 2. **Database** — Pick from 10 backends (SQLite for dev, Postgres/MySQL/MongoDB/DynamoDB/Turso for production)
78
+ 3. **Deployment** — AgenticMail Cloud, Fly.io, Railway, Docker, or Local
79
+ 4. **Custom Domain** — Optional: point your own domain at the dashboard
80
+ 5. **Domain Registration** — Optional: register with AgenticMail registry for domain protection
88
81
 
89
- - **Audit** Every action is logged. Who did what, when, to which resource. Compliance teams can pull reports.
82
+ ### Option B: Programmatic
90
83
 
91
- **In short:** You focus on what your agents should do. Enterprise handles how they run, where they run, and keeping them in line.
84
+ ```typescript
85
+ import { createServer } from '@agenticmail/enterprise';
86
+ import { createAdapter } from '@agenticmail/enterprise/db';
92
87
 
93
- ---
88
+ const db = await createAdapter({
89
+ type: 'postgres',
90
+ connectionString: process.env.DATABASE_URL,
91
+ });
92
+ await db.migrate();
94
93
 
95
- ## Architecture
94
+ const server = createServer({
95
+ port: 3000,
96
+ db,
97
+ jwtSecret: process.env.JWT_SECRET,
98
+ });
96
99
 
97
- ```
98
- ┌──────────────────────────────────────────────────────┐
99
- │ Dashboard (Web UI) │
100
- │ Single HTML · React 18 · CDN │
101
- └─────────────────────────┬────────────────────────────┘
102
- │ HTTP
103
- ┌─────────────────────────▼────────────────────────────┐
104
- │ Hono API Server │
105
- │ │
106
- │ ┌─────────┐ ┌──────────┐ ┌──────────────────────┐ │
107
- │ │ Auth │ │ Admin │ │ Engine │ │
108
- │ │ Routes │ │ Routes │ │ │ │
109
- │ │ │ │ │ │ Skills · Permissions │ │
110
- │ │ JWT │ │ Users │ │ Config · Deployer │ │
111
- │ │ Login │ │ Agents │ │ Approvals · Lifecycle│ │
112
- │ │ Keys │ │ Audit │ │ Knowledge · Tenants │ │
113
- │ │ │ │ Keys │ │ Activity · Hook │ │
114
- │ └─────────┘ └──────────┘ └──────────────────────┘ │
115
- │ │
116
- │ ┌─────────────────────────────────────────────────┐ │
117
- │ │ Middleware Stack │ │
118
- │ │ Rate Limit · CORS · Security Headers · Audit │ │
119
- │ │ Request ID · Error Handler · RBAC │ │
120
- │ └─────────────────────────────────────────────────┘ │
121
- │ │
122
- │ ┌─────────────────────────────────────────────────┐ │
123
- │ │ Resilience Layer │ │
124
- │ │ Circuit Breaker · Health Monitor · Retry │ │
125
- │ │ Rate Limiter · Keyed Rate Limiter │ │
126
- │ └─────────────────────────────────────────────────┘ │
127
- └─────────────────────────┬────────────────────────────┘
128
-
129
- ┌─────────────────────────▼────────────────────────────┐
130
- │ Database Adapter (Abstract) │
131
- │ │
132
- │ SQLite · Postgres · MySQL · MongoDB · DynamoDB │
133
- │ Turso · Supabase · Neon · PlanetScale · CockroachDB │
134
- └──────────────────────────────────────────────────────┘
100
+ await server.start();
135
101
  ```
136
102
 
137
103
  ---
138
104
 
139
105
  ## Setup Wizard
140
106
 
141
- The CLI wizard (`npx @agenticmail/enterprise`) runs in 4 steps:
107
+ The interactive setup wizard (`npx @agenticmail/enterprise` or `npx @agenticmail/enterprise setup`) guides you through every step with sensible defaults.
142
108
 
143
109
  ### Step 1: Company Info
144
- - Company name (used to generate your subdomain)
145
- - Admin email and password
110
+
111
+ - Company name
112
+ - Admin email + password (min 8 chars, requires uppercase or number)
113
+ - Subdomain selection with auto-generated suggestions (slug from company name, abbreviations, variants)
114
+ - "Generate more" option for random suffix suggestions
115
+ - Custom subdomain input with validation
146
116
 
147
117
  ### Step 2: Database
148
- Choose from 10 supported backends. Each asks for its specific connection details:
149
- - **SQLite** — file path (default: `./agenticmail-enterprise.db`)
150
- - **PostgreSQL / Supabase / Neon / CockroachDB** — connection string
151
- - **MySQL / PlanetScale** — connection string
152
- - **MongoDB** — connection URI
153
- - **DynamoDB** — AWS region + credentials
154
- - **Turso / LibSQL** — database URL + auth token
155
-
156
- ### Step 3: Deployment Target
157
- - **AgenticMail Cloud** — managed hosting, instant URL (`company.agenticmail.io`)
158
- - **Fly.io** — generates `fly.toml`, you deploy to your Fly account
159
- - **Railway** — generates Railway config
160
- - **Docker** — generates `docker-compose.yml` for self-hosting
161
- - **Local** — starts the server immediately on localhost (dev/testing)
162
-
163
- ### Step 4: Custom Domain (optional)
164
- Add a custom domain (e.g., `agents.agenticmail.io`) with CNAME setup instructions.
165
118
 
166
- ---
119
+ Choose from 10 backends organized by category:
167
120
 
168
- ## Database Support
121
+ | Category | Options |
122
+ |----------|---------|
123
+ | **SQL** | PostgreSQL, MySQL/MariaDB, SQLite |
124
+ | **NoSQL** | MongoDB |
125
+ | **Edge** | Turso (LibSQL) |
126
+ | **Cloud** | DynamoDB (AWS), Supabase, Neon, PlanetScale, CockroachDB |
169
127
 
170
- Enterprise uses an abstract `DatabaseAdapter` interface. All 10 backends implement the same methods — you pick the one that fits your infrastructure.
128
+ Each option collects the right credentials:
129
+ - **SQLite**: File path (default: `./agenticmail-enterprise.db`)
130
+ - **DynamoDB**: AWS Region + Access Key ID + Secret Access Key
131
+ - **Turso**: Database URL + Auth Token
132
+ - **All others**: Connection string with format hints
171
133
 
172
- | Database | Type | Connection | Best For |
173
- |----------|------|------------|----------|
174
- | **SQLite** | Embedded SQL | File path | Local dev, single-server, prototyping |
175
- | **PostgreSQL** | Hosted SQL | Connection string | Production, most cloud providers |
176
- | **MySQL** | Hosted SQL | Connection string | Existing MySQL infrastructure |
177
- | **MongoDB** | NoSQL | Connection URI | Document-oriented workloads |
178
- | **DynamoDB** | NoSQL | AWS credentials | AWS-native, serverless scale |
179
- | **Turso / LibSQL** | Edge SQL | URL + token | Edge deployments, global distribution |
180
- | **Supabase** | Managed Postgres | Connection string | Supabase ecosystem |
181
- | **Neon** | Serverless Postgres | Connection string | Serverless, branching |
182
- | **PlanetScale** | Managed MySQL | Connection string | PlanetScale ecosystem |
183
- | **CockroachDB** | Distributed SQL | Connection string | Multi-region, high availability |
134
+ ### Step 3: Deployment
184
135
 
185
- ### Adapter Pattern
136
+ | Target | Description |
137
+ |--------|-------------|
138
+ | **AgenticMail Cloud** | Managed hosting, instant URL (`subdomain.agenticmail.io`) |
139
+ | **Fly.io** | Your Fly.io account, generates `fly.toml` |
140
+ | **Railway** | Your Railway account, generates `railway.toml` |
141
+ | **Docker** | Self-hosted, generates `docker-compose.yml` + `.env` |
142
+ | **Local** | Dev/testing, starts server immediately on port 3000 |
186
143
 
187
- Every adapter extends `DatabaseAdapter` and implements:
144
+ ### Step 4: Custom Domain (Optional)
188
145
 
189
- ```typescript
190
- // Core operations
191
- migrate(): Promise<void>
192
- disconnect(): Promise<void>
193
- getStats(): Promise<Stats>
194
-
195
- // Users
196
- createUser(input: UserInput): Promise<User>
197
- getUserByEmail(email: string): Promise<User | null>
198
- validatePassword(email: string, password: string): Promise<User | null>
199
-
200
- // Agents
201
- createAgent(input: AgentInput): Promise<Agent>
202
- listAgents(filters?): Promise<Agent[]>
203
- getAgent(id: string): Promise<Agent | null>
204
- updateAgent(id: string, updates): Promise<Agent>
205
- deleteAgent(id: string): Promise<void>
206
-
207
- // API Keys
208
- createApiKey(input: ApiKeyInput): Promise<ApiKey>
209
- validateApiKey(key: string): Promise<ApiKey | null>
210
- revokeApiKey(id: string): Promise<void>
211
-
212
- // Audit Log
213
- logEvent(event: AuditEvent): Promise<void>
214
- getAuditLog(filters: AuditFilters): Promise<AuditEvent[]>
215
-
216
- // Settings
217
- getSettings(): Promise<CompanySettings>
218
- updateSettings(updates): Promise<CompanySettings>
219
- ```
146
+ For non-local deployments, optionally configure a custom domain. The wizard shows DNS instructions specific to your deployment target (CNAME for cloud/Fly, reverse proxy for Docker, Railway settings).
220
147
 
221
- ### MongoDB Notes
222
- - Uses `_id` field directly (stores `randomUUID()` as `_id`)
223
- - Indexes created on `email`, `apiKey`, `createdAt`
148
+ ### Step 5: Domain Registration (Optional)
224
149
 
225
- ### DynamoDB Notes
226
- - Single-table design with PK prefix pattern (`USER#`, `AGENT#`, `KEY#`, `AUDIT#`)
227
- - GSI1 for secondary access patterns
228
- - All entities in one table for cost efficiency
150
+ Registers your domain with the AgenticMail central registry:
151
+ - Generates a 256-bit deployment key (shown once, must be saved)
152
+ - Creates a DNS TXT verification challenge
153
+ - Optional immediate DNS verification (retries 5x with 10s intervals)
154
+ - Recovery via `agenticmail-enterprise recover` if key is available
229
155
 
230
- ### Creating a Custom Adapter
156
+ ---
231
157
 
232
- ```typescript
233
- import { DatabaseAdapter } from '@agenticmail/enterprise';
158
+ ## Architecture
234
159
 
235
- class MyAdapter extends DatabaseAdapter {
236
- async migrate() { /* create tables/collections */ }
237
- async createUser(input) { /* ... */ }
238
- // ... implement all abstract methods
239
- }
240
160
  ```
161
+ ┌─────────────────────────────────────────────────────────┐
162
+ │ Admin Dashboard │
163
+ │ (React, dark/light themes) │
164
+ ├─────────────────────────────────────────────────────────┤
165
+ │ Hono API Server │
166
+ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
167
+ │ │ Auth │ │ Admin │ │ Engine │ │
168
+ │ │ Routes │ │ Routes │ │ Routes │ │
169
+ │ └──────────┘ └──────────┘ └──────────┘ │
170
+ ├─────────────────────────────────────────────────────────┤
171
+ │ Engine Modules (25+) │
172
+ │ Skills · Permissions · Lifecycle · Knowledge Base │
173
+ │ DLP · Guardrails · Journal · Compliance · Activity │
174
+ │ Communication · Workforce · Vault · Storage · Onboarding│
175
+ │ Policies · Memory · Approvals · Tenants · Deployer │
176
+ │ Community Registry · Soul Library · Tool Catalog │
177
+ ├─────────────────────────────────────────────────────────┤
178
+ │ Agent Runtime │
179
+ │ LLM Client · Session Manager · Tool Executor │
180
+ │ Sub-Agent Manager · Email Channel · Follow-Up Scheduler │
181
+ ├─────────────────────────────────────────────────────────┤
182
+ │ MCP Integration Framework │
183
+ │ 147 SaaS Adapters · OAuth Connect │
184
+ ├─────────────────────────────────────────────────────────┤
185
+ │ Database Adapter Layer │
186
+ │ Postgres · MySQL · SQLite · MongoDB · DynamoDB · Turso │
187
+ │ Supabase · Neon · PlanetScale · CockroachDB │
188
+ └─────────────────────────────────────────────────────────┘
189
+ ```
190
+
191
+ ### Middleware Stack
192
+
193
+ - **Request ID** — UUID per request for tracing
194
+ - **Security Headers** — CSP, HSTS, XSS protection
195
+ - **CORS** — Configurable origins
196
+ - **Rate Limiting** — Per-IP, configurable RPM (default: 120)
197
+ - **IP Access Control** — CIDR-based firewall
198
+ - **Audit Logging** — Every mutating action logged
199
+ - **RBAC** — Role-based access control (owner, admin, member, viewer)
200
+ - **Error Handling** — Structured error responses
201
+ - **Circuit Breaker** — Database connectivity protection
202
+ - **Health Monitor** — Periodic health checks with unhealthy threshold
241
203
 
242
204
  ---
243
205
 
244
- ## The Engine
245
-
246
- The Engine is the brain of Enterprise — 11 subsystems that handle everything from "what can this agent do?" to "deploy it to production and watch it run."
247
-
248
- ### 1. Skills & Permissions
249
-
250
- **38 built-in skills** organized into categories:
251
-
252
- | Category | Skills |
253
- |----------|--------|
254
- | Communication | Email Management, SMS & Phone, Calendar, Messaging |
255
- | Research | Web Search, Web Browsing, News Monitoring, Academic Research |
256
- | Development | Code Execution, Git & GitHub, Database, API Integration |
257
- | Content | Writing, Image Generation, Audio/TTS, Video Processing |
258
- | Productivity | Task Management, Note Taking, File Management, Spreadsheets |
259
- | System | System Administration, Docker, Network, Security |
260
- | AI/ML | Model Inference, RAG/Knowledge Base, Agent Orchestration |
261
- | Business | CRM, Analytics, Billing, HR |
262
- | IoT/Smart Home | Home Automation, Camera/Surveillance, Media Playback |
263
- | Custom | Custom Tools (user-defined) |
264
-
265
- Each skill defines:
266
- - **Tools** — which tool IDs are included (mapped to registered AgenticMail tool IDs)
267
- - **Config fields** — what settings the skill needs (API keys, hostnames, etc.)
268
- - **Risk level** — low, medium, high, critical
269
- - **Side effects** — what the skill can affect (network, filesystem, email, etc.)
270
-
271
- **5 preset permission profiles:**
206
+ ## Database Backends
272
207
 
273
- | Profile | Description | Tools | Risk |
274
- |---------|-------------|-------|------|
275
- | Research Assistant | Web search, reading, note-taking | ~25 | Low |
276
- | Customer Support | Email, messaging, CRM, KB search | ~35 | Medium |
277
- | Developer | Code, Git, Docker, APIs, databases | ~45 | High |
278
- | Full Access | Everything enabled | All | Critical |
279
- | Sandbox | Minimal tools, no external access | ~10 | Low |
280
-
281
- **How permissions work:**
208
+ All 10 backends implement the same `DatabaseAdapter` interface with full feature parity:
282
209
 
283
210
  ```typescript
284
- const engine = new PermissionEngine();
285
-
286
- // Check if an agent can use a tool
287
- const result = engine.checkPermission(agentProfile, 'agenticmail_send');
288
- // → { allowed: true, reason: 'Granted by Email Management skill' }
289
-
290
- // Or with approval required
291
- const result2 = engine.checkPermission(agentProfile, 'exec');
292
- // → { allowed: false, requiresApproval: true, reason: 'Code Execution requires admin approval' }
293
- ```
294
-
295
- ### 2. Agent Configuration
296
-
297
- Generates all the files an agent needs to run:
298
-
299
- - **SOUL.md** — personality, tone, boundaries
300
- - **AGENTS.md** — workspace conventions
301
- - **USER.md** — who the agent serves
302
- - **TOOLS.md** — environment-specific tool notes
303
- - **Gateway config** — agent runtime gateway config with plugins, channels, tool policies
304
- - **Deploy scripts** — Dockerfile, docker-compose, startup scripts
211
+ import { createAdapter, type DatabaseType } from '@agenticmail/enterprise/db';
305
212
 
306
- ```typescript
307
- const generator = new AgentConfigGenerator();
308
- const config = generator.generate({
309
- name: 'support-bot',
310
- role: 'Customer Support Agent',
311
- skills: ['email-management', 'crm', 'knowledge-base'],
312
- channels: [{ type: 'email' }, { type: 'slack', webhook: '...' }],
313
- deployment: { target: 'docker' },
213
+ const db = await createAdapter({
214
+ type: 'postgres', // or mysql, sqlite, mongodb, dynamodb, turso, supabase, neon, planetscale, cockroachdb
215
+ connectionString: '...',
314
216
  });
315
- // → { workspace: { 'SOUL.md': '...', ... }, gateway: { ... }, deploy: { ... } }
316
- ```
317
-
318
- ### 3. Deployment Engine
319
-
320
- Provisions and manages agent infrastructure:
321
217
 
322
- - **Docker** Generates Dockerfile + compose, builds image, starts container
323
- - **VPS** SSH into a server, install dependencies, configure systemd service
324
- - **Fly.io** Creates Fly app, sets secrets, deploys
325
- - **Railway** Generates Railway config, links project
326
-
327
- Each deployment goes through phases:
328
- 1. **Validate** — check config, verify credentials
329
- 2. **Provision** — create infrastructure resources
330
- 3. **Configure** — write config files, set environment variables
331
- 4. **Deploy** — push code/image, start the agent
332
- 5. **Verify** — health check, confirm agent is responding
333
-
334
- ```typescript
335
- const deployer = new DeploymentEngine();
336
- const result = await deployer.deploy({
337
- agentId: 'agent-123',
338
- target: 'docker',
339
- config: { /* ... */ },
340
- });
341
- // → { status: 'deployed', url: 'http://...', phases: [...] }
218
+ await db.migrate(); // Run schema migrations
219
+ await db.getStats(); // Health check
220
+ await db.createUser({...}); // CRUD operations
221
+ await db.logEvent({...}); // Audit logging
342
222
  ```
343
223
 
344
- ### 4. Approval Workflows
224
+ ### Adapter Details
345
225
 
346
- Human-in-the-loop for sensitive operations. **All data persisted to database.**
226
+ | Backend | Module | Notes |
227
+ |---------|--------|-------|
228
+ | PostgreSQL | `postgres.ts` | Full SQL, migrations, engine DB |
229
+ | MySQL/MariaDB | `mysql.ts` | Full SQL, auto-converted DDL |
230
+ | SQLite | `sqlite.ts` | Embedded, `better-sqlite3` |
231
+ | MongoDB | `mongodb.ts` | Uses `_id` = `randomUUID()` |
232
+ | DynamoDB | `dynamodb.ts` | Single-table design, GSI1 |
233
+ | Turso | `turso.ts` | LibSQL edge database |
234
+ | Supabase | `postgres.ts` | Managed Postgres (same adapter) |
235
+ | Neon | `postgres.ts` | Serverless Postgres (same adapter) |
236
+ | PlanetScale | `mysql.ts` | Managed MySQL (same adapter) |
237
+ | CockroachDB | `postgres.ts` | Distributed (same adapter) |
347
238
 
348
- - Define **policies** — which actions need approval and from whom
349
- - Agents **request** approval when they hit a policy boundary
350
- - Admins **approve or reject** from the dashboard or via API
351
- - Supports **auto-approve** rules (e.g., "auto-approve emails to internal domains")
352
- - **Escalation** — unreviewed requests escalate after a configurable timeout
353
- - **Persistence** — pending requests and policies survive server restarts
239
+ ### Engine Database
354
240
 
355
- ```typescript
356
- const approvals = new ApprovalEngine();
357
- await approvals.setDb(engineDb); // Wire to database, loads pending requests
358
-
359
- // Create a policy
360
- approvals.addPolicy({
361
- id: crypto.randomUUID(),
362
- name: 'External Email Review',
363
- triggers: { sideEffects: ['email'] },
364
- approvers: { userIds: [], roles: ['admin'], requireMultiple: 1 },
365
- timeout: { minutes: 60, defaultAction: 'deny' },
366
- notify: { channels: ['webhook'] },
367
- enabled: true,
368
- }, 'org-id');
369
-
370
- // Agent requests approval
371
- const request = await approvals.requestApproval({
372
- agentId: 'agent-123',
373
- agentName: 'Support Bot',
374
- toolId: 'agenticmail_send',
375
- toolName: 'Send Email',
376
- riskLevel: 'medium',
377
- sideEffects: ['email'],
378
- orgId: 'org-id',
379
- });
380
- // → { id: 'req-456', status: 'pending' } — persisted to DB
241
+ SQL-backed deployments also get the `EngineDatabase` layer for engine module persistence:
381
242
 
382
- // Admin approves
383
- approvals.decide('req-456', { action: 'approve', by: 'admin-1' });
384
- // Updates both in-memory and DB
243
+ ```typescript
244
+ const engineDbInterface = db.getEngineDB();
245
+ const engineDb = new EngineDatabase(engineDbInterface, 'postgres');
246
+ await engineDb.migrate(); // Versioned migration system
385
247
  ```
386
248
 
387
- ### 5. Agent Lifecycle
388
-
389
- State machine for agent lifecycle management. **All state persisted to database.**
249
+ Features: DDL auto-conversion (`sqliteToPostgres()`, `sqliteToMySQL()`), dynamic table creation with `ext_` prefix, agent storage tables with `agt_`/`shared_` prefixes.
390
250
 
391
- ```
392
- draft → configuring → ready → provisioning → deploying → starting → running
393
-
394
- degraded
395
-
396
- stopped ← error ← destroying
397
- ```
251
+ ---
398
252
 
399
- - **12 states** — draft, configuring, ready, provisioning, deploying, starting, running, degraded, stopped, error, updating, destroying
400
- - **Health checks** — 30-second polling loop, response time tracking, error rate monitoring
401
- - **Auto-recovery** — restarts after 5 consecutive health failures
402
- - **Budget enforcement** — auto-stops when monthly token or cost budget exceeded
403
- - **State transitions** — every transition persisted to `agent_state_history` table
404
- - **Persistence** — all agent data written through to `managed_agents` table, loaded from DB on startup
253
+ ## Engine Modules
405
254
 
406
- ```typescript
407
- const lifecycle = new AgentLifecycleManager({ permissions: permissionEngine });
408
- await lifecycle.setDb(engineDb); // Wire to database, loads all agents
255
+ The engine is the core of Enterprise — 25+ modules that power agent governance:
409
256
 
410
- // Create an agent
411
- const agent = await lifecycle.createAgent('org-id', agentConfig, 'admin-1');
412
- // Persisted to managed_agents table
257
+ ### 1. Skill Registry & Permission Engine
258
+ - 47 built-in enterprise skill definitions (Google Workspace, Microsoft 365, custom)
259
+ - Fine-grained tool-level permissions (allow/deny per tool)
260
+ - 5 preset profiles: Research Assistant, Customer Support, Developer, Full Access, Sandbox
261
+ - Skill suites for bulk assignment
262
+ - Risk level classification (low, medium, high, critical)
263
+ - Side effect tracking (read, write, delete, external, financial)
413
264
 
414
- // Deploy
415
- await lifecycle.deploy(agent.id, 'admin-1');
416
- // Provisions infrastructure, starts container, begins health check loop
265
+ ### 2. Agent Config Generator
266
+ - Generates workspace files (SOUL.md, AGENTS.md, etc.)
267
+ - Gateway configuration
268
+ - Channel configs (email, Slack, Teams, etc.)
269
+ - Deployment scripts per target
417
270
 
418
- // Get agent status
419
- const status = lifecycle.getAgent(agent.id);
420
- // { state: 'running', health: { status: 'healthy', uptime: 86400 }, usage: { tokensToday: 150000, costToday: 1.25 } }
271
+ ### 3. Deployment Engine
272
+ - Docker, VPS, Fly.io, Railway provisioning
273
+ - Deployment event tracking
274
+ - Live agent status monitoring
421
275
 
422
- // Stop
423
- await lifecycle.stop(agent.id, 'admin-1', 'Maintenance window');
424
- ```
276
+ ### 4. Approval Workflows
277
+ - Human-in-the-loop approval policies
278
+ - Escalation chains with multi-level escalation
279
+ - Time-based auto-escalation
280
+ - Approval/rejection with audit trail
281
+
282
+ ### 5. Agent Lifecycle Manager
283
+ - State machine: `provisioning` → `active` → `paused` → `stopped` → `decommissioned`
284
+ - Health checks and auto-recovery
285
+ - Budget controls with alerts and hard limits
286
+ - Usage tracking (tokens, cost, API calls)
287
+ - Birthday automation (sends birthday emails to agents on their DOB)
425
288
 
426
289
  ### 6. Knowledge Base
427
-
428
- Document ingestion and retrieval for agent knowledge. **All data persisted to database.**
429
-
430
- - **Upload documents** PDF, Markdown, plain text, HTML, CSV
431
- - **Chunking** — automatic splitting with configurable chunk size and overlap
432
- - **Embeddings** — OpenAI text-embedding-3-small (optional, falls back to keyword matching)
433
- - **Semantic search** — cosine similarity on embeddings, keyword fallback
434
- - **RAG context** — generates context string for agent prompts with token budget
435
- - **Per-agent or shared** — knowledge bases can be private or shared across agents
436
- - **Persistence** — KBs, documents, and chunks persisted to 3 tables. Embeddings stored as binary blobs.
437
-
438
- ```typescript
439
- const kb = new KnowledgeBaseEngine();
440
- await kb.setDb(engineDb); // Wire to database, loads all KBs + embeddings
441
-
442
- // Create a knowledge base
443
- const base = kb.createKnowledgeBase('org-id', {
444
- name: 'Company Policies',
445
- agentIds: ['agent-1', 'agent-2'],
446
- config: { embeddingProvider: 'openai', chunkSize: 512 },
447
- });
448
- // → Persisted to knowledge_bases table
449
-
450
- // Ingest a document
451
- const doc = await kb.ingestDocument(base.id, {
452
- name: 'PTO Policy',
453
- content: '...',
454
- sourceType: 'text',
455
- mimeType: 'text/markdown',
456
- });
457
- // → Chunked, embedded, persisted to kb_documents + kb_chunks tables
458
-
459
- // Search
460
- const results = await kb.search('agent-1', 'how many vacation days');
461
- // → [{ chunk: { content: '...' }, document: { name: 'PTO Policy' }, score: 0.92 }]
462
-
463
- // Get RAG context for an agent prompt
464
- const context = await kb.getContext('agent-1', 'vacation policy', 2000);
465
- // → "## Relevant Knowledge Base Context\n\n### From: PTO Policy\n..."
466
- ```
290
+ - Document ingestion and chunking
291
+ - BM25F text search (extracted to shared library)
292
+ - RAG retrieval for agent context
293
+ - Multi-knowledge-base support per org
467
294
 
468
295
  ### 7. Multi-Tenant Isolation
296
+ - Organization management with plan enforcement
297
+ - 4 plan tiers: Free (3 agents), Team (25), Enterprise (unlimited), Self-Hosted (unlimited)
298
+ - Feature gates per plan
299
+ - SSO configuration (Google, Microsoft, GitHub, Okta, SAML, LDAP)
300
+ - Usage quotas and billing
301
+
302
+ ### 8. Real-Time Activity Tracking
303
+ - Live tool call recording
304
+ - Conversation logging
305
+ - Agent timelines
306
+ - Cost tracking per agent/org
469
307
 
470
- Organizations, plans, and resource limits. **All data persisted to database.**
471
-
472
- For SaaS deployments, companies sharing infrastructure get strict data separation. For self-hosted / open-source, single-tenant mode uses a default org with no limits.
473
-
474
- **Plan Tiers:**
475
-
476
- | Feature | Free | Team | Enterprise | Self-Hosted |
477
- |---------|------|------|-----------|-------------|
478
- | Agents | 3 | 25 | Unlimited | Unlimited |
479
- | Users | 5 | 50 | Unlimited | Unlimited |
480
- | Knowledge Bases | 1 | 10 | 999 | 999 |
481
- | Storage | 100 MB | 5 GB | 100 GB | Unlimited |
482
- | Token Budget (monthly) | 1M | 10M | Unlimited | Unlimited |
483
- | API Calls/min | 30 | 120 | 600 | 999 |
484
- | SSO | - | Yes | Yes | Yes |
485
- | Audit Retention | 30 days | 90 days | 365 days | 365 days |
486
- | Custom Domain | - | - | Yes | Yes |
487
- | White-Label | - | - | Yes | Yes |
488
- | Deploy Targets | Docker, Local | Docker, VPS, Fly, Railway, Local | All | All |
489
- | Custom Skills | - | Yes | Yes | Yes |
490
- | Data Residency | - | - | Yes | Yes |
491
-
492
- ```typescript
493
- const tenants = new TenantManager();
494
- await tenants.setDb(engineDb); // Wire to database, loads all orgs
495
-
496
- // Create an organization
497
- const org = tenants.createOrg({
498
- name: 'AgenticMail Inc',
499
- slug: 'agenticmail',
500
- plan: 'team',
501
- adminEmail: 'admin@agenticmail.io',
502
- });
503
- // Persisted to organizations table
504
-
505
- // Check limits before creating an agent
506
- const check = tenants.checkLimit(org.id, 'maxAgents');
507
- // { allowed: true, limit: 25, current: 5, remaining: 20 }
508
-
509
- // Check feature gates
510
- tenants.hasFeature(org.id, 'sso'); // → true (team plan)
511
- tenants.hasFeature(org.id, 'white-label'); // false (enterprise only)
512
- tenants.canDeployTo(org.id, 'aws'); // → false (team plan)
513
-
514
- // Record usage
515
- tenants.recordUsage(org.id, { tokensThisMonth: 50000, costThisMonth: 0.42 });
516
- // Persisted to database
517
-
518
- // Upgrade plan
519
- tenants.changePlan(org.id, 'enterprise');
520
- // → Limits updated, persisted
521
-
522
- // Single-tenant mode (self-hosted)
523
- tenants.createDefaultOrg(); // Creates 'default' org with self-hosted plan
524
- tenants.isSingleTenant(); // → true
525
- ```
308
+ ### 9. Tool Catalog
309
+ - 86+ cataloged tool IDs across all AgenticMail packages
310
+ - Tool-to-skill mapping
311
+ - Dynamic tool policy generation
312
+
313
+ ### 10. Data Loss Prevention (DLP)
314
+ - Content scanning rules (PII, credentials, sensitive data)
315
+ - Violation tracking and alerting
316
+ - Configurable rule sets per org
317
+
318
+ ### 11. Agent-to-Agent Communication
319
+ - Message bus (direct, broadcast, topic-based)
320
+ - Task assignment and delegation
321
+ - Priority levels (normal, high, urgent)
322
+ - Agent email registry integration
323
+
324
+ ### 12. Guardrails & Anomaly Detection
325
+ - Real-time intervention system
326
+ - Configurable anomaly rules (rate limits, cost thresholds, pattern matching)
327
+ - Auto-stop agents on violation
328
+ - Onboarding gate checks
329
+ - Workforce off-duty enforcement
330
+
331
+ ### 13. Action Journal & Rollback
332
+ - Every agent action journaled with before/after state
333
+ - Rollback capability for reversible actions
334
+ - Audit trail with timestamps and actor
335
+
336
+ ### 14. Compliance Reporting
337
+ - SOC2, GDPR, HIPAA report generation
338
+ - Data retention policies
339
+ - Access audit reports
340
+
341
+ ### 15. Community Skill Registry (Marketplace)
342
+ - Install community skills from the marketplace
343
+ - Automatic periodic sync from GitHub (every 6 hours)
344
+ - Skill reviews and ratings
345
+ - Local directory loading for development
346
+ - Validation CLI for skill authors
347
+
348
+ ### 16. Workforce Management
349
+ - Shift schedules and on-call rotations
350
+ - Capacity planning
351
+ - Off-duty enforcement via guardrails
352
+ - Work-life balance rules
353
+
354
+ ### 17. Organization Policies
355
+ - Global and per-org policy configuration
356
+ - Policy import/export
357
+ - Compliance policy templates
358
+
359
+ ### 18. Agent Memory
360
+ - Long-term memory persistence
361
+ - Memory queries and search
362
+ - Cross-session continuity
363
+
364
+ ### 19. Onboarding Manager
365
+ - Agent onboarding workflows
366
+ - Onboarding gates (must complete before agent goes live)
367
+ - Policy acknowledgment tracking
368
+
369
+ ### 20. Secure Vault
370
+ - Encrypted credential storage
371
+ - API key management
372
+ - OAuth token management
373
+ - DLP-integrated access control
374
+
375
+ ### 21. Storage Manager
376
+ - Dynamic table management for agents
377
+ - Agent-scoped tables (`agt_` prefix)
378
+ - Shared tables (`shared_` prefix)
379
+ - 28 storage actions (create, query, aggregate, import/export, raw SQL, etc.)
380
+
381
+ ### 22. Soul Library
382
+ - 51 personality templates across 14 categories
383
+ - Search and browse templates
384
+ - Custom soul creation
385
+
386
+ ### 23. Knowledge Contribution Manager
387
+ - Agents contribute learned knowledge back to org knowledge bases
388
+ - Scheduled aggregation
389
+
390
+ ### 24. Skill Auto-Updater
391
+ - Monitors community skill registry for updates
392
+ - Auto-applies compatible updates
393
+ - Scheduled update checks
394
+
395
+ ### 25. OAuth Connect
396
+ - OAuth flow management for SaaS integrations
397
+ - Token storage in vault
398
+ - Refresh token rotation
526
399
 
527
- ### 8. Activity Tracking
400
+ ---
528
401
 
529
- Real-time monitoring of everything agents do. **All data persisted to database (fire-and-forget).**
402
+ ## Agent Runtime
530
403
 
531
- - **Events** lifecycle state changes, errors, custom events per agent/org
532
- - **Tool calls** — tool ID, arguments, result, duration, success/failure. Start/end tracked separately.
533
- - **Conversations** — session-based message recording with role, token count, cost
534
- - **Timeline** — chronological per-agent daily view of all activity
535
- - **SSE streaming** — real-time event stream with heartbeats, filterable by org/agent
536
- - **Aggregations** — event/tool call/conversation counts, cost summaries
537
- - **In-memory buffer** — recent events kept in memory for fast dashboard queries; all writes fire-and-forget to DB
404
+ Full standalone agent execution runtime run agents entirely in-process without OpenClaw:
538
405
 
539
406
  ```typescript
540
- const activity = new ActivityTracker();
541
- activity.setDb(engineDb); // Wire to database (no loadFromDb — high-volume, uses buffer)
542
-
543
- // Record an event (fire-and-forget to DB)
544
- activity.record({
545
- agentId: 'agent-123',
546
- orgId: 'org-456',
547
- type: 'tool_call',
548
- data: { tool: 'agenticmail_send', to: 'user@example.com' },
549
- });
407
+ import { createAgentRuntime } from '@agenticmail/enterprise';
550
408
 
551
- // Track a tool call with start/end
552
- const callId = activity.startToolCall({
553
- agentId: 'agent-123', orgId: 'org-456',
554
- toolId: 'agenticmail_send', toolName: 'Send Email',
555
- args: { to: 'user@example.com', subject: 'Hello' },
409
+ const runtime = createAgentRuntime({
410
+ engineDb: db,
411
+ apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY },
556
412
  });
557
- // ... tool executes ...
558
- activity.endToolCall(callId, { success: true, result: 'Sent', durationMs: 450 });
559
-
560
- // Record a conversation message
561
- activity.recordMessage({
562
- agentId: 'agent-123', orgId: 'org-456', sessionId: 'sess-789',
563
- role: 'assistant', content: 'I sent the email.',
564
- tokenCount: 150, costUsd: 0.001,
565
- });
566
-
567
- // Get agent timeline for a specific day
568
- const timeline = activity.getTimeline('agent-123', '2026-02-18');
569
413
 
570
- // Get aggregate stats
571
- const stats = activity.getStats('org-456');
572
- // → { events: 1542, toolCalls: 380, conversations: 45 }
414
+ await runtime.start();
573
415
 
574
- // Subscribe to real-time events (used by SSE endpoint)
575
- const unsubscribe = activity.subscribe((event) => {
576
- console.log('New event:', event.type, event.agentId);
416
+ const session = await runtime.spawnSession({
417
+ agentId: 'agent-1',
418
+ message: 'Research Q3 revenue trends and draft a summary email',
577
419
  });
578
420
  ```
579
421
 
580
- ### 9. Tool Catalog
422
+ ### Runtime Features
581
423
 
582
- Maps AgenticMail tool IDs to skills:
424
+ - **LLM Client** Multi-provider (Anthropic, OpenAI, custom), streaming, retry with exponential backoff
425
+ - **Session Manager** — Incremental message persistence, crash recovery, session resume on startup
426
+ - **Tool Executor** — 28 built-in tools with security sandboxing
427
+ - **Sub-Agent Manager** — Spawn child agents for parallel work
428
+ - **Email Channel** — Bi-directional email communication
429
+ - **Follow-Up Scheduler** — Schedule agent follow-ups and reminders
430
+ - **Budget Gates** — Cost check before every LLM call
431
+ - **Gateway Integration** — Register as OpenClaw plugin for hybrid deployments
432
+ - **Heartbeat** — Stale session detection and cleanup
433
+ - **SSE Streaming** — Real-time event streaming for dashboard
583
434
 
584
- - **129 total tools** cataloged (24 core platform + 63 AgenticMail MCP + 42 shell commands)
585
- - Each tool mapped to one or more skills
586
- - Used by the Permission Engine to resolve skill → tool access
435
+ ### Supported LLM Providers
587
436
 
588
437
  ```typescript
589
- import { ALL_TOOLS, getToolsBySkill, generateToolPolicy } from '@agenticmail/enterprise';
590
-
591
- // Get all tools for a skill
592
- const emailTools = getToolsBySkill('email-management');
593
- // → ['agenticmail_send', 'agenticmail_inbox', 'agenticmail_reply', ...]
438
+ import { listAllProviders } from '@agenticmail/enterprise';
594
439
 
595
- // Generate tool policy
596
- const policy = generateToolPolicy(['email-management', 'web-search']);
597
- // → { allow: ['agenticmail_send', ...], deny: [...] }
440
+ // Built-in: anthropic, openai
441
+ // Custom providers can be registered via PROVIDER_REGISTRY
598
442
  ```
599
443
 
600
- ### 10. Runtime Hooks
601
-
602
- Lifecycle hooks for intercepting agent tool calls at runtime. See `src/runtime/hooks.ts`.
603
-
604
- - **Permission enforcement** — checks every tool call against the agent's permission profile
605
- - **Activity logging** — records tool calls to the activity tracker
606
- - **Approval gating** — blocks tool calls that require approval
607
- - **Permission caching** — avoids repeated DB lookups on high-frequency calls
444
+ ---
608
445
 
609
- ```typescript
610
- import { createEnterpriseHook } from '@agenticmail/enterprise';
446
+ ## MCP Integration Adapters
611
447
 
612
- const hook = createEnterpriseHook({
613
- apiUrl: 'http://localhost:3000',
614
- apiKey: 'ek_...',
615
- agentId: 'agent-123',
616
- });
448
+ 147 pre-built adapters for connecting agents to SaaS tools via [Model Context Protocol](https://modelcontextprotocol.io):
617
449
 
618
- // hook.beforeToolCall(toolName, args) → { allowed, requiresApproval, reason }
619
- // hook.afterToolCall(toolName, result, duration) → void (logs activity)
620
- ```
450
+ <details>
451
+ <summary><b>Full adapter list (147)</b></summary>
621
452
 
622
- ### 11. AgenticMail Bridge
453
+ ActiveCampaign, Adobe Sign, ADP, Airtable, Apollo, Asana, Auth0, AWS, Azure DevOps, BambooHR, Basecamp, BigCommerce, Bitbucket, Box, Brex, Buffer, Calendly, Canva, Chargebee, CircleCI, ClickUp, Close, Cloudflare, Confluence, Contentful, Copper, Crisp, CrowdStrike, Datadog, DigitalOcean, Discord, Docker, DocuSign, Drift, Dropbox, Figma, Firebase, Fly.io, FreshBooks, Freshdesk, Freshsales, Freshservice, Front, GitHub, GitHub Actions, GitLab, Gong, Google Ads, Google Analytics, Google Cloud, Google Drive, GoToMeeting, Grafana, Greenhouse, Gusto, HashiCorp Vault, Heroku, HiBob, Hootsuite, HubSpot, Hugging Face, Intercom, Jira, Klaviyo, Kubernetes, Lattice, LaunchDarkly, Lever, Linear, LinkedIn, LiveChat, Loom, Mailchimp, Mailgun, Microsoft Teams, Miro, Mixpanel, Monday, MongoDB Atlas, Neon, Netlify, NetSuite, New Relic, Notion, Okta, OpenAI, OpsGenie, Outreach, Paddle, PagerDuty, PandaDoc, PayPal, Personio, Pinecone, Pipedrive, Plaid, Postmark, Power Automate, QuickBooks, Recurly, Reddit, Render, RingCentral, Rippling, Salesforce, SalesLoft, Sanity, SAP, Segment, SendGrid, Sentry, ServiceNow, Shopify, Shortcut, Slack, Smartsheet, Snowflake, Snyk, Splunk, Square, Statuspage, Stripe, Supabase, Teamwork, Telegram, Terraform, Todoist, Trello, Twilio, Twitter/X, Vercel, Weaviate, Webex, Webflow, WhatsApp, Whereby, WooCommerce, WordPress, Workday, Wrike, Xero, YouTube, Zendesk, Zoho CRM, Zoom, Zuora
623
454
 
624
- Connects the Engine to an existing AgenticMail instance:
455
+ </details>
625
456
 
626
- - **Account sync** — creates/manages agent email accounts
627
- - **Tool interception** — wraps AgenticMail tool calls with permission checks
628
- - **Event forwarding** — pipes AgenticMail events (new email, task completion) to the activity tracker
457
+ ### MCP Framework
629
458
 
630
459
  ```typescript
631
- import { createAgenticMailBridge } from '@agenticmail/enterprise';
632
-
633
- const bridge = createAgenticMailBridge({
634
- agenticmailUrl: 'http://localhost:3100',
635
- masterKey: 'mk_...',
636
- });
460
+ import { SkillMCPFramework } from '@agenticmail/enterprise/mcp';
637
461
 
638
- // Sync an agent's email account
639
- await bridge.ensureAgent({ name: 'support-bot', role: 'customer-support' });
462
+ // Each adapter provides:
463
+ // - Tool definitions (name, description, parameters, schema)
464
+ // - API executor with credential resolution
465
+ // - OAuth flow configuration
466
+ // - Rate limit handling
640
467
  ```
641
468
 
469
+ The framework includes:
470
+ - **API Executor** — HTTP client with retry, rate limiting, pagination
471
+ - **Credential Resolver** — Pulls secrets from Vault, env, or OAuth tokens
472
+ - **AWS SigV4** — Native AWS request signing for DynamoDB, S3, etc.
473
+
642
474
  ---
643
475
 
644
- ## REST API
476
+ ## Agent Tools
477
+
478
+ 28 built-in tools available to agents running in the Enterprise runtime:
479
+
480
+ | Tool | Description |
481
+ |------|-------------|
482
+ | `bash` | Shell command execution (sandboxed) |
483
+ | `browser` | Web browser automation |
484
+ | `edit` | File editing with diff |
485
+ | `glob` | File pattern matching |
486
+ | `grep` | Text search across files |
487
+ | `memory` | Agent memory read/write |
488
+ | `read` | File reading |
489
+ | `write` | File writing |
490
+ | `web-fetch` | HTTP requests |
491
+ | `web-search` | Web search (Brave API) |
492
+ | `enterprise-calendar` | Calendar management |
493
+ | `enterprise-code-sandbox` | Isolated code execution |
494
+ | `enterprise-database` | Database queries |
495
+ | `enterprise-diff` | File/text diff generation |
496
+ | `enterprise-documents` | Document processing |
497
+ | `enterprise-finance` | Financial calculations |
498
+ | `enterprise-http` | Advanced HTTP client |
499
+ | `enterprise-knowledge-search` | RAG search across knowledge bases |
500
+ | `enterprise-logs` | Log analysis |
501
+ | `enterprise-notifications` | Send notifications |
502
+ | `enterprise-security-scan` | Security vulnerability scanning |
503
+ | `enterprise-spreadsheet` | Spreadsheet operations |
504
+ | `enterprise-translation` | Multi-language translation |
505
+ | `enterprise-vision` | Image analysis |
506
+ | `enterprise-web-research` | Deep web research |
507
+ | `enterprise-workflow` | Workflow orchestration |
508
+
509
+ Tools include a security middleware layer for permission checking and DLP scanning.
645
510
 
646
- ### Authentication
511
+ ---
647
512
 
648
- Two methods:
513
+ ## Enterprise Skills
649
514
 
650
- **JWT Token** (for dashboard users):
651
- ```
652
- POST /auth/login
653
- { "email": "admin@agenticmail.io", "password": "..." }
654
- → { "token": "eyJ...", "user": { ... } }
515
+ 47 pre-built skill definitions organized into 3 suites:
655
516
 
656
- # Then:
657
- Authorization: Bearer eyJ...
658
- ```
517
+ ### Google Workspace (14 skills)
518
+ Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Meet, Chat, Keep, Sites, Groups, Admin, Vault
659
519
 
660
- **API Key** (for programmatic access):
661
- ```
662
- X-API-Key: ek_abc123...
663
- ```
520
+ ### Microsoft 365 (17 skills)
521
+ Outlook, Teams, OneDrive, Word, Excel, PowerPoint, SharePoint, Planner, Todo, OneNote, Forms, Bookings, Power BI, Power Automate, Whiteboard, Copilot, Admin
522
+
523
+ ### Enterprise Custom (16 skills)
524
+ Calendar, Code Sandbox, Database, Diff, Documents, Finance, HTTP, Knowledge Search, Logs, Notifications, Security Scan, Spreadsheet, Translation, Vision, Web Research, Workflow
664
525
 
665
- API keys have scoped permissions and are created through the admin API.
666
-
667
- ### Auth Endpoints
668
-
669
- | Method | Path | Description |
670
- |--------|------|-------------|
671
- | POST | `/auth/login` | Email/password login (sets httpOnly cookies + returns JWT) |
672
- | POST | `/auth/refresh` | Refresh session using refresh token/cookie |
673
- | GET | `/auth/me` | Get current authenticated user |
674
- | POST | `/auth/logout` | Clear session cookies |
675
- | POST | `/auth/saml/callback` | SAML 2.0 assertion callback (stub — 501) |
676
- | GET | `/auth/saml/metadata` | SAML SP metadata (stub — 501) |
677
- | GET | `/auth/oidc/authorize` | OIDC authorization redirect (stub — 501) |
678
- | GET | `/auth/oidc/callback` | OIDC callback (stub — 501) |
679
-
680
- ### Admin Endpoints
681
-
682
- | Method | Path | Description |
683
- |--------|------|-------------|
684
- | GET | `/api/stats` | Dashboard statistics (agents, users, keys count) |
685
- | GET | `/api/agents` | List agents (supports `status`, `limit`, `offset`) |
686
- | POST | `/api/agents` | Create agent (validates name, email, role) |
687
- | GET | `/api/agents/:id` | Get agent details |
688
- | PATCH | `/api/agents/:id` | Update agent (name, email, role, status) |
689
- | POST | `/api/agents/:id/archive` | Archive agent |
690
- | POST | `/api/agents/:id/restore` | Restore archived agent |
691
- | DELETE | `/api/agents/:id` | Permanently delete agent (admin only) |
692
- | GET | `/api/users` | List users (admin only) |
693
- | POST | `/api/users` | Create user (admin only, validates email/role) |
694
- | PATCH | `/api/users/:id` | Update user (admin only) |
695
- | DELETE | `/api/users/:id` | Delete user (owner only, cannot delete self) |
696
- | GET | `/api/audit` | Query audit log (supports actor, action, resource, date range, pagination) |
697
- | GET | `/api/api-keys` | List API keys (admin only, hashes redacted) |
698
- | POST | `/api/api-keys` | Create API key (admin only, returns plaintext once) |
699
- | DELETE | `/api/api-keys/:id` | Revoke API key (admin only) |
700
- | GET | `/api/rules` | List email rules (optional `agentId` filter) |
701
- | POST | `/api/rules` | Create email rule |
702
- | PATCH | `/api/rules/:id` | Update email rule |
703
- | DELETE | `/api/rules/:id` | Delete email rule |
704
- | GET | `/api/settings` | Get company settings (sensitive fields redacted) |
705
- | PATCH | `/api/settings` | Update company settings (admin only) |
706
- | GET | `/api/retention` | Get data retention policy (admin only) |
707
- | PUT | `/api/retention` | Set data retention policy (owner only) |
708
-
709
- ### Engine Endpoints
710
-
711
- **Skills & Permissions:**
712
-
713
- | Method | Path | Description |
714
- |--------|------|-------------|
715
- | GET | `/api/engine/skills` | List all 38 skills with categories |
716
- | GET | `/api/engine/skills/by-category` | Skills grouped by category |
717
- | GET | `/api/engine/skills/:id` | Get skill details + tools |
718
- | GET | `/api/engine/profiles/presets` | List 5 permission presets |
719
- | GET | `/api/engine/profiles/:agentId` | Get agent's permission profile |
720
- | PUT | `/api/engine/profiles/:agentId` | Update agent's permission profile |
721
- | POST | `/api/engine/profiles/:agentId/apply-preset` | Apply a preset to agent |
722
- | POST | `/api/engine/permissions/check` | Check if agent can use a tool |
723
- | GET | `/api/engine/permissions/:agentId/tools` | List tools available to agent |
724
- | GET | `/api/engine/permissions/:agentId/policy` | Generate tool policy |
725
-
726
- **Agent Lifecycle:**
727
-
728
- | Method | Path | Description |
729
- |--------|------|-------------|
730
- | POST | `/api/engine/agents` | Create engine agent (orgId, config, createdBy) |
731
- | GET | `/api/engine/agents` | List engine agents (requires `orgId` query) |
732
- | GET | `/api/engine/agents/:id` | Get engine agent with state, health, usage |
733
- | PATCH | `/api/engine/agents/:id/config` | Update agent config |
734
- | POST | `/api/engine/agents/:id/deploy` | Deploy agent to target infrastructure |
735
- | POST | `/api/engine/agents/:id/stop` | Stop a running agent |
736
- | POST | `/api/engine/agents/:id/restart` | Restart agent |
737
- | POST | `/api/engine/agents/:id/hot-update` | Hot-update config without restart |
738
- | DELETE | `/api/engine/agents/:id` | Destroy agent and clean up resources |
739
- | GET | `/api/engine/agents/:id/usage` | Agent resource usage, health, state |
740
- | GET | `/api/engine/usage/:orgId` | Aggregate org usage across all agents |
741
-
742
- **Config Generation:**
743
-
744
- | Method | Path | Description |
745
- |--------|------|-------------|
746
- | POST | `/api/engine/config/workspace` | Generate workspace files (SOUL.md, TOOLS.md, etc.) |
747
- | POST | `/api/engine/config/gateway` | Generate gateway config |
748
- | POST | `/api/engine/config/docker-compose` | Generate docker-compose.yml |
749
- | POST | `/api/engine/config/systemd` | Generate systemd service unit |
750
- | POST | `/api/engine/config/deploy-script` | Generate VPS deploy script |
751
-
752
- **Knowledge Base:**
753
-
754
- | Method | Path | Description |
755
- |--------|------|-------------|
756
- | POST | `/api/engine/knowledge-bases` | Create knowledge base |
757
- | GET | `/api/engine/knowledge-bases` | List KBs (filter by `orgId` or `agentId`) |
758
- | GET | `/api/engine/knowledge-bases/:id` | Get KB details with documents |
759
- | POST | `/api/engine/knowledge-bases/:id/documents` | Ingest document (chunked + embedded) |
760
- | DELETE | `/api/engine/knowledge-bases/:kbId/documents/:docId` | Delete document |
761
- | POST | `/api/engine/knowledge-bases/search` | Semantic search across KBs |
762
- | POST | `/api/engine/knowledge-bases/context` | Get RAG context for agent prompt |
763
- | DELETE | `/api/engine/knowledge-bases/:id` | Delete knowledge base |
764
-
765
- **Organizations (Tenants):**
766
-
767
- | Method | Path | Description |
768
- |--------|------|-------------|
769
- | POST | `/api/engine/orgs` | Create organization |
770
- | GET | `/api/engine/orgs` | List all organizations |
771
- | GET | `/api/engine/orgs/:id` | Get organization details |
772
- | GET | `/api/engine/orgs/slug/:slug` | Get organization by slug |
773
- | POST | `/api/engine/orgs/:id/check-limit` | Check plan resource limits |
774
- | POST | `/api/engine/orgs/:id/check-feature` | Check feature gate |
775
- | POST | `/api/engine/orgs/:id/change-plan` | Change organization plan |
776
-
777
- **Approvals:**
778
-
779
- | Method | Path | Description |
780
- |--------|------|-------------|
781
- | GET | `/api/engine/approvals/pending` | List pending approvals (optional `agentId` filter) |
782
- | GET | `/api/engine/approvals/history` | Approval history (supports `agentId`, `limit`, `offset`) |
783
- | GET | `/api/engine/approvals/:id` | Get approval request details |
784
- | POST | `/api/engine/approvals/:id/decide` | Approve or reject a request |
785
- | GET | `/api/engine/approvals/policies` | List approval policies |
786
- | POST | `/api/engine/approvals/policies` | Create approval policy |
787
- | DELETE | `/api/engine/approvals/policies/:id` | Delete approval policy |
788
-
789
- **Activity & Monitoring:**
790
-
791
- | Method | Path | Description |
792
- |--------|------|-------------|
793
- | GET | `/api/engine/activity/events` | Activity events (filter by `agentId`, `orgId`, `since`, `limit`) |
794
- | GET | `/api/engine/activity/tool-calls` | Tool call records (filter by `agentId`, `orgId`, `toolId`) |
795
- | GET | `/api/engine/activity/conversation/:sessionId` | Conversation entries for a session |
796
- | GET | `/api/engine/activity/timeline/:agentId/:date` | Daily timeline for an agent |
797
- | GET | `/api/engine/activity/stats` | Aggregate activity stats (optional `orgId`) |
798
- | GET | `/api/engine/activity/stream` | SSE real-time event stream (filter by `orgId`, `agentId`) |
799
-
800
- **Dashboard Stats & Schema:**
801
-
802
- | Method | Path | Description |
803
- |--------|------|-------------|
804
- | GET | `/api/engine/stats/:orgId` | Org dashboard stats (agents, usage, real-time) |
805
- | POST | `/api/engine/schema/tables` | Create dynamic `ext_*` table |
806
- | GET | `/api/engine/schema/tables` | List dynamic tables |
807
- | POST | `/api/engine/schema/query` | Query dynamic tables (SELECT any, mutations ext_* only) |
526
+ Each skill definition includes:
527
+ - Tool list with parameter schemas
528
+ - Required configuration fields
529
+ - Risk level and side effect classification
530
+ - Category and description
808
531
 
809
532
  ---
810
533
 
811
534
  ## Dashboard
812
535
 
813
- The admin dashboard is a single HTML file using React 18 from CDN no build step required. It includes:
814
-
815
- - **Login page** with JWT authentication
816
- - **Overview** with agent counts, activity stats, system health
817
- - **Agent management** — create, configure, deploy, monitor
818
- - **Audit log** — searchable, filterable event history
819
- - **API key management** — create scoped keys, revoke
820
- - **Settings** — company info, custom domain, plan management
821
- - **Dark and light mode** themes
536
+ React-based admin dashboard served from the enterprise server:
822
537
 
823
- The dashboard is served automatically at `/dashboard` when the server starts. It communicates with the API using the same JWT/API key auth as any other client.
538
+ - **Dark/Light themes** Professional design with CSS custom properties
539
+ - **Dynamic brand color** — Uses `settings.primaryColor` throughout
540
+ - **Agent management** — Create, configure, start/stop, monitor
541
+ - **Real-time activity** — Live tool calls, conversations, cost
542
+ - **Knowledge bases** — Upload, manage, search documents
543
+ - **Approval workflows** — Review and approve/reject pending requests
544
+ - **Compliance** — View reports, DLP violations, audit logs
545
+ - **Settings** — Company info, SSO, security, billing
546
+ - **Onboarding** — Agent creation wizard with soul template selection
824
547
 
825
- ### Building Your Own Frontend
826
-
827
- The dashboard is a reference implementation. You can build your own UI by hitting the REST API directly. Every API response follows a consistent format:
828
-
829
- ```json
830
- {
831
- "data": { ... },
832
- "meta": { "total": 42, "page": 1, "limit": 20 }
833
- }
834
- ```
548
+ ---
835
549
 
836
- Errors:
837
- ```json
838
- {
839
- "error": "Description of what went wrong",
840
- "code": "VALIDATION_ERROR",
841
- "details": { ... }
842
- }
843
- ```
550
+ ## API Reference
551
+
552
+ The API is organized into 3 major sections:
553
+
554
+ ### Auth Routes (`/api/auth/*`)
555
+ - `POST /api/auth/login` — Login with email/password
556
+ - `POST /api/auth/refresh` — Refresh JWT tokens
557
+ - `POST /api/auth/logout` — Logout (invalidate cookies)
558
+ - SSO callback routes for Google, Microsoft, GitHub, Okta
559
+
560
+ ### Admin Routes (`/api/admin/*`)
561
+ - Agent CRUD, user management, settings, audit log
562
+ - Bridge API for unified agent management (`/api/admin/bridge/agents`)
563
+
564
+ ### Engine Routes (`/api/engine/*`)
565
+ 328 routes across 22 sub-apps:
566
+
567
+ | Sub-App | Prefix | Description |
568
+ |---------|--------|-------------|
569
+ | DLP | `/dlp/*` | Data loss prevention rules & scans |
570
+ | Guardrails | `/guardrails/*`, `/anomaly-rules/*` | Intervention rules & anomaly detection |
571
+ | Journal | `/journal/*` | Action journal & rollback |
572
+ | Communication | `/messages/*`, `/tasks/*` | Agent messaging & task delegation |
573
+ | Compliance | `/compliance/*` | Reports & data retention |
574
+ | Catalog | `/skills/*`, `/souls/*`, `/profiles/*`, `/permissions/*`, `/config/*` | Skill registry, soul library, permission profiles |
575
+ | Agents | `/agents/*`, `/usage/*`, `/budget/*`, `/bridge/*` | Agent lifecycle, usage, budgets |
576
+ | Knowledge | `/knowledge-bases/*` | Document ingestion & RAG |
577
+ | Org/Approvals | `/orgs/*`, `/approvals/*`, `/escalation-chains/*` | Multi-tenant & approval workflows |
578
+ | Activity | `/activity/*`, `/stats/*` | Real-time tracking & analytics |
579
+ | Deploy/Schema | `/deploy-credentials/*`, `/schema/*` | Deployment & DB schema |
580
+ | Community | `/community/*` | Skill marketplace |
581
+ | Workforce | `/workforce/*` | Shifts, schedules, capacity |
582
+ | Policies | `/policies/*` | Org policies & import |
583
+ | Memory | `/memory/*` | Agent memory management |
584
+ | Onboarding | `/onboarding/*` | Agent onboarding flows |
585
+ | Vault | `/vault/*` | Encrypted credential storage |
586
+ | Storage | `/storage/*` | Dynamic agent databases |
587
+ | OAuth | `/oauth/*` | SaaS OAuth connect flows |
588
+ | Knowledge Contrib | `/knowledge-contribution/*` | Agent-contributed knowledge |
589
+ | Skill Updates | `/skill-updates/*` | Auto-update management |
844
590
 
845
591
  ---
846
592
 
847
593
  ## Deployment
848
594
 
849
- ### AgenticMail Cloud
850
-
851
- Managed hosting on Fly.io infrastructure. Instant URL at `company.agenticmail.io`.
595
+ ### Docker
852
596
 
853
597
  ```bash
854
- npx @agenticmail/enterprise
855
- # Select "AgenticMail Cloud"
856
- # → Dashboard live at https://agenticmail-inc.agenticmail.io
598
+ npx @agenticmail/enterprise # Select "Docker" in Step 3
599
+ docker compose up -d
857
600
  ```
858
601
 
859
- Optional custom domain via CNAME:
860
- ```
861
- agents.agenticmail.io → agenticmail-inc.agenticmail.io
862
- ```
602
+ Generates `docker-compose.yml` + `.env` with all secrets.
863
603
 
864
604
  ### Fly.io
865
605
 
866
- Deploy to your own Fly.io account:
867
-
868
606
  ```bash
869
- npx @agenticmail/enterprise
870
- # → Select "Fly.io"
871
- # → Generates fly.toml
872
-
607
+ npx @agenticmail/enterprise # Select "Fly.io" in Step 3
873
608
  fly launch --copy-config
874
609
  fly secrets set DATABASE_URL="..." JWT_SECRET="..."
875
610
  fly deploy
876
611
  ```
877
612
 
878
- ### Docker
879
-
880
- Self-hosted with Docker Compose:
613
+ ### Railway
881
614
 
882
615
  ```bash
883
- npx @agenticmail/enterprise
884
- # Select "Docker"
885
- # → Generates docker-compose.yml
616
+ npx @agenticmail/enterprise # Select "Railway" in Step 3
617
+ railway init && railway link && railway up
618
+ ```
886
619
 
887
- docker compose up -d
888
- # → Dashboard at http://localhost:3000
620
+ ### AgenticMail Cloud
621
+
622
+ ```bash
623
+ npx @agenticmail/enterprise # Select "AgenticMail Cloud" in Step 3
624
+ # Instant URL: subdomain.agenticmail.io
889
625
  ```
890
626
 
891
- ### Local Development
627
+ ### Local / Development
628
+
629
+ ```bash
630
+ npx @agenticmail/enterprise # Select "Local" in Step 3
631
+ # Server starts on http://localhost:3000
632
+ ```
892
633
 
893
- Start immediately for testing:
634
+ Or with pm2 for production:
894
635
 
895
636
  ```bash
896
- npx @agenticmail/enterprise
897
- # → Select "Local"
898
- # → Server runs on http://localhost:3000
637
+ pm2 start dist/cli.js --name agenticmail-enterprise --watch
899
638
  ```
900
639
 
901
640
  ---
902
641
 
903
- ## Server Configuration
642
+ ## CLI Commands
904
643
 
905
- ```typescript
906
- import { createAdapter, createServer } from '@agenticmail/enterprise';
644
+ ```bash
645
+ # Interactive setup wizard (default)
646
+ npx @agenticmail/enterprise
907
647
 
908
- const db = await createAdapter({
909
- type: 'postgres',
910
- connectionString: 'postgresql://user:pass@host:5432/db',
911
- });
912
- await db.migrate();
648
+ # Validate a community skill manifest
649
+ npx @agenticmail/enterprise validate ./community-skills/my-skill/
650
+ npx @agenticmail/enterprise validate --all
651
+ npx @agenticmail/enterprise validate --json
913
652
 
914
- const server = createServer({
915
- port: 3000,
916
- db,
917
- jwtSecret: 'your-secret-here',
653
+ # AI-assisted skill scaffolding
654
+ npx @agenticmail/enterprise build-skill
918
655
 
919
- // Optional
920
- corsOrigins: ['https://app.agenticmail.io'],
921
- rateLimit: 120, // requests per minute per IP
922
- trustedProxies: ['10.0.0.0/8'],
923
- logging: true,
924
- });
656
+ # Submit a skill to the marketplace
657
+ npx @agenticmail/enterprise submit-skill ./community-skills/my-skill/
925
658
 
926
- await server.start();
659
+ # Recover a domain registration on a new machine
660
+ npx @agenticmail/enterprise recover --domain agents.agenticmail.io --key <hex>
661
+
662
+ # Check DNS verification status
663
+ npx @agenticmail/enterprise verify-domain
664
+ npx @agenticmail/enterprise verify-domain --domain agents.agenticmail.io
927
665
  ```
928
666
 
929
667
  ---
930
668
 
931
- ## Middleware
932
-
933
- All middleware is exported for use in custom server setups:
669
+ ## Security
934
670
 
935
- | Middleware | Description |
936
- |-----------|-------------|
937
- | `requestIdMiddleware()` | Adds `X-Request-Id` header to every request |
938
- | `requestLogger()` | Logs method, path, status, duration |
939
- | `rateLimiter(opts)` | Per-IP rate limiting with configurable window |
940
- | `securityHeaders()` | Sets security headers (CSP, HSTS, X-Frame-Options, etc.) |
941
- | `errorHandler()` | Catches unhandled errors, returns JSON |
942
- | `auditLogger(db)` | Logs all mutations to the audit trail |
943
- | `requireRole(role)` | RBAC middleware requires specific user role |
944
- | `validate(schema)` | Request body validation |
671
+ ### Authentication
672
+ - **httpOnly cookies** — `em_session`, `em_refresh`, `em_csrf` (not localStorage JWT)
673
+ - **CSRF protection** Double-submit cookie pattern
674
+ - **SSO** Google, Microsoft, GitHub, Okta, SAML 2.0, LDAP
675
+ - **Password hashing** bcrypt with cost factor 12
676
+ - **JWT** Short-lived access tokens + long-lived refresh tokens
677
+
678
+ ### Authorization
679
+ - **RBAC**4 roles: owner, admin, member, viewer
680
+ - **Per-tool permissions** Allow/deny at individual tool level
681
+ - **Approval workflows** — Human-in-the-loop for sensitive operations
682
+ - **Budget gates** — Hard cost limits per agent
683
+
684
+ ### Data Protection
685
+ - **DLP Engine** — Content scanning for PII, credentials, sensitive data
686
+ - **Secure Vault** — Encrypted credential storage with access control
687
+ - **Egress Filter** — Outbound request filtering
688
+ - **IP Firewall** — CIDR-based access control
689
+ - **Audit Logging** — Every mutating action logged with actor, timestamp, details
690
+
691
+ ### Infrastructure
692
+ - **Rate Limiting** — Per-IP, configurable
693
+ - **Circuit Breaker** — Database connectivity protection
694
+ - **Security Headers** — CSP, HSTS, X-Frame-Options, X-Content-Type-Options
695
+ - **Domain Lock** — Cryptographic domain registration to prevent unauthorized duplication
945
696
 
946
697
  ---
947
698
 
948
- ## Resilience
699
+ ## Community Skills
949
700
 
950
- Built-in resilience primitives:
701
+ Build and share skills through the community marketplace:
951
702
 
952
- | Component | Description |
953
- |-----------|-------------|
954
- | `CircuitBreaker` | Fails fast after N consecutive errors, auto-recovers after cooldown |
955
- | `HealthMonitor` | Periodic health checks with configurable thresholds |
956
- | `withRetry(fn, opts)` | Retry with exponential backoff |
957
- | `RateLimiter` | Token bucket rate limiter |
958
- | `KeyedRateLimiter` | Per-key rate limiting (e.g., per-user, per-IP) |
703
+ ### Creating a Skill
959
704
 
960
- ```typescript
961
- import { CircuitBreaker, withRetry, HealthMonitor } from '@agenticmail/enterprise';
705
+ ```bash
706
+ npx @agenticmail/enterprise build-skill
707
+ ```
962
708
 
963
- // Circuit breaker wrapping a database call
964
- const breaker = new CircuitBreaker({ failureThreshold: 5, recoveryTimeMs: 30000 });
965
- const result = await breaker.execute(() => db.query('SELECT ...'));
709
+ The AI-assisted scaffolding tool generates:
710
+ - `manifest.json` Skill metadata, tools, permissions, config fields
711
+ - Tool implementations
712
+ - README with usage instructions
966
713
 
967
- // Retry with backoff
968
- const data = await withRetry(() => fetch('https://api.example.com'), {
969
- maxRetries: 3,
970
- baseDelayMs: 1000,
971
- backoffMultiplier: 2,
972
- });
714
+ ### Skill Manifest Format
715
+
716
+ ```json
717
+ {
718
+ "name": "my-skill",
719
+ "version": "1.0.0",
720
+ "description": "What this skill does",
721
+ "author": "your-name",
722
+ "license": "MIT",
723
+ "category": "productivity",
724
+ "tools": [
725
+ {
726
+ "name": "my_tool",
727
+ "description": "What this tool does",
728
+ "parameters": { ... },
729
+ "riskLevel": "low",
730
+ "sideEffects": ["read"]
731
+ }
732
+ ],
733
+ "config": [
734
+ { "name": "API_KEY", "type": "secret", "required": true }
735
+ ]
736
+ }
973
737
  ```
974
738
 
975
- ---
739
+ ### Validating
976
740
 
977
- ## Programmatic Usage
741
+ ```bash
742
+ npx @agenticmail/enterprise validate ./community-skills/my-skill/
743
+ ```
978
744
 
979
- Use Enterprise as a library in your own application:
745
+ ### Submitting
980
746
 
981
- ```typescript
982
- import {
983
- // Database
984
- createAdapter,
985
-
986
- // Server
987
- createServer,
988
-
989
- // Engine
990
- PermissionEngine,
991
- BUILTIN_SKILLS,
992
- PRESET_PROFILES,
993
- AgentConfigGenerator,
994
- DeploymentEngine,
995
- ApprovalEngine,
996
- AgentLifecycleManager,
997
- KnowledgeBaseEngine,
998
- TenantManager,
999
- ActivityTracker,
1000
-
1001
- // Tool catalog
1002
- ALL_TOOLS,
1003
- getToolsBySkill,
1004
- generateToolPolicy,
1005
-
1006
- // Engine persistence
1007
- EngineDatabase,
1008
-
1009
- // Runtime hooks & bridge
1010
- createEnterpriseHook,
1011
- createAgenticMailBridge,
1012
-
1013
- // Resilience
1014
- CircuitBreaker,
1015
- withRetry,
1016
- HealthMonitor,
1017
-
1018
- // Middleware (for custom servers)
1019
- rateLimiter,
1020
- auditLogger,
1021
- requireRole,
1022
- } from '@agenticmail/enterprise';
747
+ ```bash
748
+ npx @agenticmail/enterprise submit-skill ./community-skills/my-skill/
1023
749
  ```
1024
750
 
751
+ Skills are synced from the GitHub repository every 6 hours to all deployments.
752
+
1025
753
  ---
1026
754
 
1027
- ## Security
755
+ ## Configuration
1028
756
 
1029
- - **JWT authentication** with configurable secret and expiry
1030
- - **API key authentication** with scoped permissions
1031
- - **RBAC** — owner, admin, member, viewer roles
1032
- - **Rate limiting** — per-IP, configurable limits
1033
- - **Audit logging** — every mutation logged with actor, action, resource, timestamp
1034
- - **Outbound email scanning** — inherited from AgenticMail core (blocks PII, credentials, secrets)
1035
- - **Security headers** — CSP, HSTS, X-Frame-Options, X-Content-Type-Options
1036
- - **Input validation** — all API inputs validated before processing
1037
- - **Circuit breaker** — protects against cascading failures
1038
- - **Graceful shutdown** — clean connection teardown on SIGINT/SIGTERM
757
+ ### Environment Variables
1039
758
 
1040
- ---
759
+ | Variable | Description | Default |
760
+ |----------|-------------|---------|
761
+ | `DATABASE_URL` | Database connection string | — |
762
+ | `JWT_SECRET` | JWT signing secret | — |
763
+ | `PORT` | Server port | `3000` |
764
+ | `CORS_ORIGINS` | Allowed CORS origins (comma-separated) | `*` |
765
+ | `RATE_LIMIT` | Requests per minute per IP | `120` |
766
+ | `AGENTICMAIL_REGISTRY_URL` | Central registry URL | `https://registry.agenticmail.com/v1` |
767
+ | `ANTHROPIC_API_KEY` | For agent runtime | — |
768
+ | `OPENAI_API_KEY` | For agent runtime | — |
1041
769
 
1042
- ## Project Structure
770
+ ### Server Config (Programmatic)
1043
771
 
1044
- ```
1045
- enterprise/src/
1046
- ├── cli.ts # CLI entry point (npx @agenticmail/enterprise)
1047
- ├── server.ts # Hono server: middleware, auth, route mounting
1048
- ├── index.ts # Public API exports
1049
-
1050
- ├── auth/
1051
- │ └── routes.ts # JWT login, cookies, refresh, SAML/OIDC stubs
1052
-
1053
- ├── admin/
1054
- │ └── routes.ts # Users, Agents, API Keys, Audit, Settings, Rules CRUD
1055
-
1056
- ├── middleware/
1057
- │ └── index.ts # Rate limiter, security headers, audit logger, RBAC, error handler
1058
-
1059
- ├── lib/
1060
- │ └── resilience.ts # CircuitBreaker, HealthMonitor, withRetry, RateLimiter
1061
-
1062
- ├── db/ # Admin database adapters (6 backends)
1063
- │ ├── adapter.ts # Abstract DatabaseAdapter interface
1064
- │ ├── factory.ts # createAdapter() factory
1065
- │ ├── sql-schema.ts # Shared SQL DDL + migrations
1066
- │ ├── sqlite.ts # SQLite (better-sqlite3)
1067
- │ ├── postgres.ts # PostgreSQL (pg)
1068
- │ ├── mysql.ts # MySQL (mysql2)
1069
- │ ├── mongodb.ts # MongoDB
1070
- │ ├── dynamodb.ts # DynamoDB (@aws-sdk)
1071
- │ └── turso.ts # Turso/LibSQL (@libsql/client)
1072
-
1073
- ├── engine/ # Agent management platform (11 subsystems)
1074
- │ ├── index.ts # Public re-exports
1075
- │ ├── routes.ts # All engine REST endpoints (50+)
1076
- │ ├── skills.ts # 38 skills, 5 presets, PermissionEngine (DB-persisted)
1077
- │ ├── agent-config.ts # AgentConfigGenerator: workspace, gateway, docker-compose, systemd
1078
- │ ├── deployer.ts # DeploymentEngine: Docker, VPS/SSH, Fly.io, Railway
1079
- │ ├── lifecycle.ts # AgentLifecycleManager: state machine, health checks (DB-persisted)
1080
- │ ├── approvals.ts # ApprovalEngine: policies, requests, decisions (DB-persisted)
1081
- │ ├── knowledge.ts # KnowledgeBaseEngine: docs, chunking, embeddings, RAG (DB-persisted)
1082
- │ ├── tenant.ts # TenantManager: orgs, plans, limits, usage (DB-persisted)
1083
- │ ├── activity.ts # ActivityTracker: events, tool calls, conversations, SSE (DB-persisted)
1084
- │ ├── tool-catalog.ts # 167 tool IDs mapped to skills
1085
- │ ├── runtime/ # Runtime hooks (permission enforcement, activity logging)
1086
- │ ├── agenticmail-bridge.ts # Bridge to AgenticMail API
1087
- │ ├── db-adapter.ts # EngineDatabase wrapper (all CRUD implemented)
1088
- │ └── db-schema.ts # Engine DDL: 15 tables, versioned migrations, dialect converters
1089
-
1090
- ├── deploy/ # Cloud deployment
1091
- │ ├── fly.ts # Fly.io Machines API
1092
- │ └── managed.ts # Managed cloud provisioning
1093
-
1094
- ├── setup/ # CLI setup wizard
1095
- │ ├── index.ts # Wizard orchestrator
1096
- │ ├── company.ts # Company info prompts
1097
- │ ├── database.ts # Database selection
1098
- │ ├── deployment.ts # Deployment target
1099
- │ ├── domain.ts # Custom domain
1100
- │ └── provision.ts # Provisioning logic
1101
-
1102
- └── dashboard/
1103
- └── index.html # Admin UI (single HTML, React 18 from CDN)
772
+ ```typescript
773
+ createServer({
774
+ port: 3000,
775
+ db: adapter,
776
+ jwtSecret: 'your-secret',
777
+ corsOrigins: ['https://your-domain.com'],
778
+ rateLimit: 120,
779
+ trustedProxies: ['10.0.0.0/8'],
780
+ logging: true,
781
+ runtime: {
782
+ enabled: true,
783
+ defaultModel: { provider: 'anthropic', modelId: 'claude-sonnet-4-20250514' },
784
+ apiKeys: { anthropic: '...' },
785
+ },
786
+ });
1104
787
  ```
1105
788
 
1106
789
  ---
1107
790
 
1108
- ## Author
1109
-
1110
- Created by **[Ope Olatunji](https://github.com/ope-olatunji)**.
791
+ ## Requirements
1111
792
 
1112
- Part of the [AgenticMail](https://github.com/agenticmail/agenticmail) project — the first platform to give AI agents real email addresses and phone numbers.
793
+ - **Node.js** 18+
794
+ - **Database** — Any of the 10 supported backends
795
+ - **LLM API Key** — Anthropic or OpenAI (for agent runtime)
1113
796
 
1114
- - GitHub: [@ope-olatunji](https://github.com/ope-olatunji)
1115
- - Website: [agenticmail.io](https://agenticmail.io)
1116
- - Twitter: [@agenticmail](https://x.com/agenticmail)
797
+ ---
1117
798
 
1118
799
  ## License
1119
800
 
1120
- MIT — see [LICENSE](./LICENSE)
801
+ MIT — See [LICENSE](./LICENSE)
802
+
803
+ ---
804
+
805
+ Built by [AgenticMail](https://agenticmail.io) · [GitHub](https://github.com/agenticmail/enterprise) · [OpenClaw](https://openclaw.ai)