Skip to main content
chudi.dev

Run Your AI Agent on a VPS: The $6/Month Always-On Setup

Published Chudi Nnorukam 6 min read

Your AI agent dies when your laptop sleeps. The $6-25/month VPS setup I use to run trading agents 24/7: specs, systemd, and when latency justifies more.

Why this matters

An AI agent that only runs while your laptop is awake is a demo, not a system. My trading agents have run 24/7 on a $6/month DigitalOcean Droplet since March 2026 (23 real trades, 69.6% win rate, ~200MB of the 1GB RAM), with one latency-sensitive workload on QuantVPS. The pattern is the same for the autonomous SEO agents people are now running: a small Linux VPS, systemd to keep the loop alive, state on disk, and a heartbeat so silence is detectable. Total infrastructure cost: $6-25/month plus your model API bill.

Every week now someone posts an agent that “ran a website” or “traded while I slept.” Underneath every one of those demos is the same unglamorous fact: the agent lived on a server that never turned off. Daniel Foley’s autonomous SEO agent, the one that took a test site to #1 in Google, ran its entire test-implement-wait-review loop from a $10-20/month VPS, not from his laptop.

My agents are trading bots rather than SEO bots, but the infrastructure is identical, and I have been running it in production since March 2026. This post is the setup: what a small VPS can and cannot carry, how to make the loop survive crashes, and the two specific boxes I pay for.

Why does an AI agent need a VPS instead of your laptop?

Because an agent is a loop, and a loop is only as reliable as the machine that hosts it.

A laptop sleeps when you close the lid, reboots for updates, and drops off the network when you leave the house. For a chat session none of that matters. For an agent that polls a market every 30 seconds, watches Search Console daily, or waits three days to review the effect of its last change, every interruption is either missed work or corrupted state.

Serverless looks like the modern answer and is the wrong shape for most agent loops: execution time limits fight long polling, cold starts fight schedules, and persistent state (the agent’s memory files, its cursor into a job queue, its logs) has to be bolted on externally. If your process idles near zero and spikes rarely, metered platforms are fine; I wrote up that trade-off in VPS providers compared. But an agent that never sleeps wants a machine that never sleeps, at a flat price.

A VPS is the boring middle ground: a real Linux box, root access, always on, $6/month. Boring is what you want under an autonomous process.

What specs does an AI agent actually need?

Less than you think, as long as the model runs via API. The LLM does its thinking on Anthropic’s or OpenAI’s hardware; your VPS only hosts the loop around it.

Agent workloadSpecs that carry itMonthly cost
API-calling agent loop (trading signals, SEO tasks, monitors)1 vCPU, 1GB RAM$6 (DigitalOcean Droplet)
Agent + headless browser or heavy dependencies1-2 vCPU, 2GB RAM$12-18
Latency-sensitive execution (live order fills)Specialized low-latency VPS~$25+ (QuantVPS)
Local model inference8GB+ RAM or GPU instanceDifferent article entirely

My production number, for calibration: the Polymarket trading bot ran four months on the $6 Droplet, executed 23 real trades at a 69.6% win rate, and used roughly 200MB of the 1GB RAM. The full build is in how I built the Polymarket trading bot; the deployment walkthrough is in deploy a Python agent on DigitalOcean.

How do you keep an agent alive 24/7?

Not with tmux, not with nohup, and not with a terminal you promise yourself you won’t close. Those all share the same failure mode: the process dies and nothing notices.

The answer is a systemd service:

# /etc/systemd/system/my-agent.service
[Unit]
Description=my agent loop
After=network-online.target

[Service]
User=agent
WorkingDirectory=/home/agent/my-agent
ExecStart=/home/agent/my-agent/.venv/bin/python main.py
Restart=always
RestartSec=10
EnvironmentFile=/home/agent/my-agent/.env

[Install]
WantedBy=multi-user.target

