Most people searching for AI agent hosting do not actually want to run a server. They want an agent that keeps working when their laptop is shut, and hosting is the word they reached for. So the useful answer starts one step earlier: decide which layer you are hosting, because the cheapest option at one layer is the most expensive at another.

The three layers you could be hosting
An agent run has more moving parts than a web app, and hosting conversations go wrong when people compare across different layers. Pin down which of these three you actually need before comparing any prices.
- The model. The thing that does the reasoning. Either you call a hosted model over an API and pay per token, or you run open weights yourself and pay for memory. This is the single biggest fork in the road.
- The agent loop. The process that reads your instruction, calls the model, calls your tools, checks the result, and retries. It is small and cheap to run, but it has to stay alive and it has to hold credentials.
- The integrations. The connections to your inbox, CRM, spreadsheet or store, plus the tokens that authorise them. This layer carries almost no compute cost and almost all of the maintenance burden.
A managed platform hosts all three. An app platform hosts the loop and the integrations while you rent the model from someone else. A virtual machine hosts whatever you install on it, which can be all three if you have the memory for it. That is the whole taxonomy, and it explains why quoted prices for "AI agent hosting" range from zero to hundreds of dollars without anyone lying.
What each layer costs
Here are the four realistic options side by side, with list prices checked on 2 September 2026. Prices are for the hosting only; model tokens are separate everywhere except the managed column, where usage is bundled into the plan.
| Option | Entry cost | Who runs the upkeep | Best for |
|---|---|---|---|
| Managed agent platform (Gravity) | Free tier, 1 agent at $0/mo; paid from $20/mo including $20 of usage | The platform | Getting a task done without operating anything |
| App platform (Railway and similar) | 30-day trial with $5 credits, then $1/mo at 1 vCPU and 0.5 GB RAM | You, for the code; the platform, for the machine | An agent script you already wrote |
| Rented virtual machine (DigitalOcean Droplet) | $63.00/mo for 8 GiB General Purpose; $84.00/mo for 16 GiB Memory-Optimized | You, entirely | Data residency rules, or running open weights |
| Hardware you already own | Electricity only | You, entirely | A machine that is already on all day anyway |
The ordering surprises people. Renting a machine is the most expensive of the four for most workloads, not the cheapest, and it is the one that also hands you the operating system, the patching and the backups. DigitalOcean is explicit that a Droplet is Infrastructure-as-a-Service and that "you are responsible for managing the operating system, applications, and data."
A worked example at real list prices
We priced a common case using published rates rather than estimates, because the gap between the two is where most hosting decisions go wrong. The scenario: one agent that checks a mailbox, drafts replies and files them, running a few dozen times a day, calling a hosted model over an API.
- On a rented machine sized for the loop only: the agent loop itself is light, so a small shared-CPU instance carries it. DigitalOcean markets a 1 vCPU, 1 GB shared-CPU configuration at $0.024 per hour for exactly this use, describing it as suited to "agent execution and AI/ML orchestration." Left on continuously that is roughly $17 a month, plus model tokens on top, plus backups if you want them.
- On a rented machine sized to run the model too: open weights need memory, and memory is where the bill turns. DigitalOcean's Memory-Optimized line starts at $84.00 a month for 16 GiB. That is more than four times the entry price of most managed plans, before you have written a line of agent code.
- On a managed platform: $20 a month including $20 of usage, with no machine to size, patch or back up, and nothing billed while the agent sits idle.
The arithmetic only inverts when the machine is already yours and already running. At that point the marginal cost really is close to zero, and self-hosting genuinely wins. Our fuller breakdown of that case lives in self-hosted AI agents, which prices the hardware question in detail.
What actually fits under $5 a month
This is the most common version of the question, and it deserves a direct answer rather than a hedge. Under $5 a month you can host the agent loop. You cannot reliably host the loop, the model and the backups for that number.
- Realistic under $5: a managed free tier at $0; an app platform's minimal always-on tier; or an agent that runs briefly on usage-billed compute and genuinely idles the rest of the time.
- Not realistic under $5: running open model weights, which needs memory that starts well above that line; anything with a dedicated always-on instance sized for real work; or a setup where you have forgotten that model tokens are billed by whoever serves the model.
The trap in the $5 framing is that it prices the server and ignores the model. For a price-led comparison that keeps both in view, see the cheapest AI agent platforms, and for the tier just above it, the best platforms under $50 a month.
The costs that land outside the sticker price
Every hosting comparison we have read understates the bill in the same four ways. None of these are exotic; they are simply billed on a different line from the one people compare.
- Backups and snapshots. Billed separately from the machine. DigitalOcean prices percentage-based backups at 20 percent of Droplet cost for weekly or 30 percent for daily, and Droplet snapshots at $0.06 per GB per month. On an $84.00 instance, daily backups add about $25 a month.
- Idle time. A rented always-on instance bills the same whether the agent ran once or a thousand times. Agents are bursty by nature, so utilisation is often terrible.
- Retries. A retry costs model tokens, not server time. This is why token spend, not hosting, tends to dominate a busy agent's bill.
- Credits that expire. Included usage generally does not roll over. Railway states plainly that included usage "is reset at the end of every billing cycle and does not accumulate over time," and that exceeding the included amount means being charged total usage rather than just the excess.
When hosting it yourself is the right call
There are good reasons to run your own, and it is worth separating them from the bad one. The bad reason is assuming it will be cheaper, which the numbers above mostly contradict. The good reasons are specific.
- A hard data-residency or compliance rule that says certain data cannot leave hardware you control. This is the strongest reason and it does not care about cost.
- You want to run open model weights on a machine you already own, for privacy or for experimentation, and the electricity is already being spent.
- Operating it is the point. If you are learning the stack or building a product on top of it, the upkeep is the work rather than a tax on it.
If none of those describe you, hosting is overhead you are volunteering for. The comparison between the two postures is laid out in self-hosted versus managed AI agents.
How to pick in one pass
Four questions settle it, in this order. Answer them honestly and the option picks itself.
- Must the data stay on hardware you control? If yes, you are self-hosting, and cost is not the deciding factor. Skip to sizing for memory.
- Do you already have working agent code? If yes, an app platform is the cheapest home for it. If no, writing code just to avoid a subscription is a poor trade.
- Is there a machine already running in your life? If yes, that is your cheapest option by a wide margin. If no, renting one starts around the price of two managed plans.
- Do you want the task done, or the service run? If it is the task, a managed platform removes the entire question. If it is the service, host it.
For most people reading this, the honest answer is the fourth one, and it means not hosting anything. If you are still weighing platforms rather than servers, the free tier comparison and how AI agent pricing works cover the ground that matters next. If you are new to the category entirely, start with what an AI agent is.
Frequently asked questions
What is AI agent hosting?
AI agent hosting is wherever the agent loop actually runs: the process that takes your instruction, calls a model, calls your tools, and keeps going until the task is finished. That can be a managed agent platform where you host nothing, an app platform where you deploy your own code, or a virtual machine you rent and administer yourself. The three differ far more in who does the upkeep than in raw compute price.
Do I need to host an AI agent myself?
Usually no. If you want an agent to do a job rather than to operate a service, a managed platform removes hosting from your life entirely. Hosting yourself makes sense when you have a hard data-residency rule, when you want to run open model weights on hardware you already own, or when running the infrastructure is itself the point. Those are real reasons. Saving money is usually not one of them once you price in a rented machine.
What is the cheapest way to host an AI agent?
The cheapest option is a managed free tier, because the marginal cost is zero and there is no server to keep alive. Gravity's free tier runs one agent at no cost. The next cheapest is a computer you already own and already leave switched on, where the agent adds only electricity. Renting a virtual machine is the expensive option: DigitalOcean's General Purpose Droplet with 8 GiB of memory lists at $63.00 per month, well above most managed plans.
How much does a server for an AI agent cost per month?
It depends on whether the model runs on that server. If you are only running the agent loop and calling a hosted model over an API, a small shared-CPU instance is enough and costs single-digit to low-double-digit dollars per month. If you want to run open model weights locally, you need memory: DigitalOcean's Memory-Optimized Droplets list at $84.00 per month for 16 GiB and $168.00 per month for 32 GiB, before backups.
Is there free AI agent hosting?
Yes, in two forms. Managed platforms offer free tiers, including Gravity's free tier with one agent at $0 per month, and these are genuinely free rather than trials. App platforms offer trial credits instead: Railway advertises a 30-day free trial with $5 in credits, then $1 per month. Trial credits expire, so read whether you are being offered a free tier or a countdown.
Can I host an AI agent for under $5 a month?
You can host the agent loop for under $5 a month, but that figure rarely covers the whole bill. A minimal always-on instance or a usage-billed app platform can land under $5 if the agent runs briefly and infrequently. What sits outside that number is model tokens, which are billed by whoever serves the model, plus backups and storage. DigitalOcean prices percentage-based backups at 20 percent of Droplet cost weekly or 30 percent daily.
What hidden costs come with hosting an agent yourself?
Four recur. Backups and snapshots are billed separately, at 20 to 30 percent of Droplet cost for percentage-based DigitalOcean backups and $0.06 per GB per month for snapshots. Idle time is billed on an always-on instance even when no agent runs. Retries multiply token spend rather than server spend. And included-usage credits do not roll over: Railway states that included usage resets at the end of every billing cycle and does not accumulate.
Does a managed agent platform lock me in?
Partly, and it is worth being honest about it. A managed runtime owns the agent loop, so moving means rebuilding that loop somewhere else. What usually does not move is the glue: the integration credentials, the retry behaviour, and the prompt tuning. The practical hedge is to keep your task definitions and any custom logic in a form you can read and export, rather than assuming you will never switch.
Sources
- DigitalOcean. "Droplet pricing." digitalocean.com/pricing/droplets, checked 2 September 2026. Source for General Purpose at $63.00 per month (8 GiB, 2 vCPUs), Memory-Optimized at $84.00 (16 GiB) and $168.00 (32 GiB) per month, the $0.024 per hour shared-CPU configuration described for agent execution and AI/ML orchestration, percentage-based Backups at 20 percent (weekly) or 30 percent (daily) of Droplet cost, Droplet Snapshots at $0.06 per GB per month, and the statement that a Droplet is Infrastructure-as-a-Service where the user is responsible for managing the operating system, applications and data.
- Railway. "Pricing." railway.com/pricing, checked 2 September 2026. Source for the 30-day free trial with $5 in credits then $1 per month at up to 1 vCPU and 0.5 GB RAM per service, for included monthly usage credits on the paid tiers, for the statement that included usage resets at the end of every billing cycle and does not accumulate over time, and for the note that exceeding included usage means being charged total usage.
