We buy the servers we test with our own money. Some links are affiliate links; they never change a verdict. Disclosure · How we test
To host an AI agent 24/7 you need three things: a supervisor that restarts it, enough RAM for its peak rather than its idle, and a decision on where the model runs. If the model is an API, a 6.64 € Hetzner CX23 (2 vCPU, 4 GB) is enough: our n8n agent runtime peaked at 1003.0 MiB under 50 concurrent requests. If the model runs on the same box, Llama 3.1 8B needs at least 8 GB; on 4 GB it was killed by the kernel.
This matters now because agents moved from notebooks to things that answer webhooks, watch inboxes and run on schedules. Hosted agent platforms are multiplying and the prices on their landing pages rarely say what hardware you get. We rented the servers, ran n8n and Ollama on them and kept the numbers.
Verdict
For an agent that calls a model API, rent a Hetzner CX23 at 6.64 €: n8n handled 15.04 executions/s with zero failed requests on it. For an agent with a local model, rent a CX43 at 19.35 €: it ran Llama 3.1 8B at 9.7 tokens/s using 6023 MiB, leaving room for n8n beside it.
Tested in the Lab Hetzner CX23, CX33, CX43, CAX11, CAX21 · Nov 2026
This guide is part of our self-hosted LLM section. If you only need a model server without an agent, see Ollama on a VPS.
What "always on" actually requires
An agent is a loop: it waits for a trigger (a webhook, a cron schedule, a new message), calls a model, maybe calls tools, and writes a result. Running it 24/7 is less about speed and more about not dying quietly. The checklist:
- Process supervision. Something must restart the agent after a crash and after a reboot. In Docker that is a restart policy; for a bare process it is systemd.
- RAM for the peak. Agents spike when several triggers arrive at once or when a payload is large. Our test servers had no swap configured (0 MiB), so running out of memory meant the kernel's OOM killer stopped a process. OOM is "out of memory".
- A model that is ready. A local model must be loaded in RAM to answer quickly. An API model must have a key, a budget cap and a retry plan.
- Logs and a heartbeat. You want to know it stopped before your users tell you.
- Memory leaks under control. A long-running Python or Node process can grow slowly. A scheduled restart or a memory limit in the supervisor keeps it bounded.
Supervision: the exact settings
Docker: restart policies
Our production n8n compose file sets restart: unless-stopped on both containers:
services:
postgres:
image: postgres:16
restart: unless-stopped
n8n:
image: docker.n8n.io/n8nio/n8n:2.46.6
restart: unless-stopped
Docker's docs define the options: no is the default and never restarts; on-failure restarts after a non-zero exit code; always restarts whenever the container stops; unless-stopped is like always except a container you stopped by hand stays stopped, even after the Docker daemon restarts. One trap: "A restart policy only takes effect after a container starts successfully", which Docker defines as being up for at least 10 seconds. An agent that crashes on start loops in a broken state rather than recovering, so check docker compose ps after deploying.
systemd: for a Python or Node agent
For a LangChain, CrewAI or AutoGen script running as a plain process, systemd is already on every Ubuntu server. Its manual lists the Restart= values no, on-success, on-failure, on-abnormal, on-watchdog, on-abort and always; the default is no, and RestartSec= defaults to 100 ms. A minimal unit, using only those documented options plus standard fields:
[Unit]
Description=My AI agent
After=network-online.target
[Service]
WorkingDirectory=/opt/agent
ExecStart=/opt/agent/venv/bin/python agent.py
Restart=always
RestartSec=5
User=agent
[Install]
WantedBy=multi-user.target
Save it as /etc/systemd/system/agent.service, then run systemctl daemon-reload and systemctl enable --now agent. Logs: journalctl -e -u agent.
Ollama itself
Ollama's Linux docs give a service unit with Restart=always and RestartSec=3, and logs via journalctl -e -u ollama. On our servers, the official install script left Ollama answering on port 11434 straight away. To change its settings, the FAQ says to run systemctl edit ollama.service and add an Environment line under [Service].
While you are in systemd land: on Ubuntu 24.04 and newer, sshd runs via ssh.socket, so systemctl reload ssh fails with "ssh.service is not active" even though new connections already use your new SSH config. We hit it on every test server. Our hardening steps are in securing an Ubuntu VPS.
Sizing the agent runtime: our n8n numbers
n8n is a common agent runtime: its AI Agent node calls a model and tools from a workflow, and webhooks or schedules trigger it. We ran n8n 2.46.6 with Postgres 16 on five Hetzner servers and hit a webhook → Code node → response workflow at 1, 10, 25 and 50 concurrent requests:
| Server | Concurrent requests | Executions/s | Median | p95 | Failed | n8n peak RAM |
|---|---|---|---|---|---|---|
| Hetzner CX232 vCPU · 4 GB · x86_64 | 1 | 10.1 | 104 ms | 162 ms | 0 | 520 MiB |
| Hetzner CX232 vCPU · 4 GB · x86_64 | 10 | 14.8 | 697 ms | 893 ms | 0 | 660 MiB |
| Hetzner CX232 vCPU · 4 GB · x86_64 | 25 | 15.0 | 1,651 ms | 1,936 ms | 0 | 825 MiB |
| Hetzner CX232 vCPU · 4 GB · x86_64 | 50 | 14.2 | 3,445 ms | 3,954 ms | 0 | 1,003 MiB |
| Hetzner CX334 vCPU · 8 GB · x86_64 | 1 | 13.5 | 72 ms | 133 ms | 0 | 543 MiB |
| Hetzner CX334 vCPU · 8 GB · x86_64 | 10 | 31.9 | 311 ms | 438 ms | 0 | 574 MiB |
| Hetzner CX334 vCPU · 8 GB · x86_64 | 25 | 29.5 | 841 ms | 986 ms | 0 | 803 MiB |
| Hetzner CX334 vCPU · 8 GB · x86_64 | 50 | 30.1 | 1,647 ms | 1,846 ms | 0 | 1,050 MiB |
| Hetzner CX438 vCPU · 15 GB · x86_64 | 1 | 14.6 | 78 ms | 123 ms | 0 | 546 MiB |
| Hetzner CX438 vCPU · 15 GB · x86_64 | 10 | 36.1 | 280 ms | 341 ms | 0 | 544 MiB |
| Hetzner CX438 vCPU · 15 GB · x86_64 | 25 | 35.0 | 714 ms | 800 ms | 0 | 694 MiB |
| Hetzner CX438 vCPU · 15 GB · x86_64 | 50 | 32.4 | 1,539 ms | 1,682 ms | 0 | 1,016 MiB |
| Hetzner CAX112 vCPU · 4 GB · aarch64 | 1 | 10.3 | 113 ms | 156 ms | 0 | 585 MiB |
| Hetzner CAX112 vCPU · 4 GB · aarch64 | 10 | 13.9 | 755 ms | 934 ms | 0 | 640 MiB |
| Hetzner CAX112 vCPU · 4 GB · aarch64 | 25 | 12.9 | 1,909 ms | 2,279 ms | 0 | 729 MiB |
| Hetzner CAX112 vCPU · 4 GB · aarch64 | 50 | 13.2 | 3,786 ms | 4,114 ms | 0 | 1,038 MiB |
| Hetzner CAX214 vCPU · 8 GB · aarch64 | 1 | 12.0 | 107 ms | 128 ms | 0 | 539 MiB |
| Hetzner CAX214 vCPU · 8 GB · aarch64 | 10 | 25.4 | 402 ms | 528 ms | 0 | 579 MiB |
| Hetzner CAX214 vCPU · 8 GB · aarch64 | 25 | 25.8 | 965 ms | 1,106 ms | 0 | 824 MiB |
| Hetzner CAX214 vCPU · 8 GB · aarch64 | 50 | 24.5 | 2,019 ms | 2,197 ms | 0 | 859 MiB |
Measured by AI Hosting Lab on 2026-11-05 · 5 servers · method · raw data
Idle, n8n used 402.7 MiB on the CX23 and Postgres 58.75 MiB. Under 50 concurrent requests, n8n peaked at 1003.0 MiB on the CX23 and at 1038.3 MiB on the ARM CAX11, with zero failed requests on every server. (MiB is a mebibyte, 1,048,576 bytes.) For an agent whose model sits behind an API, the runtime is light: the 4 GB plans are enough, and the work is mostly waiting on the API.
Throughput is rarely your limit for an agent. The CX23 managed 15.04 executions/s with our tiny workflow. A real agent run that waits several seconds for a model answer will be far slower per run, and that waiting costs no CPU.
Sizing a local model: our Ollama numbers
We ran Ollama natively, CPU only, with Llama 3.2 1B, Llama 3.2 3B and Llama 3.1 8B (the default q4 quantization from the Ollama library), a 256-token answer at temperature 0. Tokens/s is how many tokens (word pieces) the model writes per second.
| Server | Model | Generation tokens/s | Prompt tokens/s | Load time | RAM used (system) | Note |
|---|---|---|---|---|---|---|
| Hetzner CX232 vCPU · 4 GB · x86_64 | Llama 3.2 1B | 10.3 | 454.0 | 3.5 s | 2,001 MiB | |
| Hetzner CX232 vCPU · 4 GB · x86_64 | Llama 3.2 3B | 5.8 | 325.2 | 8.8 s | 3,002 MiB | |
| Hetzner CX232 vCPU · 4 GB · x86_64 | Llama 3.1 8B | did not run | – | – | – | OOM-killed after ~50 s: Ollama fit check reported it would leave 1698 MiB free, |
| Hetzner CX334 vCPU · 8 GB · x86_64 | Llama 3.2 1B | 23.2 | 1,322.8 | 2.0 s | 2,205 MiB | |
| Hetzner CX334 vCPU · 8 GB · x86_64 | Llama 3.2 3B | 13.5 | 776.5 | 3.7 s | 3,068 MiB | |
| Hetzner CX334 vCPU · 8 GB · x86_64 | Llama 3.1 8B | 6.3 | 258.6 | 10.0 s | 5,941 MiB | |
| Hetzner CX438 vCPU · 15 GB · x86_64 | Llama 3.2 1B | 37.5 | 1,910.9 | 1.7 s | 2,293 MiB | |
| Hetzner CX438 vCPU · 15 GB · x86_64 | Llama 3.2 3B | 21.2 | 1,161.3 | 3.7 s | 3,196 MiB | |
| Hetzner CX438 vCPU · 15 GB · x86_64 | Llama 3.1 8B | 9.7 | 447.4 | 7.9 s | 6,023 MiB | |
| Hetzner CAX112 vCPU · 4 GB · aarch64 | Llama 3.2 1B | 15.0 | 835.5 | 4.8 s | 2,203 MiB | |
| Hetzner CAX112 vCPU · 4 GB · aarch64 | Llama 3.2 3B | 6.5 | 376.4 | 6.0 s | 3,214 MiB | |
| Hetzner CAX112 vCPU · 4 GB · aarch64 | Llama 3.1 8B | did not run | – | – | – | llama-server process has terminated: exit status 1: ggml_aligned_malloc: insuffi |
| Hetzner CAX214 vCPU · 8 GB · aarch64 | Llama 3.2 1B | 26.8 | 1,427.1 | 3.2 s | 2,315 MiB | |
| Hetzner CAX214 vCPU · 8 GB · aarch64 | Llama 3.2 3B | 12.2 | 664.1 | 5.2 s | 3,282 MiB | |
| Hetzner CAX214 vCPU · 8 GB · aarch64 | Llama 3.1 8B | 5.7 | 226.5 | 12.3 s | 5,796 MiB |
Measured by AI Hosting Lab on 2026-11-05 · 5 servers · method · raw data
Three results decide the server:
- Llama 3.1 8B does not run on 4 GB. On the x86 CX23, Ollama's fit check reported it would leave 1698 MiB free, then the kernel OOM killer stopped llama-server after about 50 seconds. On the ARM CAX11 it failed at once while trying to allocate 4402.48 MB.
- On 8 GB it runs, but slowly. 6.3 tokens/s on the CX33 with 5941 MiB of system RAM used; 5.7 tokens/s on the CAX21 with 5796 MiB.
- On 16 GB it has room. 9.7 tokens/s on the CX43 with 6023 MiB used out of 15613 MiB.
For an agent that chains several model calls per task, speed adds up. At 9.7 tokens/s a 256-token answer takes about 26 seconds; at 13.5 tokens/s (Llama 3.2 3B on the CX33) about 19 seconds. That is fine for an inbox triage agent that runs in the background, and too slow for a live chat agent. More per model: Llama 3.1 8B requirements.
The cold-start trap
Ollama's FAQ says: "By default models are kept in memory for 5 minutes before being unloaded." An agent that fires every 15 minutes therefore loads the model from disk on almost every run. We measured that load time on the first request:
| Server | Llama 3.2 3B load | Llama 3.1 8B load |
|---|---|---|
| CX33 (4 vCPU, 8 GB) | 3.7 s | 10 s |
| CX43 (8 vCPU, 16 GB) | 3.7 s | 7.9 s |
| CAX21 (4 vCPU ARM, 8 GB) | 5.2 s | 12.3 s |
To keep the model loaded, set OLLAMA_KEEP_ALIVE to a negative value such as -1 (the FAQ: "any negative number which will keep the model loaded in memory"), or pass keep_alive per request. The price is RAM that is never free, which is exactly why the 8B model belongs on 16 GB when n8n shares the box.
Two more defaults matter for agents: Ollama processes 1 request per model at a time unless you raise OLLAMA_NUM_PARALLEL, and it uses a 4096-token context window by default. Long agent histories need a bigger context, which needs more RAM; we have not measured that yet.
Put it together: RAM for your agent
Tick what runs at the same time. The calculator adds our measured idle figures for Ubuntu, Docker and n8n with Postgres, the measured RAM of the model you pick and some headroom, then names the cheapest tested server that fits. It is an estimate built from separate measurements; we have not yet measured n8n and a local model loaded on the same server.
Recommended servers for a 24/7 agent
| Setup | Server | Price/month | Measured reason |
|---|---|---|---|
| Agent runtime, model via API | Hetzner CX23, 2 vCPU, 4 GB | 6.64 € | n8n 15.04 executions/s, peak 1003.0 MiB, 0 failed |
| Agent runtime on ARM, model via API | Hetzner CAX11, 2 vCPU, 4 GB | 7.25 € | n8n 13.9 executions/s, 0 failed |
| Agent + small local model (1B to 3B) | Hetzner CX33, 4 vCPU, 8 GB | 10.27 € | Llama 3.2 3B 13.5 tokens/s, 3068 MiB used |
| Agent + Llama 3.1 8B | Hetzner CX43, 8 vCPU, 16 GB | 19.35 € | 9.7 tokens/s, 6023 MiB used of 15613 MiB |
Prices are gross from the Hetzner Cloud API (Helsinki), checked 5 November 2026:
| Plan | CPU | vCPU | RAM | Disk | Per month excl. VAT | Per month incl. 21% VAT | Per hour incl. VAT |
|---|---|---|---|---|---|---|---|
| CAX11 | arm | 2 | 4 GB | 40 GB | 5.99 € | 7.25 € | 0.0116 € |
| CAX21 | arm | 4 | 8 GB | 80 GB | 10.49 € | 12.69 € | 0.0203 € |
| CAX31 | arm | 8 | 16 GB | 160 GB | 20.99 € | 25.40 € | 0.0407 € |
| CAX41 | arm | 16 | 32 GB | 320 GB | 40.99 € | 49.60 € | 0.0795 € |
| CCX13 | x86 | 2 | 8 GB | 80 GB | 42.99 € | 52.02 € | 0.0834 € |
| CCX23 | x86 | 4 | 16 GB | 160 GB | 85.99 € | 104.05 € | 0.1667 € |
| CCX33 | x86 | 8 | 32 GB | 240 GB | 138.49 € | 167.57 € | 0.2685 € |
| CCX43 | x86 | 16 | 64 GB | 360 GB | 275.99 € | 333.95 € | 0.5352 € |
| CCX53 | x86 | 32 | 128 GB | 600 GB | 533.49 € | 645.52 € | 1.0346 € |
| CCX63 | x86 | 48 | 192 GB | 960 GB | 853.49 € | 1,032.72 € | 1.6550 € |
| CPX11 | x86 | 2 | 2 GB | 40 GB | 5.49 € | 6.64 € | 0.0106 € |
| CPX02 | x86 | 1 | 1 GB | 20 GB | 5.99 € | 7.25 € | 0.0116 € |
| CPX21 | x86 | 3 | 4 GB | 80 GB | 9.49 € | 11.48 € | 0.0184 € |
| CPX12 | x86 | 1 | 2 GB | 40 GB | 11.49 € | 13.90 € | 0.0223 € |
| CPX31 | x86 | 4 | 8 GB | 160 GB | 17.49 € | 21.16 € | 0.0339 € |
| CPX22 | x86 | 2 | 4 GB | 80 GB | 19.49 € | 23.58 € | 0.0378 € |
| CPX41 | x86 | 8 | 16 GB | 240 GB | 32.49 € | 39.31 € | 0.0630 € |
| CPX32 | x86 | 4 | 8 GB | 160 GB | 35.49 € | 42.94 € | 0.0688 € |
| CPX42 | x86 | 8 | 16 GB | 320 GB | 69.49 € | 84.08 € | 0.1348 € |
| CPX51 | x86 | 16 | 32 GB | 360 GB | 70.99 € | 85.90 € | 0.1377 € |
| CPX52 | x86 | 12 | 24 GB | 480 GB | 100.49 € | 121.59 € | 0.1948 € |
| CPX62 | x86 | 16 | 32 GB | 640 GB | 129.99 € | 157.29 € | 0.2520 € |
| CX23 | x86 | 2 | 4 GB | 40 GB | 5.49 € | 6.64 € | 0.0106 € |
| CX33 | x86 | 4 | 8 GB | 80 GB | 8.49 € | 10.27 € | 0.0165 € |
| CX43 | x86 | 8 | 16 GB | 160 GB | 15.99 € | 19.35 € | 0.0310 € |
| CX53 | x86 | 16 | 32 GB | 320 GB | 29.49 € | 35.68 € | 0.0572 € |
From the Hetzner Cloud API, location hel1, checked 2026-11-05. "Incl. VAT" is what our Czech (EU consumer) account pays; businesses and buyers outside the EU usually pay the price excl. VAT. Primary IPv4 is billed separately.
Hetzner CX23: agent with an API model
- Best for: n8n or a Python agent that calls OpenAI, Anthropic or another API.
- Main drawback: no room for a local model beyond 1B to 3B, and Llama 3.1 8B was OOM-killed on it.
- Skip it if: you want any local model loaded next to n8n permanently.
Hetzner CX33: agent with a small local model
- Best for: classification, extraction and summaries with Llama 3.2 3B, keeping data in-house.
- Main drawback: 8B runs at 6.3 tokens/s and fills most of the 7751 MiB.
- Skip it if: your agent needs an 8B model and n8n together.
Hetzner CX43: agent with Llama 3.1 8B
- Best for: a fully local agent where no prompt leaves your server.
- Main drawback: 9.7 tokens/s is still too slow for live chat.
- Skip it if: an API model is acceptable; a CX23 plus API spend is cheaper at low volume.
Hetzner CAX21 (ARM): the alternative
4 ARM vCPUs and 8 GB for 12.69 €. n8n reached 25.77 executions/s, Llama 3.1 8B 5.7 tokens/s. n8n, Postgres and Ollama all ran on ARM in our tests; check that every other image you need has an arm64 build. Details: Ollama on ARM.
Order at Hetzner Cloud. We earn no commission there; it wins on our measurements, not on payouts.
Model on the server or via API?
A CPU server has a fixed price and a fixed speed. An API has no fixed price and charges per token. The calculator below takes a measured server and model, the hours a day it generates, and your API price per million output tokens, and tells you which is cheaper per million tokens:
For most agents the honest answer is the API, because an agent generates in bursts and a server you pay for 24 hours sits idle most of the day. The local model wins when privacy is the requirement, or when the agent works through a queue for many hours every day. Full method on cost per million tokens.
Other hosts (not yet tested in our Lab)
We have not run agents, n8n or Ollama on these yet; testing is scheduled and this page will be updated. Figures are from official pricing pages opened on 5 November 2026:
| Provider and plan | Specs | Price | Regular or usage price |
|---|---|---|---|
| Hostinger KVM 2 | 2 vCPU, 8 GB, 100 GB NVMe | $8.79/month, paying $210.96 for 24 months | Renews at $14.99/month |
| Hostinger KVM 4 | 4 vCPU, 16 GB, 200 GB NVMe | $12.99/month, paying $311.76 for 24 months | Renews at $28.99/month |
| DigitalOcean Basic Droplet | 4 vCPU, 8 GiB, 160 GiB SSD | $48.00/month | Same |
| Railway Hobby | Per-second usage, up to 48 GB RAM per service | $5/month incl. $5 of usage | $10 per GB RAM and $20 per vCPU per month |
Railway's usage pricing deserves a calculation: an agent process that holds 1 GB of RAM around the clock costs about $10 a month in memory alone before CPU, so its fit is small agents that sleep. Hostinger's KVM 2 has the RAM of a CX33 at a promo price; compare its renewal price, which is what you pay after the first term. Links: Hostinger VPS, DigitalOcean, Railway, none with commission today.
Hosted "agent platforms" that run the agent for you exist too. They trade control for setup time, and most of their pricing pages do not say what CPU or RAM you get. If you compare one, ask for the RAM figure and the restart behaviour, then check it against the numbers on this page.
Next step: set up the agent runtime with our n8n install guide for Hetzner, using the same compose file and restart policy as the servers measured here.
Hetzner prices on this page include 21% VAT, as charged to our Czech (EU consumer) account by the Hetzner API on 2026-11-05. Without VAT (businesses, most buyers outside the EU): CX23 5.49 €, CX33 8.49 €, CX43 15.99 €, CAX11 5.99 €, CAX21 10.49 € per month.
FAQ
What server do I need to run an AI agent 24/7?
If the agent calls a model over an API, a 2 vCPU, 4 GB server is enough for the agent runtime: our n8n peaked at 1003.0 MiB under 50 concurrent requests on a Hetzner CX23. If the model runs on the same server, plan 8 GB for a 3B model with headroom and 16 GB for an 8B model next to n8n.
How do I keep an agent running after crashes and reboots?
Use a supervisor. In Docker, set a restart policy such as unless-stopped. For a plain process, write a systemd unit with Restart=always or Restart=on-failure. Ollama's Linux docs give a unit with Restart=always and RestartSec=3.
Why is the first answer of my local agent so slow?
Ollama unloads a model after 5 minutes without requests by default. The next request loads it again: on our servers Llama 3.1 8B took 7.9 to 12.3 seconds to load. Set OLLAMA_KEEP_ALIVE to a negative value to keep it in memory, at the cost of that RAM.
Is a local model cheaper than an API for an agent?
Only at high, steady use. A CPU server generates a fixed number of tokens per second, for example 9.7 tokens/s for Llama 3.1 8B on our CX43. Use the cost per million tokens calculator on this page to compare with your API price.



