Deploying Trinity
Trinity runs your agents 24/7 with scheduling, monitoring, and multi-agent coordination. The platform is open source under the Apache 2.0 license — choose cloud-hosted for simplicity or self-hosted for complete control.
I Built a DevOps Agent That Deploys Other Agents
Apr 2026
Control My DGX Spark From Anywhere
Jan 2026
Cloud Hosted
ability.ai
- Zero infrastructure to manage
- Instant setup — deploy in 30 seconds
- Automatic updates and backups
- Pay-per-agent pricing
Best for: Teams who want to focus on building agents, not infrastructure.
Self Hosted
Your infrastructure
- Complete data sovereignty
- Data never leaves your perimeter
- Unlimited agents (free forever)
- Open source — Apache 2.0 license
- Full customization
Best for: Enterprises with compliance requirements or teams with DevOps capacity.
Option A: Cloud Hosted (ability.ai)
Create an account
Sign up at ability.ai
Get your MCP connection URL
After signup, go to Settings > API Keys and copy your MCP server URL.
Connect from Claude Code
/trinity:connectThe skill will ask for your connection URL and save it to your config.
Deploy your first agent
/trinity:onboardDone! Your agent is now running on ability.ai.
Option B: Self Hosted
The recommended way to deploy Trinity is using the Ops Agent — a Claude Code agent that walks you through picking a server, provisioning it, installing Trinity, and connecting, all in one session. Works for local installs and any cloud provider.
Deploy with the Ops Agent
Set up the Ops Agent
git clone https://github.com/abilityai/trinity-ops-public.git
cd trinity-ops-public
cp .env.example .env
# Leave SSH_HOST empty for local — or set it to your server IP
claudeRun /provision
/provisionChoose your provider — the agent reads the provider guide and walks you through every step: creating the VM, SSHing in, installing Trinity, configuring .env, starting services, and verifying health.
| Provider | Size | Cost |
|---|---|---|
| Hetzner ← cheapest | CX23 (2 vCPU, 4 GB) | €3.49/mo |
| DigitalOcean | s-2vcpu-4gb | $24/mo |
| AWS | t3.medium (2 vCPU, 4 GB) | ~$30/mo |
| Google Cloud | e2-medium (2 vCPU, 4 GB) | ~$40/mo |
| Localhost | Any OS with Docker | Free |
Connect from Claude Code
Once Trinity is running, create an MCP API key in Settings → Platform API Keys, then from any agent directory:
/trinity:connect
# When prompted:
# URL: http://<your-server>:8080/mcp
# API Key: (from Settings → Platform API Keys)Deploy your first agent
/trinity:onboardManual Installation
If you prefer to install without the ops agent — or are scripting a CI/CD pipeline:
Clone and configure
git clone https://github.com/abilityai/trinity.git
cd trinity
cp .env.example .envSet these four security-critical variables before first boot:
| Variable | How to set |
|---|---|
| SECRET_KEY | openssl rand -hex 32 |
| INTERNAL_API_SECRET | openssl rand -hex 32 |
| CREDENTIAL_ENCRYPTION_KEY | Auto-generated on first start if blank. Once set, do not change — encrypted credentials become unrecoverable. |
| ADMIN_PASSWORD | Strong password (min 12 chars) for the admin login. |
Port conflict: If :80 is taken, add FRONTEND_PORT=8090 to .env.
Build base image and start
./scripts/deploy/build-base-image.sh # Required before creating agents (5–10 min)
./scripts/deploy/start.sh # Starts all servicesOpen http://localhost and log in as admin with your password.
Key URLs (Self-Hosted)
| Service | URL |
|---|---|
| Web UI | http://localhost |
| Backend API docs | http://localhost:8000/docs |
| MCP Server | http://localhost:8080/mcp |
Managing Services (Self-Hosted)
# Start all services
./scripts/deploy/start.sh
# View backend logs
docker compose logs -f backend
# Rebuild platform services after code changes
docker compose build --no-cache backend frontend mcp-serverStopping services safely
Use docker compose stop to pause services while preserving agent containers and the agent network. Do NOT use docker compose down — it destroys agent containers and the agent network.
Health Verification
Run ./scripts/deploy/verify-platform.sh after any change. For manual probes:
| Service | Command |
|---|---|
| Backend | curl -sf http://localhost:8000/health |
| Scheduler | curl -sf http://localhost:8001/health |
| Frontend | curl -sf http://localhost |
| Redis | docker exec trinity-redis redis-cli ping |
| MCP Server | curl -sf http://localhost:8080/health |
| Vector | curl -sf http://localhost:8686/health |
Upgrading
# 1. Back up the database first
docker run --rm -v trinity_trinity-data:/data -v $(pwd):/backup alpine \
cp /data/trinity.db /backup/trinity.db.backup-$(date +%Y%m%d)
# 2. Pull latest changes
git pull origin main
# 3. Rebuild platform services (NOT the base image)
docker compose build --no-cache backend frontend mcp-server
# 4. Restart platform services
docker compose restart backend frontend mcp-server scheduler
# 5. Verify health
./scripts/deploy/verify-platform.shTo roll back: restore the DB backup → git checkout <previous-sha> → rebuild → restart.
Resource Thresholds
| Metric | Warning | Critical | Action |
|---|---|---|---|
| Agent context usage | >70% | >90% | Restart the agent |
| Host CPU | >70% | >90% | Scale down active agents |
| Host memory | >80% | >95% | Restart idle agents |
| Disk usage | >70% | >85% | Archive or prune logs |
| Container restarts | >3/hour | >10/hour | Check logs for crash loop |
| DB size | >500 MB | >1 GB | Run log archival |
Common Recovery Patterns
Agent stuck at >90% context
docker restart <agent-container-name>“network not found” error
docker rm <agent-container-name>
docker restart trinity-backendDatabase locked
Check for duplicate backend processes (should be exactly one):
docker ps | grep trinity-backendBackup Strategy
docker run --rm -v trinity_trinity-data:/data -v /your/backup/path:/backup alpine \
sh -c "cp /data/trinity.db /backup/trinity-$(date +%Y%m%d-%H%M%S).db"Retain 14 daily backups. The database contains agent state, schedules, chat history, and credentials metadata.
Managing a Running Instance (Ops Agent)
The trinity-ops-public repo is a Claude Code agent for day-to-day Trinity operations. It works against a local installation or any remote server over SSH — configured with a single .env file.
Quick Start
git clone https://github.com/abilityai/trinity-ops-public.git
cd trinity-ops-public
cp .env.example .env
# Edit .env — set SSH_HOST (leave blank for local), ADMIN_PASSWORD, MCP_API_KEY
# Test the connection before launching Claude Code
./scripts/status.sh
# Then launch the ops agent
claudeConnection Modes
| Mode | SSH_HOST | How commands run |
|---|---|---|
| Local | empty | Runs directly on this machine |
| Remote | IP or hostname | SSH (key or password auth from .env) |
Skills
| Skill | What it does |
|---|---|
| /status | Health check — backend, scheduler, containers, version |
| /logs <service> [lines] [errors] | View logs for any service or agent |
| /restart [service|all] | Restart services with health verification |
| /update | Pull latest, rebuild containers, restart, verify |
| /agents [list|start|stop|logs|exec] | Manage individual agent containers |
| /rebuild-agent <name|--all> | Rebuild agent container(s) from latest base image |
| /diagnose | Full error scan — logs, restarts, disk, DB integrity |
| /telemetry | CPU, memory, disk, and container resource stats |
| /rollback [commit] [backup] | Rollback to a previous commit + optional DB restore |
| /cleanup [--execute] | Prune Docker images, build cache, old backups |
| /provision [provider] | Step-by-step guide to provision a new cloud server |
Cloud Providers
Use /provision to walk through setup for any of these:
| Provider | Size | Cost |
|---|---|---|
| Hetzner ← cheapest | CX23 (2 vCPU, 4 GB) | €3.49/mo |
| DigitalOcean | s-2vcpu-4gb | $24/mo |
| AWS | t3.medium (2 vCPU, 4 GB) | ~$30/mo |
| Google Cloud | e2-medium (2 vCPU, 4 GB) | ~$40/mo |
| Localhost | Any OS with Docker | Free |
Key .env Variables
| Variable | Default | Purpose |
|---|---|---|
| SSH_HOST | empty | Server IP/hostname; empty = local |
| SSH_USER | ubuntu | SSH username |
| SSH_KEY | ~/.ssh/id_rsa | Private key path (or use SSH_PASSWORD) |
| TRINITY_PATH | ~/trinity | Trinity install dir on the server |
| ADMIN_PASSWORD | required | Trinity admin login password |
| MCP_API_KEY | — | MCP server API key |
| TUNNEL_FRONTEND | 13000 | Local port when SSH-tunneling to remote UI |
Detailed Deployment Guides
Step-by-step guides for each deployment scenario:
| Guide | What it covers |
|---|---|
| Local Development | Docker Desktop, dev compose, hot reload, auto-generated secrets |
| Single Server | Linux VPS, prod compose, all required env vars, Redis dual-password setup |
| Public Access | Cloudflare Tunnel, webhook surface, Slack/Telegram/WhatsApp integrations |
| Upgrading | Pre-flight → backup → rebuild → restart → verify → rollback |
| Backup and Restore | SQLite backup pattern, daily cron, restore procedure |
| Monitoring | Six-probe health check, resource thresholds, recovery patterns |
| Ops Agent | Automated day-to-day operations via trinity-ops-public |