Hivra
An agent that lives on your laptop isn't really an agent.

AI agent hosting in 2026: every real option compared (VPS, serverless, managed)

Search for AI agent hosting and you'll find enterprise cloud docs and thin listicles. Neither tells you where a personal or CLI agent should live so it keeps working after you close your laptop. There are four options, with prices for each.

Short answer

An AI agent needs a machine that stays awake, a disk that persists and a way back in. Your own hardware, a VPS ($5-10 a month) or managed hosting can give it all three. Serverless can't, because it stops your process between requests and wipes local disk. Managed hosting means giving up root access and skipping the setup.

What hosting an AI agent actually means

An AI agent is a long-running process. It holds a session, calls a model, uses tools, writes files, and waits for the next trigger. That waiting is what makes hosting an agent different from hosting a website. A website answers requests and forgets you. An agent has state: memory files, a workspace full of code, auth sessions, scheduled jobs halfway through.

So hosting an AI agent means giving that process three things:

  • A machine that stays awake. If the hardware suspends, the agent suspends. Your laptop fails this the moment you close the lid.
  • Persistent disk. The agent's memory, workspace and login state have to survive restarts. Wipe the disk and the agent starts life over. How much of that state is worth keeping depends on the memory system the agent uses.
  • A way back in. You need to check on it, steer it and read its output from wherever you are, ideally including your phone.

Everything below is judged against those three. The model API is a separate cost and a separate decision, since hosting is only about where the process runs. For the full cost picture including tokens, see how much it costs to run an AI agent.

The four options

Option 1: your own hardware. A desktop that stays on, a home server, a Raspberry Pi, an old laptop with lid-close sleep turned off. The extra cash cost is close to zero, because you already own the machine. The catch is everything else. Your home internet drops, the power flickers, the machine needs OS updates, and remote access means either exposing SSH to the internet or running a tunnel. Fine for tinkering. Fragile as the thing your agent's uptime depends on.

Option 2: a VPS. Rent a small virtual server for $5-10/month from Hetzner, DigitalOcean, or similar. It's the classic DIY answer, and it works. You get root, a static IP, and a datacenter's uptime instead of your apartment's. You also take on the sysadmin job: hardening SSH, applying patches, watching disk usage, and rebuilding the server when something breaks at 2am. The concrete setup is in best VPS for Hermes Agent, and the AI agent VPS guide has specs and provider picks for any CLI agent.

Option 3: serverless. Lambda, Cloud Run, Workers and the like. They're great for stateless request-response code and a poor fit for agents. Serverless platforms bill per invocation and shut your process down between requests. Execution time limits (often 5-15 minutes) kill long tasks. Local disk is ephemeral, so the agent's memory and workspace vanish between runs. You can bolt on external storage and queues to fake persistence, but by then you've built a distributed system to avoid renting a $6 server. Serverless makes sense for narrow event-driven automations. A persistent agent with a workspace needs one of the other three.

Option 4: managed agent hosting. A platform provisions a dedicated machine, installs the agent, wires up a web interface, and runs the server for you. You give up root access and some flexibility, and you skip building the setup. This category barely existed two years ago. Hivra is our version. Each agent runs on its own private VM, and Claude Code and Codex are the vendors' official CLIs, so you sign in to Claude Code with your own Anthropic account and to Codex with your own ChatGPT login. On your own Anthropic or ChatGPT login, usage bills through your account, not ours, with no Hivra markup. Hivra is independent and is not affiliated with Anthropic or OpenAI. The full cost comparison with DIY is in managed vs self-hosted AI agents.

What CLI agents specifically need