systemctl enable --now my-agent and the loop now survives crashes, reboots, and closed SSH sessions. Three habits turn this from “a script on a server” into an agent you can trust unattended:

  • State on disk, not in context. Memory files, task cursors, and decision logs live in the working directory. The process should be able to die mid-cycle and resume from disk without losing the plot. This is the same principle that makes Foley-style agents work: the self-updating memory file is the agent; the process is disposable.
  • A heartbeat every cycle. One log line per loop iteration with a timestamp. Silence for two intervals means something is wrong, and you can detect it with a five-line cron instead of discovering it a month later. I learned this one the expensive way on a trading box that went quiet.
  • Keys in an EnvironmentFile, never in code. Your model API key and any exchange or service credentials sit in a root-readable .env on the box, out of the repo.

When is a $6 box not enough?

When a measured constraint says so, and almost never before.

The honest upgrade triggers I have actually hit:

  1. Latency. My market-execution workload needed consistent 3-5ms fills, which a general-purpose droplet cannot promise. That single workload moved to QuantVPS, a VPS built for trading bots and priced accordingly. Everything that is not latency-sensitive (monitors, dashboards, the slow loops) stayed on the $6 Droplet. Both were my real stack before either was an affiliate link.
  2. RAM, if you add a browser. Headless Chrome for scraping or UI testing roughly doubles what the box needs. That is a $12 problem, not a specialized-VPS problem.
  3. Local models. The moment you want weights on your own hardware, stop reading VPS pricing pages and start reading GPU pricing pages.

What has never been the trigger: the agent “feeling slow.” An API-calling loop spends its time waiting on the model API and on its own schedule. A bigger VPS does not make Claude answer faster.

What does it actually cost per month?

The server is the cheap part, and it is worth saying plainly because the demos usually don’t:

  • VPS: $6-25 depending on the tier above.
  • Model API: the real variable. An agent that runs one thoughtful loop per hour costs dollars per month; an agent that polls a frontier model every 30 seconds can cost hundreds. Budget the loop frequency first. My token-burn breakdown is in 10 patterns that burn your Claude quota.
  • Tooling: optional. Foley’s stack added a $60/month SEO data MCP; my trading stack’s equivalent is exchange API access. Start without paid tooling and add it when the agent’s output justifies it.

An always-on agent under $10/month of infrastructure is genuinely available to anyone. The discipline is in the loop design and the verification, not the hosting bill.

How do I set this up in 30 minutes?

  1. Create the $6 Droplet (Ubuntu LTS), add your SSH key.
  2. Create a non-root agent user; clone your agent repo into its home.
  3. Put the model API key and any service credentials in .env.
  4. Install the systemd unit above; systemctl enable --now it.
  5. Add the heartbeat check: a cron that alerts you if the log goes quiet.
  6. Walk away. That is the point.

The step-by-step with the sharp edges (Python venvs, firewalls, log rotation) is in the DigitalOcean deployment guide. If you are choosing between providers first, the production comparison is in VPS providers compared.

The agents getting attention right now differ in what they automate. They agree completely on where they live.

· Frequently asked

FAQ

Can I run an AI agent on a $6 VPS?

Yes, if the model runs via API. A 1GB Droplet runs a Python or Node agent loop, its scheduler, and logging in a few hundred MB. What it cannot do is run local model weights; agents that call Claude, GPT, or another hosted API do all the heavy lifting off-box, so the VPS only needs to keep the loop alive.

Why not just run the agent on my laptop or a serverless function?

Laptops sleep, reboot, and change networks, which kills long-running loops and breaks anything stateful. Serverless caps execution time and makes persistent state and long polling awkward. A VPS is the boring middle: always on, full root, flat monthly price, state on a real disk.

What specs does an AI agent actually need?

For an API-calling agent: 1 vCPU and 1GB RAM is enough, and 2GB buys headroom for a browser or heavier dependencies. Latency-sensitive agents (live trading execution) justify a specialized low-latency VPS. Local inference changes the math entirely and starts around 8GB+ RAM or a GPU instance.

How do I keep the agent running after I close SSH?

Run it as a systemd service with Restart=always and a heartbeat line in its log every cycle. The service survives crashes, reboots, and closed SSH sessions, and the heartbeat means a silent failure is visible within one loop interval instead of weeks later.

· Sources & further reading

Sources & Further Reading

Further reading

What do you think?

I post about this stuff on LinkedIn every day and the conversations there are great. If this post sparked a thought, I'd love to hear it.

Discuss on LinkedIn