The Easy Way: Let Claude Code Do It
I have deployed agents on hundreds of servers. Most of that work is repetitive: install packages, write config files, set up process supervision, configure secrets. It is the kind of work that an AI assistant handles better than you do, because it does not skip steps or mistype paths.
Claude Code is Anthropic's CLI tool. It can SSH into a remote server and execute commands on your behalf. Point it at your osModa server, tell it what you want deployed, and it handles the rest.
Point Claude Code at your server. Tell it what you want. It builds, configures, and deploys.
What you say to Claude Code:
"SSH into root@203.0.113.42. Clone my agent from github.com/myorg/my-agent. Install Python 3.12, set up a venv, install requirements. Create a systemd service that runs main.py and restarts on failure. Load API keys from /root/.env. Open port 8080 for the health check endpoint. Verify it's running."
Claude Code will SSH in, run the commands, write the service file, enable it, and confirm the agent is live. If something fails, it reads the error output and fixes it. You watch the whole thing happen in your terminal.
This is not a gimmick. It is genuinely how deployment works now. The instructions you would type into a terminal are the same instructions you give to Claude Code in plain English. It just executes them faster and more reliably than you would at 2 AM after your third coffee.
If you are using an osModa server, the machine comes pre-configured with NixOS and the osModa agent stack. Claude Code just needs to deploy your code on top of it. The self-healing, monitoring, and mesh networking are already running. That makes the Claude Code workflow even simpler: you are deploying onto infrastructure that already knows how to keep agents alive.
The Manual Way: Step by Step
If you want to understand every layer, or you just prefer doing things yourself, here is the shortest path from zero to a running agent. I am assuming you have a VPS from osModa or any cloud provider.
1. Get a Server
Provision a VPS. For API-calling agents (calling GPT-4, Claude, etc.), 2 vCPU and 4 GB RAM is enough. osModa plans start at $14.99/month on dedicated Hetzner hardware. If you are going bare, Hetzner or DigitalOcean will do.
2. SSH In and Set Up the Runtime
ssh root@your-server-ip # Update and install your runtime apt update && apt upgrade -y apt install -y python3.12 python3.12-venv git # Clone and set up your agent git clone https://github.com/your-org/your-agent.git ~/agent cd ~/agent python3.12 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
3. Set Up Secrets
# Store API keys in a secured env file cat << 'EOF' > /root/.env OPENAI_API_KEY=sk-... ANTHROPIC_API_KEY=sk-ant-... EOF chmod 600 /root/.env
4. Create a Systemd Service
This keeps the agent running after you disconnect and restarts it on crash or reboot.
# /etc/systemd/system/agent.service [Unit] Description=AI Agent After=network-online.target [Service] Type=simple WorkingDirectory=/root/agent EnvironmentFile=/root/.env ExecStart=/root/agent/.venv/bin/python main.py Restart=always RestartSec=5 [Install] WantedBy=multi-user.target
systemctl daemon-reload systemctl enable agent.service systemctl start agent.service systemctl status agent.service
5. Verify
Check journalctl -u agent.service -f to tail the logs. Hit the health endpoint if your agent has one. Close the SSH session. Reconnect an hour later and confirm the agent is still running. That is the whole deployment. Five commands, one config file.
For more on agent frameworks and how they affect deployment, see our framework comparison. If you want your agent running 24/7, that guide covers the persistence side in detail.
Why Agents Need Their Own VPS
Shared hosting kills agents. I have watched it happen dozens of times. An agent starts fine on a shared instance, then another tenant spikes CPU, your agent's API calls start timing out, the retry logic floods the queue, and the whole thing collapses. Shared environments create failure modes that are invisible until they destroy your uptime.
AI agents are not web servers. They hold state. They maintain long-running connections. They consume memory in unpredictable bursts. They need to be restarted intelligently, not just killed and re-spawned like a stateless container. A dedicated VPS gives you isolated resources, persistent disk, and a stable network identity.
The difference between a flaky agent and a reliable one is almost never the code. It is the infrastructure underneath. See our deployment guide for the full argument on why dedicated machines matter for persistent AI workloads.
What osModa Gives You Out of the Box
When you deploy on osModa, the server is not a blank VPS. It is a purpose-built agent runtime. Everything below is already configured when you SSH in for the first time.
Self-healing watchdog — Your agent crashes, the watchdog catches it within seconds and restarts it. Silent hangs get detected too. Not just a systemd restart — actual health-aware recovery with crash-loop protection. Read more on self-healing agent servers.
Tamper-proof audit ledger — Every agent action, crash, and recovery is logged in a SHA-256 hash-chained ledger. Useful for debugging, and required if you need SOC 2 or HIPAA compliance.
P2P mesh networking — If you run multiple agents across servers, they communicate over an encrypted mesh. Post-quantum cryptography (Noise_XX + ML-KEM-768). No central broker.
NixOS atomic rollback — Every deployment creates a new system generation. Bad deploy? Roll back in seconds. The entire OS state is versioned, not just your application code.
You still get full root SSH access. It is your machine. osModa just means the tedious infrastructure work is already done when you arrive. Visit spawn.os.moda to spin one up, or read more about agent hosting.
Frequently Asked Questions
Can Claude Code really set up a full production server?
Yes. Claude Code can SSH into a remote machine, install packages, write configuration files, set up systemd services, and verify everything works. It handles the tedious parts of server setup that you would otherwise do by hand. You stay in control the entire time — it executes commands on your behalf and explains what it is doing.
How much does it cost to deploy an AI agent on a VPS?
A basic VPS for a lightweight agent starts at $5-20/month from providers like Hetzner. osModa managed hosting starts at $14.99/month and includes self-healing, audit logging, mesh networking, and NixOS rollback on top of a dedicated Hetzner server.
Why not just use a container platform like Railway or Fly.io?
Container platforms work for stateless web services. AI agents are different — they maintain long-running state, need persistent connections, and often require more memory and CPU than container platforms allocate cheaply. A VPS gives you a dedicated machine with predictable performance and no cold starts.
What VPS specs does an AI agent need?
For agents calling external APIs (GPT-4, Claude, etc.): 2 vCPU, 4 GB RAM, 40 GB SSD. For agents running local models: 4+ vCPU, 16+ GB RAM. Always provision 30% more RAM than your peak usage.