What is MomoBot?
MomoBot is an enterprise-grade cloud-controlled automation platform that lets you remotely manage, monitor, and automate tasks across any number of devices β servers, desktops, laptops, IoT hardware, and edge devices β from a single secure control plane.
Organizations use MomoBot to eliminate manual device management, reduce response time to system events, and maintain a complete auditable record of every automated action across their entire fleet.
- Cloud-first control β orchestration, policy enforcement, logging, dashboards, and scheduling all live in the cloud.
- Thin secure agents β lightweight daemons on your devices that execute only explicitly approved actions and report results back.
What MomoBot Does
Fleet Automation
Automate device diagnostics, health checks, file operations, and system maintenance across your entire fleet simultaneously.
Policy-Gated Execution
Every task passes through the policy engine before it reaches any device. Dangerous commands are blocked automatically β no configuration required.
Immutable Audit Trail
Every action β who ran it, when, on which device, with what result β is recorded permanently. Full compliance-ready audit logs available via the dashboard or API.
Collaboration Triggers
Trigger automation directly from Slack slash commands or Microsoft Teams messages. No context-switching β run tasks from where your team already works.
Multi-Step Workflows
Chain tasks into visual workflows with conditional branching, approval gates, and scheduled execution. Build complex automation without writing code.
Works Everywhere
Agents run on Linux, Windows, macOS, Raspberry Pi, NVIDIA Jetson, and any ARM Linux device. No inbound firewall ports required.
Key Features
Cloud Control Plane
- Centralized REST API for all agent, task, workflow, and schedule management
- Real-time WebSocket gateway for live agent status and task results
- Visual workflow builder with n8n-compatible DAG format
- Role-based access control (RBAC) β user and admin roles
- Policy engine that validates every task before dispatch
- Immutable audit log of every sensitive action
- Cron-based scheduler for automated recurring tasks
- Webhook ingress from Slack and Microsoft Teams
- AI-assisted workflow and task generation
Agent Capabilities
- Runs as a system service on any supported OS
- Connects outbound only β no inbound ports needed on agent hosts
- Automatic heartbeat and reconnect with exponential backoff
- Receives, validates, and executes tasks from the control plane
- Returns structured results: stdout, stderr, exit code, metadata
- Queued task delivery β tasks dispatched on reconnect after downtime
Security
- bcrypt password hashing (cost factor 12) + JWT access tokens
- Optional TOTP two-factor authentication
- 256-bit random agent API keys and secret keys
- HMAC-SHA256 signature verification on all webhook payloads
- 5-minute replay protection on all webhook integrations
- Automatic redaction of secrets in all log output
- Shell command deny-list (blocks destructive, exfiltration, and fork-bomb patterns)
- File path restrictions (blocks credential files, kernel interfaces, and traversal)
- Rate limiting on all API and auth endpoints
Quick Start
Get MomoBot running in under 5 minutes with this step-by-step guide.
Start the Server
Install dependencies and start the MomoBot control plane:
cd momobot-platform
npm run install:all
cp server/.env.example server/.env
# Edit server/.env and set JWT_SECRET and JWT_REFRESH_SECRET
npm run dev
The server runs on http://localhost:4000. The dashboard is available at http://localhost:3000.
Create Your Account
Open the dashboard at http://localhost:3000 and register. The first registered user automatically becomes an admin.
Register an Agent
In the dashboard, navigate to Settings β Agents β New Agent. Give your agent a name. Copy the API key and Secret key β these are shown only once.
Start the Agent
On the device you want to manage, configure and start the agent:
cd momobot-platform/momobot-agent
cp .env.example .env
# Edit .env:
# SERVER_URL=http://localhost:4000
# AGENT_API_KEY=bot_xxx
# AGENT_SECRET_KEY=xxx
npm start
Run Your First Task
Wait ~30 seconds for the agent to appear as Online in the dashboard. Then:
- Go to Tasks β New Task
- Select your agent
- Choose task type
system_info - Click Run
- View the result in real time in the task detail view
Architecture
MomoBot uses a cloud-first, thin-agent architecture. All intelligence, policy, scheduling, and orchestration lives in the cloud control plane. Agents on managed devices are lightweight and do nothing independently β they only act when the control plane tells them to.
Data Flow
Cloud Control Plane
The MomoBot server is the central hub of the platform. Every agent connects to it, every task flows through it, and every action is recorded by it.
| Component | What It Does |
|---|---|
| REST API | Manages users, agents, tasks, workflows, and schedules. All operations authenticated with JWT. |
| WebSocket Gateway | Maintains real-time connections to all online agents and pushes live updates to the dashboard. |
| Auth & RBAC | Handles user login, registration, token issuance, and role-based access control. |
| Task Dispatcher | Routes tasks to the correct agent in real time. Queues tasks for agents that are offline. |
| Policy Engine | Validates every task against the task type allowlist, shell deny patterns, file path restrictions, and timeout limits before dispatch. |
| Audit Logger | Records every sensitive action (login, agent creation, task dispatch, webhook events) to an immutable audit log. |
| Workflow Engine | Executes multi-step DAG workflows with approval gates, conditional branching, and execution traces. |
| Scheduler | Runs tasks or workflows on cron-based schedules. |
| Webhook Ingress | Accepts HMAC-verified requests from Slack and Microsoft Teams to trigger tasks from chat. |
Dashboard
The MomoBot dashboard is a React web application that provides complete visibility and control over your automation fleet.
Dashboard Capabilities
Agent Management
- View all registered agents and their live online/offline status
- Create new agents and copy their credentials
- Enable, disable, or permanently delete agents
- Rotate agent API keys at any time
- View per-agent task history and logs
Task Management
- Create tasks of any supported type for any online agent
- Track task status (pending, running, completed, failed)
- View full task output including stdout, stderr, and exit codes
- Filter and search task history across all agents
Visual Workflow Builder
- Design multi-step automation workflows with a drag-and-drop node editor
- Connect tasks with conditional branching and approval gates
- Preview workflow diagrams before execution
- Export workflows in n8n-compatible JSON format
Audit & Analytics
- Browse the complete audit log filtered by user, action, or date
- View agent health trends and task success rates
- Manage user accounts and their roles (admin only)
Agent Model
A MomoBot agent is a lightweight daemon installed on each managed device. Agents connect outbound to the control plane β no inbound firewall ports are ever needed.
How Agents Work
- Secure connection: Agents connect to the server over WebSocket with TLS (
wss://in production). - API key authentication: Each agent authenticates using its unique 256-bit API key and secret key pair.
- Heartbeat: Agents send heartbeat pings every 30 seconds. The server marks agents offline if pings stop.
- Automatic reconnect: If the connection drops, agents reconnect automatically with exponential backoff up to a configurable maximum.
- Task execution: When a task arrives, the agent validates it, executes it, and sends back structured results.
- Offline safety: Tasks dispatched while the agent is offline are queued on the server and delivered the moment the agent reconnects.
Agent Isolation
- Each agent has unique credentials scoped to one owner user
- Regular users can only manage and task their own agents
- Admins can view and manage all agents across all users
- Agents can be individually enabled or disabled without deleting them
- Secret keys are generated once and shown once β not stored in plaintext
Task Types
MomoBot supports the following task types. Every task is validated by the Policy Engine before it reaches the agent.
| Task Type | What It Does | Parameters |
|---|---|---|
system_info |
Collects OS name and version, CPU model and core count, total and used RAM, disk usage, hostname, and uptime. | None required |
shell |
Executes a shell command on the device. Commands are validated against the deny-pattern list before execution. | command, optional timeout (ms), optional cwd |
script |
Executes a script file on the agent's device. | path to the script file |
file_read |
Reads and returns the contents of a file. Access to sensitive system paths is blocked. | path, optional encoding |
file_write |
Writes content to a file on the agent's device. Sensitive system paths are blocked. | path, content, optional append flag |
process_list |
Returns a list of all currently running processes on the device. | Optional filter string |
screenshot |
Captures a screenshot of the device's primary display. | Optional format, optional quality |
custom |
A custom task type for agent-specific extensions. Validated by the agent's local policy; bypasses server-level shell deny patterns. | Agent-defined |
custom task type bypasses server-level shell deny patterns. If you use custom tasks, your agent must enforce its own local policy controls.
Workflow Engine
MomoBot includes a built-in workflow engine for multi-step, conditional automation. Workflows are defined as directed acyclic graphs (DAGs) β a series of tasks connected by directed edges.
What Workflows Do
- Chain multiple tasks across one or more agents into a single automated workflow
- Define conditional branching β different paths depending on task results
- Add approval gates that pause execution until a human approves
- Schedule workflows to run automatically on a cron schedule
- Trigger workflows from the dashboard, Slack, Teams, or the REST API
- View per-execution traces showing the status of every node in the graph
- Export workflows in n8n-compatible JSON format for use with external tools
Workflow Components
Nodes
Each node in the workflow represents a single task. Nodes carry their task type, parameters, target agent, and description.
Edges
Directed edges connect nodes and define execution order. Edges can carry conditions that determine when the next node runs.
Approval Gates
Special nodes that pause workflow execution until an authorized user approves or rejects. Approval state is stored in the workflow_approvals table.
Execution Traces
Every workflow run creates an execution record showing the start time, end time, final status, and per-node results for that run.
AI-Assisted Generation
MomoBot can generate workflow definitions automatically from a natural-language description using the AI integration endpoint. The generated workflow is returned in n8n-compatible JSON format ready for import into the visual workflow builder.
AI Task Creator
The AI Task Creator is an admin tool that combines task configuration with AI analysis to help you build, validate, and execute tasks more confidently.
What the AI Task Creator Provides
- Natural-language task description: Describe what you want to accomplish in plain English. The AI suggests the correct task type, parameters, and configuration.
- Risk assessment: Before execution, the AI flags potential risks, destructive operations, or edge cases.
- Step-by-step plan: See a human-readable breakdown of exactly what the task will do on the target device.
- Time estimate: Understand roughly how long the task will take to complete.
- Command preview: Review the exact command that will be sent to the agent before you confirm execution.
- Workflow diagram: Visualize even single tasks as a start-to-finish flow diagram before running them.
Supported AI Models
Premium Models
Require API keys configured in your server environment:
- Claude 3 Opus (Anthropic) β Best reasoning
- GPT-4o (OpenAI) β Most capable
- GPT-4 Turbo (OpenAI) β Balanced
- GPT-3.5 Turbo (OpenAI) β Fast
Free Models
No API keys required:
- Llama 2 70B (Meta)
- Mistral 7B (Mistral AI)
- Local models (llama.cpp / Ollama)
Scheduler
The MomoBot scheduler lets you run tasks or entire workflows on a recurring cron-based schedule β no manual triggering required.
Scheduler Features
- Schedule any task type to run at any cron interval (minutes, hours, daily, weekly)
- Schedule full workflows to run automatically
- View all active schedules and their next run time in the dashboard
- Enable or disable individual schedules without deleting them
- All scheduled runs are logged in the audit trail with full task output
Slack Integration
MomoBot integrates with Slack so your team can trigger automation directly from any Slack channel using slash commands.
Setup
- Create a Slack app in your workspace via the Slack API dashboard.
- Add a Slash Command pointing to your MomoBot server at
https://your-server/webhooks/slack. - Copy the Signing Secret from your Slack app settings.
- Add it to your server environment file:
SLACK_SIGNING_SECRET=your-signing-secret-here - Add the app to your Slack workspace.
Using Slack Commands
Once configured, anyone in your workspace with access can run:
/momobot run sysinfo on agent-my-laptop
/momobot status
/momobot agents list
Security
- Every incoming Slack request is verified with HMAC-SHA256 using your
SLACK_SIGNING_SECRET. - Requests with timestamps older than 5 minutes are automatically rejected (replay protection).
- Every slash command invocation is recorded in the audit log.
Microsoft Teams Integration
MomoBot integrates with Microsoft Teams so your team can trigger automation by mentioning the MomoBot app in any Teams channel.
Setup
- In the Microsoft Teams admin center, create an Outgoing Webhook.
- Set the webhook callback URL to
https://your-server/webhooks/teams. - Copy the HMAC signing secret (base64-encoded) provided by Teams.
- Add it to your server environment file:
TEAMS_WEBHOOK_SECRET=base64encodedSecretHere==
Using Teams Commands
Mention the MomoBot app in any channel to trigger commands:
@MomoBot run diagnostic on server-001
@MomoBot get system info
Security
- Every incoming Teams request is verified with HMAC-SHA256 using your
TEAMS_WEBHOOK_SECRET. - Signature comparison uses timing-safe algorithms to prevent timing attacks.
- Every Teams message that triggers a task is recorded in the audit log.
Email (SMTP)
MomoBot can send email notifications at key points in your automation workflows using any SMTP relay.
What Email Notifications Cover
- Task completion or failure alerts
- Workflow approval request notifications
- Diagnostic report delivery
Configuration
Add SMTP settings to your server environment file:
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=alerts@example.com
SMTP_PASS=yourpassword
SMTP_FROM=MomoBot <alerts@example.com>
Webhook Reference
MomoBot exposes webhook endpoints for supported integrations. All endpoints require a valid HMAC signature or return HTTP 401.
| Endpoint | Method | Purpose |
|---|---|---|
POST /webhooks/slack |
POST | Receives Slack slash commands. Verified with X-Slack-Signature header (HMAC-SHA256). |
POST /webhooks/teams |
POST | Receives Microsoft Teams outgoing webhook messages. Verified with Authorization: HMAC <sig> header. |
Planned Integrations
| Platform | Status |
|---|---|
| Google Chat | π Planned |
| WhatsApp Business | π Planned |
| Zoom | π Planned |
| Google Meet | π Planned |
Security Overview
MomoBot is built with a defense-in-depth security model. Multiple independent layers of protection ensure that even if one layer is bypassed, others prevent harm.
| Layer | Mechanism |
|---|---|
| Transport | TLS via reverse proxy β all traffic over HTTPS / wss:// |
| User Authentication | bcrypt (cost 12) + JWT access tokens (15 min) + refresh tokens (7 days) + optional TOTP 2FA |
| Agent Authentication | 256-bit random API key + secret key pair transmitted over TLS WebSocket |
| Authorization | RBAC (user / admin) with per-query ownership enforcement at the database level |
| Task Safety | Policy Engine validates every task before dispatch β type allowlist, shell deny patterns, file path restrictions |
| Webhook Security | HMAC-SHA256 signature verification + 5-minute timestamp replay protection |
| Log Safety | Automatic redaction of secrets before any audit write |
| Rate Limiting | 100 req/15 min on API endpoints; 10 req/15 min on auth endpoints |
| Input Validation | All inputs validated with express-validator before processing |
Authentication
User Authentication
- Passwords hashed with bcrypt at cost factor 12 β industry-standard one-way hashing
- JWT access tokens with 15-minute expiry for all API requests
- Refresh tokens with 7-day expiry, stored in the database and revocable
- Optional TOTP two-factor authentication (HMAC-based time-based OTP via speakeasy)
- Sessions tracked in the database β individual sessions can be revoked
Agent Authentication
- Each agent is issued a unique API key and secret key, each generated with 256-bit entropy
- Agent credentials are transmitted only over TLS WebSocket in production
- Deactivated agents (
is_active = false) are immediately blocked from connecting - Secret keys are shown once at creation and not stored in plaintext
Generating Secure Secrets
# Generate JWT secrets (run once during setup)
openssl rand -base64 64 # For JWT_SECRET
openssl rand -base64 64 # For JWT_REFRESH_SECRET
Roles & Permissions
MomoBot uses a two-role access control system.
| Role | Capabilities |
|---|---|
| user |
|
| admin |
|
Policy Engine
The policy engine is the core safety gate of MomoBot. Every task β regardless of how it was triggered β passes through the policy engine before being dispatched to any agent. If a task fails policy validation, it is rejected and never reaches the device.
Task Type Allowlist
Only the following task types are permitted. Any other type is automatically blocked:
system_info | shell | script | file_read | file_write | process_list | screenshot | custom
Shell Command Deny Patterns
The following shell patterns are blocked regardless of who requests them:
| Blocked Pattern | Why |
|---|---|
rm -rf / | Recursive deletion of the root filesystem |
mkfs* | Disk formatting commands |
dd if= | Raw disk copy operations |
> /dev/ | Writing directly to device files |
curl | bash or wget | sh | Download-and-execute attacks |
chmod 777 / | Root permission escalation |
:(){:|:&}; | Fork bomb (resource exhaustion) |
base64 -d | bash | Obfuscated code execution |
File Path Restrictions
The following paths cannot be read or written by any task:
| Blocked Path | Why |
|---|---|
/etc/shadow | System password hashes |
/etc/passwd | User account database |
/proc/*/mem | Direct process memory access |
/sys/ | Kernel sysfs interface |
Any path with ../ or ..\ | Path traversal prevention |
Timeout Limits
- Minimum timeout: 1 second β prevents degenerate zero-timeout tasks
- Maximum timeout: 5 minutes β prevents runaway long-running tasks
Audit Logging
MomoBot maintains an immutable audit log of every sensitive action. Every entry includes who performed the action, what they did, which resource was affected, from which IP, and whether it succeeded.
What Is Logged
| Event | Description |
|---|---|
user:login | User login attempts (success and failure) |
user:register | New account registration |
agent:create | New agent registered |
agent:delete | Agent deleted |
agent:rotate-key | Agent credentials rotated |
task:create | Task dispatched to an agent |
webhook:slack:* | Slack slash command received and processed |
webhook:teams:* | Teams webhook message received and processed |
Audit Log Fields
| Field | Description |
|---|---|
user_id | ID of the user who performed the action |
action | The action type (e.g., task:create) |
resource_type | Type of resource affected (agent, task, user) |
resource_id | ID of the affected resource |
details | Action-specific metadata (with secrets redacted) |
ip_address | Source IP address of the request |
status | Outcome: success or failure |
created_at | Timestamp of the action |
Automatic Secret Redaction
The following fields are automatically redacted before any audit log write, ensuring secrets never appear in logs:
password | password_hash | secret | secretKey | apiKey | api_key | token | refreshToken | access_token
Rate Limiting
MomoBot applies rate limiting to all API and authentication endpoints to protect against abuse and brute-force attacks.
| Endpoint Group | Limit |
|---|---|
| All API endpoints | 100 requests per 15 minutes per IP address |
| Auth endpoints (login, register) | 10 requests per 15 minutes per IP address |
Agent Installation β Linux
MomoBot agents run as systemd services on Linux. The automated installer sets everything up for you.
Prerequisites
- Node.js 18 or later
- An active MomoBot server (cloud or self-hosted)
- Agent credentials (API key + Secret key) from the MomoBot dashboard
Automated Install
sudo bash deploy/installers/linux/install.sh
sudo nano /etc/momobot/agent.env # Add SERVER_URL, AGENT_API_KEY, AGENT_SECRET_KEY
sudo systemctl start momobot-agent
sudo journalctl -u momobot-agent -f # View logs
Manual Install
cd momobot-platform/momobot-agent
npm install --omit=dev
cp .env.example .env
# Edit .env and fill in your credentials
sudo cp ../../../deploy/installers/linux/momobot-agent.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable momobot-agent
sudo systemctl start momobot-agent
sudo systemctl status momobot-agent
Verifying Connection
After starting the agent, open the MomoBot dashboard and navigate to Settings β Agents β [Your Agent Name]. The agent status should show as Online within 30 seconds.
Troubleshooting
| Problem | Solution |
|---|---|
| Agent shows offline after start | Verify SERVER_URL is correct and reachable. Check firewall allows outbound TCP on port 443 (wss://) or your server port. |
| Authentication errors | Verify AGENT_API_KEY and AGENT_SECRET_KEY match what is shown in the dashboard. Check if the agent has been deactivated. |
| Tasks not arriving | Tasks dispatched while the agent was offline are queued on the server. They dispatch automatically on reconnect. Check task status in the dashboard. |
Agent Installation β Windows
The MomoBot agent runs as a Windows service via a PowerShell installer.
Prerequisites
- Node.js 18 or later (x64)
- PowerShell with RemoteSigned execution policy
- An active MomoBot server and agent credentials from the dashboard
Install
# Run as Administrator in PowerShell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\deploy\installers\windows\install.ps1
# Edit configuration
notepad C:\MomoBot\config\agent.env
# Start the service
Start-Service MomoBotAgent
Get-Service MomoBotAgent
Agent Configuration File
Edit C:\MomoBot\config\agent.env and set:
SERVER_URL=https://your-momobot-server.com
AGENT_API_KEY=bot_xxxxxxxxxxxx
AGENT_SECRET_KEY=xxxxxxxxxxxxxxxxxxxx
Agent Installation β macOS
The MomoBot agent runs as a launchd service on macOS, supporting both Intel and Apple Silicon.
Prerequisites
- Node.js 18 or later
- An active MomoBot server and agent credentials from the dashboard
Install
bash deploy/installers/macos/install.sh
# Edit configuration with your credentials
nano ~/.momobot-agent/agent.env
# Load and start the agent service
launchctl load ~/Library/LaunchAgents/com.momobot.agent.plist
launchctl start com.momobot.agent
# View logs
tail -f ~/Library/Logs/momobot-agent.log
Platform Support
| Platform | Status |
|---|---|
| macOS x64 (Intel) | β Supported |
| macOS ARM64 (Apple Silicon) | β Supported |
Agent Installation β IoT / Raspberry Pi
MomoBot agents run on ARM Linux devices including Raspberry Pi 3/4, NVIDIA Jetson Nano, and industrial edge devices.
Supported Devices
- Raspberry Pi 4 (ARM64) β Recommended
- Raspberry Pi 3 (ARM32)
- NVIDIA Jetson Nano (ARM64)
- Generic ARM Linux devices
- Industrial Linux edge devices
Install Node.js on Raspberry Pi
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs git
node --version # Should show v18.x.x
Install the Agent
cd momobot-platform/momobot-agent
npm install --omit=dev
sudo mkdir -p /etc/momobot
cp .env.example /etc/momobot/agent.env
sudo nano /etc/momobot/agent.env
# Set SERVER_URL, AGENT_API_KEY, AGENT_SECRET_KEY
sudo cp ../../../deploy/installers/linux/momobot-agent.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable momobot-agent
sudo systemctl start momobot-agent
Low-Memory Optimization
On resource-constrained devices, add these options to /etc/momobot/agent.env:
NODE_OPTIONS=--max-old-space-size=128
HEARTBEAT_INTERVAL=60000
MAX_RECONNECT_ATTEMPTS=50
Network Requirements
- Agents connect outbound only β no inbound ports required on the device
- Requires outbound TCP to your MomoBot server (typically port 443 for
wss://) - UDP is not used for cloud transport
Security on Edge Devices
- Agent credentials stored in
/etc/momobot/agent.envwith mode 600, owned by themomobotuser - Systemd service runs as a dedicated
momobotuser β not root - TLS validation enabled by default (do not disable in production)
Local Development
Run the full MomoBot platform locally for development and testing.
Prerequisites
- Node.js 18 or later
- npm 8 or later
Setup
cd momobot-platform
# Install all dependencies (server + client + agent)
npm run install:all
# Configure the server
cp server/.env.example server/.env
# Edit server/.env β set at minimum:
# JWT_SECRET=<strong random string, min 32 chars>
# JWT_REFRESH_SECRET=<strong random string, min 32 chars>
# Configure the agent
cp momobot-agent/.env.example momobot-agent/.env
# Edit momobot-agent/.env β set:
# SERVER_URL=http://localhost:4000
# AGENT_API_KEY=<from dashboard after setup>
# AGENT_SECRET_KEY=<from dashboard after setup>
# Start server + client
npm run dev
Then in a separate terminal:
cd momobot-platform/momobot-agent
npm start
Dashboard: http://localhost:3000 β Server API: http://localhost:4000
Docker Deployment
Docker Compose is the recommended way to deploy MomoBot for production on a single host.
Start with Docker Compose
cd momobot-platform
# Build and start all services in the background
docker-compose up -d
# View running containers and logs
docker-compose ps
docker-compose logs -f
# Stop all services
docker-compose down
What Docker Compose Provides
- MomoBot server on port 4000
- React client on port 3000
- Persistent SQLite data volume (data survives container restarts)
Kubernetes Deployment
For high-availability production deployments, MomoBot can be deployed to Kubernetes.
Deploy to Kubernetes
# Create namespace
kubectl create namespace momobot
# Create secrets (customize values first)
kubectl create secret generic momobot-secrets \
--from-literal=JWT_SECRET="$(openssl rand -base64 64)" \
--from-literal=JWT_REFRESH_SECRET="$(openssl rand -base64 64)" \
-n momobot
# Apply all manifests
kubectl apply -f momobot-platform/k8s/ -n momobot
# Check status
kubectl get all -n momobot
AWS / Terraform Deployment
MomoBot includes Terraform configurations for a fully-managed AWS deployment.
What Terraform Provisions
- ECS Fargate cluster for the MomoBot server
- S3 + CloudFront for the React client
- RDS PostgreSQL for the production database
- Application Load Balancer for HTTPS termination
- AWS Secrets Manager for credentials storage
Deploy
cd momobot-platform/terraform
terraform init
terraform plan -var="environment=production"
terraform apply -var="environment=production"
Enterprise Architecture
For enterprise scale, MomoBot supports horizontal scaling across multiple server instances:
- Multiple server instances behind an AWS ALB or nginx load balancer
- Shared PostgreSQL database across all instances
- Redis adapter for Socket.IO shared WebSocket state
- ALB sticky sessions required for WebSocket connections
Environment Variables
Server Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
PORT | No | 4000 | Server port |
JWT_SECRET | Yes | β | JWT signing secret (min 32 characters) |
JWT_REFRESH_SECRET | Yes | β | Refresh token signing secret (min 32 characters) |
JWT_EXPIRES_IN | No | 15m | Access token expiry duration |
JWT_REFRESH_EXPIRES_IN | No | 7d | Refresh token expiry duration |
CLIENT_URL | No | http://localhost:3000 | Allowed CORS origin (your dashboard URL) |
DB_PATH | No | ./data/momobot.db | SQLite database file path |
NODE_ENV | No | development | Set to production in production |
SLACK_SIGNING_SECRET | No | β | Slack webhook HMAC signing secret |
TEAMS_WEBHOOK_SECRET | No | β | Teams webhook HMAC secret (base64-encoded) |
SMTP_HOST | No | β | SMTP relay hostname |
SMTP_PORT | No | 587 | SMTP relay port |
SMTP_USER | No | β | SMTP relay username |
SMTP_PASS | No | β | SMTP relay password |
SMTP_FROM | No | β | From address for outbound email |
Agent Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
SERVER_URL | Yes | β | MomoBot server URL (e.g., https://momobot.example.com) |
AGENT_API_KEY | Yes | β | Agent API key from the dashboard |
AGENT_SECRET_KEY | Yes | β | Agent secret key from the dashboard |
HEARTBEAT_INTERVAL | No | 30000 | Heartbeat ping interval in milliseconds |
RECONNECT_DELAY | No | 5000 | Initial reconnect delay in milliseconds |
MAX_RECONNECT_ATTEMPTS | No | 100 | Maximum number of reconnect attempts before giving up |
Operations Guide
Health Check
The server exposes a health check endpoint that requires no authentication:
GET https://your-server/health
# Response:
# {"status":"ok","timestamp":"2024-01-15T10:30:00.000Z","version":"1.0.0"}
Rotating Agent Credentials
To rotate an agent's API key and secret key (e.g., after a suspected compromise):
# Via the API
curl -X POST /api/agents/{agent-id}/regenerate-key \
-H "Authorization: Bearer $YOUR_JWT_TOKEN"
# Via the dashboard
# Agents β [Agent Name] β Rotate Key
The agent's new credentials must be updated in its .env file and the service restarted.
Disabling an Agent
To temporarily prevent an agent from connecting without deleting it:
# Via the dashboard: Agents β [Agent Name] β Disable
# Via the API:
curl -X PATCH /api/agents/{agent-id} \
-H "Authorization: Bearer $YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"is_active": false}'
Viewing Audit Logs
# Via dashboard: Admin β Audit Logs
# Via SQLite (local/dev only)
sqlite3 momobot-platform/server/data/momobot.db \
"SELECT * FROM audit_logs ORDER BY created_at DESC LIMIT 50;"
Production Security Checklist
- β
Set strong
JWT_SECRETandJWT_REFRESH_SECRET(useopenssl rand -base64 64) - β Enable TLS via a reverse proxy (nginx, Caddy, or AWS ALB)
- β
Set
CLIENT_URLto your actual dashboard domain - β
Set
NODE_ENV=production - β Mount the SQLite data directory to persistent storage
- β Block direct access to port 4000 via firewall
- β Rotate agent credentials periodically
- β Review audit logs regularly
- β Set up log shipping to your SIEM
Scaling
| Scenario | Guidance |
|---|---|
| Development / small team | SQLite + single server instance. Default configuration works out of the box. |
| Medium deployment | Migrate to PostgreSQL. Single server instance with Docker Compose. |
| High-availability production | PostgreSQL (RDS or Cloud SQL) + multiple server instances + Redis Socket.IO adapter + ALB sticky sessions. |
| Enterprise (Kubernetes) | EKS/GKE/AKS + PostgreSQL + Redis + Kubernetes Secrets for credentials + Horizontal Pod Autoscaler. |
Monitoring
Recommended Observability Stack
| Category | Tools |
|---|---|
| Logs | ELK Stack, Datadog, AWS CloudWatch |
| Metrics | Prometheus + Grafana |
| Alerts | PagerDuty or OpsGenie for agent offline / task failure events |
| APM | Datadog APM or AWS X-Ray |
Key Metrics to Monitor
- Agent online/offline status β alert when any critical agent goes offline
- Task failure rate β alert when failure rate exceeds threshold
- Task queue depth β alert when tasks are not being dispatched
- API error rate β alert on 5xx response rates
- Audit log write rate β alert on anomalous spikes indicating unusual activity
Backup & Recovery
SQLite Backup (Single-Instance)
# Create a dated backup
sqlite3 momobot-platform/server/data/momobot.db \
".backup 'backup/momobot-$(date +%Y%m%d).db'"
PostgreSQL Backup (Multi-Instance)
# Dump and compress the database
pg_dump momobot | gzip > backup/momobot-$(date +%Y%m%d).sql.gz
# Restore
gunzip -c backup/momobot-20240115.sql.gz | psql momobot
Recovery Checklist
- Store backups off-site or in object storage (S3, GCS, Azure Blob)
- Test restore procedures before you need them
- Back up your
.envfiles securely (AWS Secrets Manager, HashiCorp Vault, or Kubernetes Secrets) β they are not included in database backups - Agent credentials do not need to be backed up separately β they are stored in the database and can be rotated if lost
API Reference
All REST API endpoints require a valid JWT Bearer token in the Authorization header, unless otherwise noted.
Authentication Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/auth/register | POST | Register a new user account |
/api/auth/login | POST | Log in and receive JWT access + refresh tokens |
/api/auth/refresh | POST | Exchange a refresh token for a new access token |
/api/auth/logout | POST | Revoke the current refresh token |
Agent Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/agents | GET | List all agents owned by the current user (admins see all) |
/api/agents | POST | Register a new agent and receive its credentials |
/api/agents/:id | GET | Get details of a specific agent |
/api/agents/:id | PATCH | Update agent name, description, or active status |
/api/agents/:id | DELETE | Permanently delete an agent |
/api/agents/:id/regenerate-key | POST | Rotate agent credentials and receive new API key + secret key |
Task Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/tasks | GET | List all tasks for the current user's agents (admins see all) |
/api/tasks | POST | Create and dispatch a new task to an agent |
/api/tasks/:id | GET | Get a specific task and its result |
Webhook Endpoints
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/webhooks/slack | POST | HMAC-SHA256 | Slack slash command receiver |
/webhooks/teams | POST | HMAC-SHA256 | Microsoft Teams outgoing webhook receiver |
System Endpoints
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/health | GET | None | Server health check β returns status, timestamp, and version |
http://your-server/api-docs when running in development mode.
Known Limitations
| # | Limitation | Impact & Workaround |
|---|---|---|
| 1 | SQLite not suitable for high-concurrency production | Use PostgreSQL for any multi-instance or high-throughput deployment. |
| 2 | mTLS not yet implemented | Mutual TLS between agents and server is planned. Use network-level controls (VPC, firewall rules) in the interim. |
| 3 | custom task type bypasses server shell deny patterns |
Agents using custom tasks must enforce their own local policy controls. |
| 4 | Secret key shown only once | No HSM-backed key storage. Store credentials securely at creation time. Rotate if lost. |
| 5 | No local offline queue on agent | Tasks queue on the server when the agent is offline. If the server is offline, tasks cannot be queued. |
| 6 | Inbound email trigger parsing not yet available | Email notifications are outbound only. Inbound email-to-task conversion is planned. |
| 7 | Google Chat, WhatsApp, Zoom integrations not yet available | Planned on the roadmap. Currently only Slack and Teams are supported. |
Roadmap
Recently Shipped
- Industrial Automation module β SCADA-grade control with OPC-UA, Modbus, MQTT connectors
- Industrial Scenario Lab β 8 built-in physical-world scenarios with replay and learning signals
- Multi-Agent Control Pipeline β 7-role PlannerβSafetyβSimulationβSupervisorβExecutorβVerifierβOptimizer
- Digital-Twin Simulation β risk scoring before hardware dispatch
- Predictive Maintenance β health scoring and anomaly-trend monitoring
Near Term
- PostgreSQL support as a first-class database option
- mTLS (Mutual TLS) agent authentication
- Google Chat integration
- WhatsApp Business integration
- Inbound email trigger parsing (email β task)
Medium Term
- Organization / team model (multi-tenant beyond per-user scoping)
- Redis adapter for multi-instance WebSocket (Socket.IO)
- ML-powered anomaly detection in the industrial telemetry pipeline (rule-based z-score and range detection already ships; ML-powered pattern recognition is planned)
- Agent local policy enforcement file (per-device allowlist)
Long Term
- Full n8n embedding for visual workflow building
- HSM-backed agent key storage
- OpenTelemetry integration for distributed tracing
- Agent auto-update mechanism
Industrial Automation & Control
MomoBot Industrial is a SCADA-grade extension that brings the platform's cloud control plane and thin-agent model to manufacturing floors, energy facilities, logistics networks, and any safety-critical operational-technology (OT) environment.
Unlike generic IT automation, industrial operations require cryptographically verified commands, hardware-aware safety rules, digital-twin validation before execution, and full operator-approval workflows for high-risk actions. MomoBot Industrial provides all of these out of the box.
python-agent-platform/modules/industrial/All endpoints are mounted under the
/v1/industrial prefix and protected by
the standard X-Operator-Token header.
Key Capabilities
Multi-Agent Control Pipeline
A 7-role agent pipeline ensures every command is planned, validated, simulated, supervised, executed, verified, and optimized.
OT Protocol Connectors
Native OPC-UA, Modbus TCP, MQTT, and Simulated connectors. Extend via the IndustrialConnector base class.
Safety Policy Engine
Threshold-based rules evaluated before any control action. Supports allow, warn, escalate, block, and emergency_stop tiers.
Digital-Twin Simulation
Stateless dry-run simulator applies proposed actions to an in-memory machine-state copy and scores risk before any hardware dispatch.
Telemetry Pipeline
Normalized ingestion with per-tag severity classification and z-score / range anomaly detection across all connected protocols.
Predictive Maintenance
Health scoring, anomaly-trend monitoring, and maintenance recommendations structured for ML integration.
Scenario Lab
8 built-in physical-world scenarios covering thermal, pressure, connectivity, safety, flow, and maintenance failure modes.
Incident Management
Automated incident creation on safety-rule violations with severity, affected assets, and full audit trail per tenant.
Data Model Overview
| Entity | Description |
|---|---|
IndustrialSite | Physical site (plant, warehouse, data centre). Top-level container. |
IndustrialFacility | Facility or building within a site. |
IndustrialZone | Zone or area within a facility. |
IndustrialMachine | Individual machine or asset with connector type and config. |
ProductionLine | Named grouping of machines forming a production flow. |
TelemetryEvent | Normalized telemetry reading with severity and anomaly flag. |
SafetyPolicy | Versioned threshold-rule set scoped to a machine and tenant. |
IndustrialCommand | Control action dispatched through the full agent pipeline. |
IndustrialIncident | Incident record created automatically on safety violations. |
SimulationRun | Result of a digital-twin dry-run tied to a specific command. |
MaintenanceWindow | Scheduled maintenance window that blocks commands on affected assets. |
Multi-Agent Control Pipeline
Every industrial command is processed by a deterministic pipeline of seven specialized agent roles before it is dispatched to hardware.
block or emergency_stop
terminates the pipeline immediately — the Executor is never reached.
Pipeline Roles
| Step | Role | Responsibility |
|---|---|---|
| 1 | Planner | Decomposes a high-level intent into concrete actions and parameters. |
| 2 | Safety | Evaluates safety policies against current machine state; can veto the pipeline. |
| 3 | Simulation | Runs a digital-twin dry-run; produces a risk score (0–1). |
| 4 | Supervisor | Reviews the risk score; decides between autonomous execution or human approval. |
| 5 | Executor | Dispatches the command to the OT connector after all checks pass. |
| 6 | Verifier | Reads back machine state after execution and compares expected vs. actual. |
| 7 | Optimizer | Records outcome metadata for future planning improvements and learning signals. |
Operator Approval Flow
When the Supervisor sets requires_approval = True, the command is held in
pending_approval state. An authorized operator calls
POST /v1/industrial/commands/{id}/approve or
POST /v1/industrial/commands/{id}/reject. Only after approval does the
Executor run.
AuditLog table with the operator
identity, timestamp, and decision notes.
OT Protocol Connectors
Connectors bridge the MomoBot control plane and physical OT devices.
All connectors implement the same IndustrialConnector base interface.
Available Connectors
| Type | Protocol | Use Case |
|---|---|---|
opcua | OPC-UA (IEC 62541) | Modern PLCs, SCADA systems, OPC-UA compliant devices |
modbus | Modbus TCP | Legacy PLCs, VFDs, sensors using register-based I/O |
mqtt | MQTT v3/v5 | IoT devices, edge gateways, sensor networks |
simulated | In-memory (test only) | Testing, CI, and demo environments — does not connect to real hardware |
Connector Interface
class IndustrialConnector:
def get_asset_status(self) -> dict: ...
def send_command(self, action: str, parameters: dict) -> dict: ...
def read_telemetry(self, tags: list[str]) -> list[dict]: ...
def health_check(self) -> bool: ...Adding a Custom Connector
- Create a new file in
modules/industrial/connectors/. - Subclass
IndustrialConnectorfrombase.pyand implement all four methods. - Register it in
connectors/__init__.pyby adding an entry to_REGISTRY. - No changes to the router, pipeline, or any other module are required.
Safety Policy Engine
The Safety Policy Engine evaluates threshold-based rules against live telemetry or command parameters before any control action is dispatched. It is stage 2 of the multi-agent pipeline and can veto execution entirely.
Rule Structure
[
{
"tag": "temperature",
"operator": "gt",
"threshold": 90.0,
"action": "emergency_stop",
"description": "Motor temperature critical limit"
},
{
"tag": "temperature",
"operator": "gt",
"threshold": 75.0,
"action": "warn",
"description": "Motor temperature high warning"
}
]Supported Operators
| Operator | Meaning |
|---|---|
gt | Greater than |
lt | Less than |
gte | Greater than or equal |
lte | Less than or equal |
eq | Equal |
neq | Not equal |
Action Severity Tiers
| Action | Effect |
|---|---|
allow | No issue — command proceeds normally. |
warn | Proceed with a warning annotation in the execution trace. |
escalate | Supervisor must review; typically triggers human approval. |
block | Command is rejected; execution does not proceed. |
emergency_stop | Highest severity; immediately halts all machines in the zone. |
Telemetry Pipeline
The telemetry pipeline normalizes raw readings from any connector protocol into a uniform
NormalizedReading, applies severity classification, and detects statistical anomalies.
Severity Classification
| Severity | Trigger |
|---|---|
nominal | Reading is within normal operating bounds. |
warning | Reading exceeds the warning threshold. |
critical | Reading exceeds the critical threshold. |
anomaly | Statistical anomaly detected (z-score or range check). |
Anomaly Detection Methods
- Z-score: flags a reading when it deviates more than N standard deviations from a rolling sample mean.
- Range check: flags a reading outside a configured absolute [min, max] range.
Ingestion API
POST /v1/industrial/telemetry/ingest
{
"machine_id": "uuid",
"tenant_id": "tenant-1",
"readings": [
{"tag": "temperature", "value": 87.5, "unit": "C"},
{"tag": "speed", "value": 1450, "unit": "rpm"},
{"tag": "vibration", "value": 0.12, "unit": "mm/s"}
]
}Predictive Maintenance
The maintenance advisor computes machine health scores from recent telemetry and generates maintenance recommendations, designed as a clean hook for future ML integration.
Health Score Bands
| Score Range | Status | Recommended Action |
|---|---|---|
| 0.8 – 1.0 | Healthy | Continue normal operation. |
| 0.5 – 0.79 | Degraded | Schedule inspection at next opportunity. |
| 0.3 – 0.49 | At Risk | Prioritize maintenance within 48 hours. |
| 0.0 – 0.29 | Critical | Immediate maintenance required. |
Machine Health API
GET /v1/industrial/machines/{machine_id}/health?tenant_id=tenant-1
# Response
{
"machine_id": "uuid",
"health_score": 0.67,
"status": "degraded",
"anomaly_fraction": 0.08,
"recommendations": [
"Schedule lubrication inspection.",
"Check bearing temperature."
],
"sample_count": 100
}Digital-Twin Simulation
Before any high-risk action reaches hardware, the simulator runs a stateless dry-run that applies the proposed command to an in-memory copy of machine state and evaluates safety rules on the predicted post-action outcome.
How It Works
- Snapshot — take a deep copy of the current machine state.
- Apply effect — run the registered action handler on the copy.
- Evaluate safety — run the safety policy engine against the predicted state.
- Score risk — produce a 0–1 risk score based on the worst safety action triggered.
- Return result —
SimulationResultincludes outcome, risk_score, predicted_state, and safety_violations.
Built-in Action Effects
| Action | Effect on Machine State |
|---|---|
set_speed | Sets state["speed"] to the provided value. |
stop | Sets speed to 0 and status to "stopped". |
start | Sets status to "running"; optionally sets speed. |
emergency_stop | Sets speed to 0 and status to "emergency_stop". |
adjust_temperature | Adjusts temperature by the specified delta. |
set_pressure | Sets pressure to the provided value. |
Risk Score Mapping
| Worst Safety Action | Risk Score | Pipeline Outcome |
|---|---|---|
allow | 0.0 | Autonomous execution |
warn | 0.25 | Autonomous with warning annotation |
escalate | 0.5 | Supervisor review; may require approval |
block | 0.75 | Command blocked |
emergency_stop | 1.0 | Pipeline vetoed; emergency stop issued |
Scenario Lab
The Scenario Lab provides a library of built-in physical-world scenarios for end-to-end testing and operator training, each covering a realistic industrial failure mode or safety-critical event.
Built-in Scenarios
| Scenario | Category | Description |
|---|---|---|
| Conveyor Overheating | thermal | Motor temperature rises above threshold. Tests speed-reduction intervention. |
| Robotic Arm — Human in Zone | human_safety | Human-presence sensor fires during robotic motion. Tests immediate halt and safety lockout. |
| Tank Pressure Breach | pressure | Tank pressure exceeds safe range. Tests emergency vent activation. |
| Edge Gateway Network Loss | connectivity | Gateway disconnects from the cloud. Tests local autonomous fallback and reconnect recovery. |
| Production Line Blockage | flow | Downstream jam sensor fires. Tests upstream motor stop and clearance workflow. |
| Maintenance Lock Conflict | maintenance | Restart command arrives for machine under maintenance. Tests lock enforcement. |
| Emergency Stop — Manual Trigger | safety | Operator triggers e-stop on the floor. Tests zone-wide halt propagation. |
| Low-Connectivity Edge Execution | connectivity | Device on intermittent 2G/satellite. Tests local policy caching and deferred sync. |
Scenario Lifecycle
- Seed —
POST /v1/industrial/scenarios/seed-builtinsloads all built-in scenarios. - List / Get —
GET /v1/industrial/scenariosor fetch by ID. - Run —
POST /v1/industrial/scenarios/{id}/runexecutes the scenario. - Results —
GET /v1/industrial/scenarios/runs/{run_id}/resultsretrieves step results and incidents. - Replay —
POST /v1/industrial/scenarios/runs/{run_id}/replayreproduces a past run deterministically. - Feedback —
PUT /v1/industrial/scenarios/runs/{run_id}/feedbackfor operator notes. - Learning Signals —
GET /v1/industrial/scenarios/learning-signalsexports structured outcomes for ML pipelines.
Industrial API Reference
All industrial endpoints live under /v1/industrial. Mutating operations
require the X-Operator-Token header. Read-only operations accept operator
or viewer tokens.
Site & Facility Management
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/industrial/sites | List all sites for a tenant. |
POST | /v1/industrial/sites | Create a site. |
GET | /v1/industrial/sites/{id} | Get site details. |
PATCH | /v1/industrial/sites/{id} | Update site metadata. |
POST | /v1/industrial/facilities | Create a facility within a site. |
POST | /v1/industrial/production-lines | Create a production line. |
Machine Management
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/industrial/machines | Register a machine. |
GET | /v1/industrial/machines/{id} | Get machine details. |
PATCH | /v1/industrial/machines/{id} | Update machine state or config. |
GET | /v1/industrial/machines/{id}/health | Get predictive maintenance health report. |
Telemetry
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/industrial/telemetry/ingest | Ingest a batch of telemetry readings. |
GET | /v1/industrial/telemetry | Query stored telemetry events. |
Safety Policies
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/industrial/safety-policies | Create a safety policy. |
GET | /v1/industrial/safety-policies | List safety policies. |
POST | /v1/industrial/safety-policies/{id}/evaluate | Evaluate a policy against a telemetry snapshot. |
Commands & Approvals
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/industrial/commands | Issue a command (runs full agent pipeline). |
GET | /v1/industrial/commands/{id} | Get command status and details. |
GET | /v1/industrial/commands/{id}/trace | Get the full execution trace (per-agent results). |
POST | /v1/industrial/commands/{id}/approve | Approve a pending command. |
POST | /v1/industrial/commands/{id}/reject | Reject a pending command. |
Incidents & Maintenance
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/industrial/incidents | List incidents for a tenant. |
POST | /v1/industrial/incidents | Create an incident manually. |
PATCH | /v1/industrial/incidents/{id} | Update incident status or resolution. |
POST | /v1/industrial/maintenance-windows | Create a maintenance window. |
GET | /v1/industrial/maintenance-windows | List maintenance windows. |
Scenario Lab
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/industrial/scenarios | List scenarios. |
POST | /v1/industrial/scenarios | Create a custom scenario. |
POST | /v1/industrial/scenarios/seed-builtins | Load all built-in scenarios. |
POST | /v1/industrial/scenarios/{id}/run | Execute a scenario. |
GET | /v1/industrial/scenarios/runs/{run_id}/results | Get run results and step details. |
POST | /v1/industrial/scenarios/runs/{run_id}/replay | Replay a past scenario run. |
GET | /v1/industrial/scenarios/runs/{run_id}/compare | Compare two runs side by side. |
GET | /v1/industrial/scenarios/learning-signals | Export learning signals for ML pipelines. |