← Back to Agent
Agent Deployment
Configure where and how this agent runs — cloud providers, Docker, VPS, local process management, knowledge bases, and lifecycle controls.
Overview
For Everyone
The Deployment tab is mission control for your agent's infrastructure. It answers three questions: Where does the agent run? Is it healthy? How do I control it? You can deploy agents to cloud platforms (Fly.io, AWS, GCP, Azure, Railway), run them in Docker containers, on your own servers, or locally on this machine. Once deployed, you can start, stop, restart, and monitor the agent from here.
For Developers
Deployment configuration is stored in engineAgent.config.deployment. The save mechanism is state-aware:
- Running agent —
POST /agents/:id/hot-update for live updates.
- Stopped agent —
PATCH /agents/:id/config for static config.
Lifecycle actions:
POST /agents/:id/deploy — Initiate deployment.
POST /agents/:id/stop — Stop the agent.
POST /agents/:id/restart — Restart the agent.
DELETE /bridge/agents/:id (via apiCall) — Permanent deletion with 5-step confirmation.
Knowledge bases: GET /knowledge-bases?agentId=…. Process manager detection: GET /system/process-managers. PM2 installation: POST /system/install-pm2.
How It Works
- Configure — Click "Edit" on the Deployment Status card. Select a target platform and fill in the required credentials and settings.
- Save — Save the deployment configuration. This doesn't deploy — it just stores the config.
- Deploy — Click "Deploy" to initiate the deployment process. The agent starts on the configured target.
- Monitor — The status card shows state (running, stopped, error), health, uptime, endpoint URL, and deployment details.
- Control — Use Stop, Restart, or Deploy buttons to manage the agent's lifecycle.
Key Concepts
Deployment Targets
Eight deployment targets are supported, each with platform-specific configuration:
| Target | Best For | Difficulty |
| Fly.io | Quick cloud deployment, auto-scaling | Easy |
| Railway | Simple PaaS deployment | Easy |
| Docker | Containerized environments | Medium |
| Local | Development and testing | Easy |
| AWS EC2 | Enterprise cloud, full control | Advanced |
| Google Cloud | GCP ecosystem integration | Advanced |
| Azure | Microsoft ecosystem integration | Advanced |
| VPS | Custom servers, bare metal | Medium |
Fly.io
Recommended for quick deployments. Configure:
- API Token — From
fly.io/user/personal_access_tokens.
- App Name — Auto-generated if empty.
- Organization — Fly.io org (default: "personal").
- VM Size — From Shared 1x ($1.94/mo) to Performance 8x ($232.36/mo).
- Region — 18 global regions with city names and codes.
AWS EC2
Full cloud deployment on Amazon Web Services:
- Credentials — Access Key ID and Secret Access Key.
- Region — 12 AWS regions from US East to South Africa.
- Instance Type — From t3.micro ($7.59/mo) to c5.xlarge ($122.40/mo).
- Optional — AMI ID, Subnet ID, Security Group, Key Pair Name.
Google Cloud GCE
- Project ID and Service Account Key (JSON).
- Region/Zone — 11 regions from US Central to South America.
- Machine Type — From e2-micro ($6.11/mo) to c2-standard-4 ($124.49/mo).
Microsoft Azure
- Subscription ID and Resource Group.
- Region — 15 regions globally.
- VM Size — From Standard_B1s ($7.59/mo) to Standard_E2s_v5 ($91.98/mo).
- Optional — Tenant ID, Client ID, Client Secret for service principal auth.
Railway
- API Token — From
railway.app/account/tokens.
- Project ID — Auto-created if empty.
- Service Name — Name for the Railway service.
Docker
- Image — Docker image name (default:
agenticmail/agent).
- Tag — Image tag (default:
latest).
- Ports — Comma-separated port mappings.
- Memory / CPU — Resource limits (e.g., 512m, 0.5 CPU).
- Network — Docker network name.
- Restart Policy — Unless Stopped, Always, On Failure, or Never.
VPS / Bare Metal
- Host — IP address or hostname.
- SSH Port — Default 22.
- User — SSH user (default: root).
- SSH Key Path — Path to private key.
- Work Directory — Where the agent runs on the server.
Local (In-Process)
For development and single-server deployments:
- Port — HTTP port the agent listens on. Validated in real-time (see below).
- Host — Hostname or IP (default: localhost).
- Process Manager — PM2 (with install detection), systemd, Manual, or In-Process (embedded).
- Process Name — PM2/systemd service name for lifecycle management.
- Working Directory — Auto-detected or manually specified.
Port Validation
When you enter a port number, the system automatically checks whether it's available before allowing you to save:
| Indicator | Meaning |
| Green border + checkmark | Port is available — you can save and deploy. |
| Red border + error | Port is already in use — save is blocked. The error shows which process is using it (e.g., "Port 3100 is in use by node (PID 12345)"). |
- Debounced — Validation triggers 500ms after you stop typing, preventing excessive API calls.
- Bind test — Uses
net.createServer() to attempt binding the port. This is the most reliable availability check.
- Process identification — If the port is in use, the system runs
lsof (macOS/Linux) or netstat (Windows) to identify the process name and PID.
- Save blocked — You cannot save deployment configuration while a port conflict exists.
API Reference
POST /system/check-port
Body: { "port": 4100 }
Response (available): { "available": true, "port": 3102 }
Response (in use): { "available": false, "port": 3102, "process": "node (PID 12345)" }
Tip: PM2 availability is auto-detected. If PM2 isn't installed, the dashboard offers a one-click "Install PM2" button.
Deployment Status
The status card shows:
- State — Running, Active, Deploying, Starting, Degraded, Error, Stopped, Draft, Ready. Color-coded.
- Health — Healthy, Degraded, or Unhealthy.
- Uptime — Time since last deployment.
- Endpoint — The agent's URL (clickable link).
- Target, Model, Region, Port — Current deployment configuration.
Lifecycle Controls
- Deploy — Available when stopped. Initiates the deployment process.
- Stop — Available when running. Gracefully stops the agent.
- Restart — Available when running or stopped. Stops and starts the agent.
Knowledge Bases
The Knowledge Bases card shows shared knowledge sources assigned to this agent. These provide the agent with organizational context and reference materials via RAG (Retrieval-Augmented Generation).
Auto-Assignment on Creation
When a new agent is created, knowledge bases are automatically assigned based on the agent's organization:
- Client org agents — Automatically get all knowledge bases belonging to their client organization.
- Internal agents — Automatically get all knowledge bases that are NOT assigned to any client organization (i.e., internal/shared KBs).
Sync Knowledge Button
If new knowledge bases are added after the agent was created, click the "Sync Knowledge" button in the card header to pick them up. This triggers the same auto-assignment logic:
- Scans all knowledge bases matching the agent's org context.
- Assigns any KBs the agent doesn't already have access to.
- Does NOT remove existing assignments — only adds new ones.
API Reference
POST /knowledge-bases/auto-assign/:agentId
Body: { "clientOrgId": "org-uuid" } // optional, auto-detected from agent
Response: { "agentId": "...", "assigned": ["kb-1", "kb-2"], "count": 2 }
For non-technical users: When you create a new knowledge base and want existing agents to access it, just go to the agent's Deployment tab and click "Sync Knowledge." The agent will immediately be able to search the new documents — no restart needed.
Agent Deletion
A 5-step confirmation flow prevents accidental deletion:
- Click "Delete Agent"
- Three confirmation steps with increasingly clear warnings
- Type the agent's name to confirm
- Final deletion via
DELETE /bridge/agents/:id
Danger: Agent deletion is permanent. All configuration, history, and data associated with the agent will be lost. This cannot be undone.
Best Practices
- Start with Local for development — Use local deployment while configuring and testing. Move to cloud for production.
- Use the smallest resource allocation that works — Start small and scale up based on actual usage. Most agents run fine on minimal resources.
- Choose a region close to your users — Lower latency means faster agent responses.
- Use PM2 for local production deployments — PM2 provides auto-restart, log management, and process monitoring.
- Never hard-code credentials in agent code — Use the deployment configuration for API keys and secrets. They're stored securely and injected at runtime.
- Test deployment config changes on a stopped agent first — Hot updates work but can cause brief disruptions. For major config changes, stop first.
- Monitor health status regularly — A "Degraded" status often precedes a full failure. Investigate early.
Troubleshooting
Deploy fails with authentication error
Verify your API token/credentials for the target platform. Tokens may have expired or been revoked. For AWS, ensure the IAM user has EC2 permissions.
Agent shows "Deploying" indefinitely
The deployment process may have stalled. Check the target platform's dashboard (Fly.io, AWS Console, etc.) for deployment logs. Try stopping and redeploying.
Local deployment can't find PM2
PM2 may not be installed or not in PATH. Use the "Install PM2" button in the deployment editor. If installation fails, install manually: npm install -g pm2.
Health status shows "Unhealthy"
The agent process may have crashed. Check logs on the deployment platform. Common causes: missing environment variables, incorrect model configuration, or insufficient memory.
Port is in use — can't save
The port validation detected another process using the port. Either change the port number or stop the conflicting process. The error message shows the process name and PID — you can stop it with kill <PID> or choose a different port. Common conflicts: another agent already running on that port, or a development server.
Delete confirmation name doesn't match
The typed name must match exactly (case-insensitive) with the agent's display name. Check the agent name shown in the header.