Most hosting comparisons are written for web apps. CLI agents like Claude Code, Codex and Hermes have a different shape. (Choosing between the first two? We compared them as hosted always-on agents in Claude Code vs Codex for 24/7 work.) Four requirements decide whether a host actually works for them:

  • Process persistence. The agent must survive your disconnect. On a VPS that means running it inside tmux or screen, so an SSH drop doesn't kill the session. On managed hosting, check which runs the platform promises will survive a closed laptop. On a paid Hivra plan the computer stays on and keeps your files, sessions and login. A Claude Code or Codex run you start inside tmux in the computer's Terminal tab keeps going after you close the laptop. On Claude Code, work you send through Telegram, connected in the agent's Telegram tab, runs on the computer, not in your browser.
  • A real browser. Modern agents do research, fill forms and test web apps by driving Chrome. That needs a full browser install on the same machine, plus the RAM to run it. Chrome is by far the hungriest thing on an agent's machine, so budget for it, or the agent loses its most useful skill.
  • Memory and workspace on disk. Agents pile up context: memory files, cloned repos, generated artifacts. The disk has to persist across restarts, and you want more than a few GB free.
  • Restart behavior. Machines reboot. Kernels get patched. Something has to bring the agent back up afterward, either a systemd unit you write yourself or a supervisor the platform runs for you. If the agent stays down after its first unattended reboot, it isn't running 24/7.

Serverless fails the first and third requirements outright. Your own hardware and a VPS can meet all four if you do the work. Managed hosting is built to meet them for you, and that's most of what you're paying for.

Real cost comparison

Cash costs first, then your time.

OptionCash per monthSetup timeMaintenanceKeeps running with your laptop closed
Own hardware~$3-8 electricity1-3 hoursYours, plus home internet riskYes, if the machine stays awake
VPS (DIY)$5-101-2 hoursYours: patches, security, restartsYes
ServerlessVaries, often near $0 idleHours to days of glue codeYours, and the architecture fights youN/A, no persistent process
Managed (Hivra)From $9.99 (2 vCPU and 4 GB of RAM)Pick an agent and sign inThe server is run for youYes for the computer, and for Claude Code or Codex runs inside tmux

On Hivra specifically: the $9.99/month plan is 2 vCPU and 4 GB of RAM, and the $19.99/month plan is 4 vCPU and 8 GB of RAM. Paid plans are not paused for inactivity, and both come with a 7-day money-back guarantee on card payments. Hermes, OpenClaw and Agent Zero run on the computer itself, and Aeon's scheduled tasks run on your own GitHub Actions while the computer hosts its dashboard. None of them needs an open browser. For Claude Code and Codex, start long runs inside tmux in the computer's Terminal tab, or on Claude Code send them through Telegram, and they keep going after you close the laptop. Full details on the pricing page.

The table leaves two things out. DIY cash costs are floors: an hour spent patching a server has a price even when no invoice arrives. And for heavy users, model usage dwarfs hosting either way. A busy agent can spend more on tokens in a day than the VPS costs in a month. To put in your own numbers, the hosting cost calculator compares DIY and managed with your actual usage.

Security basics that actually matter

An agent's server is an odd thing to secure. It holds logged-in sessions for your accounts, and it runs a program whose whole job is executing commands. Whatever host you pick, get these right:

  • No public ports beyond SSH. The agent's web interface should never listen on 0.0.0.0 without auth in front of it. Reverse-proxy it behind authentication or tunnel to it. An open agent dashboard is remote code execution as a service, for everyone.
  • SSH keys only, password auth off. It's one line in sshd_config. Do it on every public VPS.
  • Prefer login sessions over raw API keys. A key pasted into a .env file on a server is a key that leaks in a backup, a log line or a repo. Subscription logins (your Anthropic account for Claude Code, your ChatGPT account for Codex) can be revoked from the provider's side without rotating a key everywhere. More on this in BYO API key explained.
  • Isolate the agent from your other stuff. Don't run your agent on the same machine as your database or your personal files. One machine per agent is the clean model: if an agent is tricked into running something hostile, the damage stays inside its own VM. This is how Hivra provisions every agent, and it's worth copying if you self-host.
  • Patch on a schedule. Unattended-upgrades on Debian or Ubuntu takes five minutes to enable and closes the boring-but-real hole of a six-month-old kernel.

One-click deploys: what's real

"Deploy an AI agent in one click" is a claim worth checking, because it covers two very different products. The first is a template that spins up a container with a chatbot wrapper and a text box. It demos well and does little, because there's no persistent workspace, no browser, and often no real CLI underneath. The second is a platform that provisions actual infrastructure with the real agent on it.

