A Practical Guide to Deploying an AI Agent Framework on a Cloud Server
This guide walks through deploying an open-source AI agent framework on a public cloud server so teams can share plugins, workspaces, and session history through a browser. It covers server sizing, runtime setup, systemd service management, HTTPS with Nginx and Certbot, team access control, firewall hardening, backups, monitoring, and common troubleshooting steps.
Why Deploy an Agent Framework on a Server
Open-source agent development frameworks support plugin-based extension, so features like multi-model integration, scheduled tasks, and code review can be combined as needed. By default, the framework runs on a single machine, and plugins, workspaces, and session records stay on that machine. Colleagues can’t access it, and you can’t check task progress while away from your desk.
Deploying the framework on a public cloud server solves both problems. The server stays online around the clock, and team members access the same address from a browser, sharing one set of plugins and workspaces. The trade-off is added operations work: system updates, certificate renewal, and access control. This article walks through each step in the order you would perform them.
The domain names, repository URLs, keys, and variable names in this article are examples. When working hands-on, follow the official documentation of the framework you use.
Step 1: Choose a Server and Prepare the System
Server sizing depends on team size. A 2-core, 2 GB RAM instance can support a small team of three to five people, as long as the plugin count is modest. After deployment, check memory usage with free -h and CPU load with top. If memory usage stays above 80%, or response times degrade noticeably during peak hours, upgrade to 4 cores and 8 GB.
For the operating system, Debian 12 or Ubuntu 22.04 LTS is recommended. Both have long-term support and stable packages.
After purchasing a cloud server, complete the following initial setup:
- Log in with an SSH key, not a password.
- Create a regular user for deploying and running services, instead of working as root.
- Update system packages.
sudo adduser deploysudo usermod -aG sudo deploysudo apt update && sudo apt upgrade -y
Step 2: Install the Runtime
Check the framework’s README to confirm whether it uses Python or Node.js, then install only the one it needs. Installing both is unnecessary and increases maintenance overhead.
Python-based frameworks require Python 3.10 or later:
sudo apt install -y python3 python3-venv python3-pip gitpython3 --version
Node.js-based frameworks require Node.js 18 or later. Install it through the official Node.js channels, or use the version manager specified in the framework’s documentation.
If your cloud provider or an operations panel offers a one-click install script, do not run remote scripts from unknown sources directly. Download the script first, inspect its contents, and compare it against the SHA256 hash published on the official release page:
curl -fsSLO https://official-domain/install.shsha256sum install.sh
Only proceed according to the official documentation after the hash matches.
Step 3: Fetch the Code and Install Dependencies
Create a deployment directory and clone the framework repository. Use the repository URL from the official documentation, and check out a released version tag rather than running on the main branch:
sudo mkdir -p /opt/ai-harnesssudo chown deploy:deploy /opt/ai-harnesscd /opt/ai-harnessgit clone <official repository URL> .git checkout <version tag>
After cloning, read the LICENSE file in the repository root and confirm the license permits your intended use.
For Python frameworks, install dependencies in a virtual environment to avoid affecting the system Python:
python3 -m venv .venvsource .venv/bin/activatepip install -r requirements.txt
For Node.js frameworks, install from the lockfile for reproducible results:
npm ci
Put configuration in a .env file. Never hardcode it into source code or commit it to the repository. The variable names below are examples only—replace them with the real names from the framework’s documentation:
HARNESS_HOST=127.0.0.1HARNESS_PORT=8080HARNESS_ACCESS_KEY=<a random value generated with openssl rand -hex 32>MODEL_API_KEY=<key provided by your model provider>
Setting the listen address to 127.0.0.1 means the framework only accepts local connections. External traffic enters Nginx first, which then forwards it to the framework. This way, port 8080 is never exposed directly to the public internet.
Restrict .env file permissions so only the deploy user can read it:
chmod 600 /opt/ai-harness/.env
Step 4: Manage the Process with systemd
A manually started process won’t recover automatically after it exits or after a server reboot. systemd solves this. Create a service file:
sudo nano /etc/systemd/system/ai-harness.service
Write the following content. If the framework uses Node.js, change ExecStart to the start command from its documentation, such as /usr/bin/npm run start:
[Unit]Description=AI Harness serviceAfter=network.target[Service]User=deployWorkingDirectory=/opt/ai-harnessEnvironmentFile=/opt/ai-harness/.envExecStart=/opt/ai-harness/.venv/bin/python main.py startRestart=on-failureRestartSec=5[Install]WantedBy=multi-user.target
Enable and start the service:
sudo systemctl daemon-reloadsudo systemctl enable --now ai-harnesssudo systemctl status ai-harness
Confirm the service responds locally:
curl -I http://127.0.0.1:8080
An HTTP status code in the response means the service is running. If the connection is refused, check recent logs with journalctl -u ai-harness -n 100.
Step 5: Configure the Domain and HTTPS
At your domain registrar or DNS provider, add an A record pointing to the server’s public IP—for example, pointing ai.example.com to the server. DNS propagation typically takes from a few minutes to a few hours, depending on the provider.
Install Nginx and Certbot:
sudo apt install -y nginx certbot python3-certbot-nginx
Request a Let’s Encrypt certificate. The process requires port 80 to be reachable from the public internet for domain validation. Certbot writes the certificate paths into the configuration automatically, so you don’t need to fill them in manually:
sudo certbot --nginx -d ai.example.com
If you use an operations panel, use the certificate feature it provides and follow the certificate paths shown there.
Certbot generates the HTTPS server block. It’s best to only modify its location section and add the reverse proxy configuration there. Don’t create a second configuration with the same domain name, or Nginx will conflict on the duplicate server_name:
location / {proxy_pass http://127.0.0.1:8080;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";}
Test the configuration and reload Nginx:
sudo nginx -t && sudo systemctl reload nginx
Certificates renew automatically. Verify the renewal flow with:
sudo certbot renew --dry-runsystemctl list-timers | grep certbot
Step 6: Team Onboarding and Permissions
When a team shares one instance, account management is where problems most often occur. Create a separate account for each member instead of having everyone share the HARNESS_ACCESS_KEY. Once a shared key leaks, there’s no way to trace who did what.
First, confirm whether the framework supports multiple users and permission assignment. If it only supports a single access key, the team has to share it. In that case, limit access scope and rotate the key regularly.
The recommended process:
- List the members who need access, and only create accounts for those who genuinely need it.
- Assign plugin and workspace permissions based on job responsibilities, defaulting to least privilege.
- If the framework provides audit logs, enable them to record who performed which operation and when.
- Disable a member’s account the same day they leave the team.
- Review accounts and permissions quarterly, and remove accounts that are no longer used.
Step 7: Firewall and Security Hardening
Configure both the cloud provider’s security group and the firewall inside the server. Only open the necessary ports: 22 for SSH, and 80 and 443 for web access. Port 8080 must not be open to the public internet.
Using ufw as an example:
sudo ufw default deny incomingsudo ufw default allow outgoingsudo ufw allow OpenSSHsudo ufw allow 'Nginx Full'sudo ufw enable
Two things to note. First, allow SSH before enabling the firewall, otherwise you may lock yourself out of the server. Second, don’t set the outbound default to deny. The framework needs to reach the model provider’s API, Certbot needs to reach the certificate authority for renewals, and system updates depend on outbound connections. Blocking all outbound traffic breaks all three. If you truly need to restrict outbound traffic, allow only these destinations and validate the rules in a test environment first.
Harden SSH as well. Confirm key-based login works before disabling password login. Create a new config file under /etc/ssh/sshd_config.d/ containing PasswordAuthentication no, then run sudo sshd -t to check the syntax and restart the SSH service. Keep one logged-in session open after the change, verify the new configuration works from a new terminal, and only then close the old session.
Enable automatic security updates:
sudo apt install -y unattended-upgradessudo dpkg-reconfigure -plow unattended-upgrades
Step 8: Backup and Monitoring
The framework’s data directory and the .env file need regular backups. Below is an example script—confirm the actual data directory name (data here) against the framework’s documentation:
#!/bin/bashset -eBACKUP_DIR=/var/backups/ai-harnessDATE=$(date +%F)mkdir -p "$BACKUP_DIR"tar -czf "$BACKUP_DIR/ai-harness-$DATE.tar.gz" -C /opt/ai-harness .env datafind "$BACKUP_DIR" -name 'ai-harness-*.tar.gz' -mtime +7 -delete
Save the script to /home/deploy/backup.sh and make it executable. Then add a cron job with crontab -e to run it daily at 3 AM:
0 3 * * * /home/deploy/backup.sh
Local backups can’t protect against server failure. Use rclone or scp to copy backup files to another storage device or object storage.
Backups are only valuable if they can be restored. Run a restore drill once a month: extract the archive to a temporary directory and verify the data is intact:
mkdir -p /tmp/restore-testtar -xzf /var/backups/ai-harness/ai-harness-<latest date>.tar.gz -C /tmp/restore-testls -la /tmp/restore-test
Monitoring has two layers. Cloud providers typically offer CPU, memory, and disk monitoring with alerts—set thresholds directly in the console. For service availability, use an external HTTP monitoring service that periodically accesses https://ai.example.com and sends a notification when the service is abnormal. On the server itself, run df -h periodically to check disk space.
Troubleshooting Common Issues
Issue 1: The site is unreachable from outside
Check the following in order:
- Whether the local service is running:
sudo systemctl status ai-harness - Whether the framework is listening on port 8080:
sudo ss -tlnp | grep 8080 - Whether the Nginx configuration is valid:
sudo nginx -t - Whether the firewall and cloud security group allow ports 80 and 443:
sudo ufw status - The Nginx error log:
sudo tail -n 50 /var/log/nginx/error.log
Issue 2: Certificate renewal fails
First, confirm the domain resolves to the current server: dig +short ai.example.com. The result should match the server’s public IP. Then confirm port 80 is reachable from outside, and check the renewal log: sudo tail -n 100 /var/log/letsencrypt/letsencrypt.log. After fixing the problem, run sudo certbot renew --dry-run to verify again.
Issue 3: Slow responses when multiple people use it at once
Check CPU usage with htop and memory with free -h. If resources are sufficient, the bottleneck may be latency from the model provider’s API—check the framework logs for the duration of each model call. If resources are genuinely insufficient, upgrade to 4 cores and 8 GB. Only integrate Redis if the framework supports external caching; don’t configure it just for the sake of it.
Issue 4: The service doesn’t come back after a server reboot
Run sudo systemctl status ai-harness to check the status, then review startup logs with journalctl -u ai-harness -n 100. Common causes are a wrong .env path or insufficient file permissions. Confirm the deploy user can read .env, then run sudo systemctl restart ai-harness.
Final Thoughts
Once deployed, the team accesses the same environment through a single address, and you can check task progress from a phone browser while on the go. These benefits all depend on solid operations, so access control, certificate renewal, and backups require ongoing maintenance.
Actual go-live time depends on factors like DNS propagation speed, certificate issuance, and team account setup, and varies considerably across environments. It’s a good idea to run a pilot first with a test domain and two or three members, confirm everything works, and then open it up to the whole team.