The test is what exists after the click. You should be able to answer yes to all of these:

  • Is the real agent underneath (the vendor's CLI or the open-source project), and does the host tell you which build it runs and with which permission settings?
  • Do you sign in with your own model account, so usage bills at provider rates with no markup?
  • Is there a persistent VM with a workspace, or just a stateless container?
  • Can the agent drive a real browser?
  • Can you reach the terminal, the files and the running session from a browser, including on your phone?

On Hivra the launch provisions a private VM with the agent running on it, and chat, terminal, files, and browser tabs on top. Six agents are launchable today: Hermes, Claude Code, Codex, Aeon, OpenClaw, and Agent Zero. OpenClaw and Agent Zero need a paid plan. If you're weighing those last two against each other, see Agent Zero vs OpenClaw hosting.

Which option wins for which person

  • You have a home server and enjoy tending it: your own hardware. It's the cheapest at the margin, and you've already accepted the ops work.
  • You want full root and total control, and don't mind the sysadmin job: a $5-10 VPS with tmux, SSH hardening, and a systemd unit. It's proven and cheap.
  • You need a narrow event-driven automation, not a persistent agent: serverless. It's the right tool for that one job.
  • You only use Codex and your work lives in GitHub repos: try OpenAI's own cloud first. If your ChatGPT plan lists Codex cloud, there's nothing to host. Codex cloud or your own computer has the full comparison.
  • You want the agent working tonight and never want to think about the server: managed. Pick an agent, launch it, sign in with your own account, and the computer stays up. On Hivra that's $9.99/month for 2 vCPU and 4 GB of RAM or $19.99/month for 4 vCPU and 8 GB of RAM.

The one choice that doesn't work is the default: leaving the agent on your laptop and hoping. An agent that dies when the terminal closes is a chat session with extra steps. Put it on a machine that runs 24/7, whichever of the four ways suits you.

Want a side-by-side of Fly Sprites, Railway's free VM, DigitalOcean Agent Droplets, Orgo and E2B next to a flat monthly computer host? AI agent hosting alternatives puts the criteria first and the prices with the sizes.

Common questions

Can I host an AI agent for free?

Yes, if you run it on hardware you already own that stays awake, which costs only electricity. Model usage is a separate cost on your own account either way. Paid hosting starts where your own hardware stops being reliable enough.

What is the cheapest way to host an AI agent 24/7?

A small VPS at $5-10/month is the cheapest always-on option if you value your setup and maintenance time at zero. If you don't, Hivra's $9.99/month plan (2 vCPU and 4 GB of RAM) is in the same price band and takes the sysadmin work off you, with a 7-day money-back guarantee on card payments.

Can I run an AI agent on AWS Lambda or another serverless platform?

Not well. Serverless platforms enforce execution time limits, shut processes down between invocations and give you ephemeral disk. Agents need a long-running process and persistent state. Serverless fits narrow event-driven automations, but a persistent agent belongs on a VM.

How much RAM does an AI agent server need?

Many agent CLIs run in about 1 GB, though Anthropic lists 4 GB for Claude Code. Once the agent drives a real browser, budget 2-4 GB for the browser alone, because Chrome is the heaviest process on the machine. On the DIY route that means the cheapest VPS tier is often too small for browser work. Size up, or the browser gets killed mid-task.

Do I need an API key to host an agent in the cloud?

Not necessarily. Claude Code signs in with your Anthropic account and Codex with your ChatGPT login, the same flow as on a laptop. That's usually better than pasting an API key into a server .env file, since you can revoke the login from the provider's side. Other agents, like Hermes with your chosen model provider, do take a key you supply.

Is it safe to run an AI agent on a public VPS?

It can be, if you treat it like the sensitive machine it is: SSH keys only, no public ports without auth in front, the agent isolated on its own machine, and patches applied on a schedule. The agent holds your logged-in sessions and executes commands, so an exposed dashboard is the main thing you must never allow.

Give your agent a computer that stays on.

From $9.99/mo. Bring your own AI key. 7-day money-back guarantee on card payments.

Start Now