Your AI agent keeps dying overnight, and the runs you scheduled never happened. You set it up, it worked while you were sitting at the desk, then you closed the lid and everything went quiet. If that pattern sounds familiar, the cause is almost never the agent itself. It is the machine the agent lives on.
Here is the short answer: an AI agent can only run when its host is awake, online, and still executing the process. A laptop that sleeps, hibernates, or drops its Wi-Fi when you shut the lid kills every scheduled run in that window. To fix it you either stop the machine from sleeping, move the agent onto something that never sleeps, or hand it to a host that keeps it running for you. The rest of this post is about picking the right one for your situation, cheapest option first.
I lost a full week of overnight publishing and research jobs before I fixed this properly, so this is the exact ladder I worked through, including the parts that did not survive contact with reality.
Why Your Agent Dies When You Walk Away
Agents like OpenClaw run as a background process on a computer. That process needs three things to keep working: the CPU has to stay powered, the network has to stay up, and the operating system has to keep the process alive. Closing a laptop lid breaks all three at once.
On macOS, shutting the lid puts the machine to sleep within seconds, even if you set the display to never turn off. On Windows, the default “when I close the lid” action for a laptop is sleep. In both cases the agent is not stopped, it is suspended, and every task scheduled for that window simply never fires. When you open the lid again the agent wakes up looking like nothing happened, which is why this is so easy to miss.
There is a sneakier second cause. Even with the machine awake, a flat battery, a home Wi-Fi blip, or a power cut takes the agent down, and nothing ever brings it back up. That is the reason “just keep the laptop open” seems to work for two days and then fails on the one night you actually needed it.
How to Confirm This Is Your Problem
Before you change anything, run this check. It takes about five minutes and tells you which cause you are actually dealing with.
- Check the timestamps of your last five scheduled runs. If they cluster around the hours you were at your desk and skip the overnight ones, sleep is your cause. If they fire on time but the output is empty, the problem is different and this guide is not it.
- Look at the lid-close setting. On macOS, open System Settings and check the Battery and Lock Screen options. On Windows, open Settings, then System, then Power and battery, and look at “Lid close action”. If it says Sleep, you have found the culprit.
- Ask whether the agent survived the last reboot. If a restart quietly removed it and it never came back, you have a process persistence problem stacked on top of the sleep problem.
- Test it directly. Schedule a trivial task for 20 minutes from now, close the lid, walk away, and come back. If it did not run, you have confirmed it.
- Check the host uptime. Run
uptimein macOS Terminal, or open Task Manager then Performance on Windows. If the machine has been asleep for hours, so has your agent.
What I Tried, and What Actually Worked
I worked up this ladder from free to premium. Every step fixes the real problem, but each one has a catch, so read the honest verdict under each before you commit.
Fix 1: Stop the machine from sleeping (free)
On macOS you have two built-in tools. caffeinate -s keeps the Mac awake while it is plugged in, and sudo pmset -b disablesleep 1 keeps it awake even with the lid closed. Undo that last one later with the same command ending in 0. On Windows, set “Lid close action” to “Do nothing” and sleep to “Never” while plugged in.
Honest verdict: this is a stopgap, not a fix. It ties up the laptop you actually want to carry around, it burns battery, and it dies the moment the machine reboots. It is useful if you just need one long job to finish today. If your runs are driven by heartbeats or cron jobs, it is worth understanding how OpenClaw scheduling actually fires before you blame the schedule.
Fix 2: Give the agent its own always-on machine
An old desktop, a Raspberry Pi, or a Mac mini that just sits there and runs the agent. A Mac mini with 16GB of memory runs OpenClaw comfortably on API models, and you only need more memory if you want to run models locally. You pay once, and it is on all the time.
Honest verdict: great if you already have spare hardware lying around. If you are buying new, you are spending a few hundred dollars and still maintaining the box yourself. If you go this route and want to run models locally to avoid API bills, see our guide to running OpenClaw on free local models with Ollama.
Fix 3: Rent a small VPS (self-host)
A virtual private server from a provider like Hetzner, DigitalOcean, or Linode costs roughly 5 to 10 dollars a month, and OpenClaw wants about 2 vCPUs and 2GB of memory to be comfortable. You install it over SSH once, and the agent then runs 24/7 in a data centre that does not care whether your laptop is open, closed, or at the bottom of a bag.
Honest verdict: this is the cheapest path to a genuinely always-on agent, and it is what most technical users should do. The catch is that it is headless. You trade away some of the desktop superpowers, you own the updates, and you own the security. If you are comfortable in a terminal, this is the best value on the list. If you are not, go to Fix 4.
Fix 4: Use a managed host (the fastest fix if you do not want a server)
If the honest reason your agent keeps dying is that nobody in the house wants to babysit a server, stop fighting it. ClawTrust runs OpenClaw for you as a hosted AI employee. It lives on their infrastructure, so a closed laptop means nothing, and you talk to it from Slack, Telegram, WhatsApp, Discord, or email. There is no SSH to learn, no port to open, and no rebuild after a reboot, because the machine it runs on is not yours to maintain.
Plans start at $29 per month, which covers one AI employee with its own email address, memory of past conversations, and web search. There is a 5-day free trial, so you can watch it survive a full overnight cycle before you pay anything.
Quick Comparison of the Options
| Option | Best For | Starting Price | Rating | Get Started |
|---|---|---|---|---|
| Managed OpenClaw host (ClawTrust) | Running 24/7 with zero server admin | $29/mo, 5-day free trial | 4.8/5 | Start free trial |
| VPS (self-host) | Technical users who want the cheapest true 24/7 | $5-10/mo | 4.3/5 | Get OpenClaw |
| Always-on machine (Mac mini or Pi) | One-time hardware, plus local models | ~$599 one-time (Mac mini) | 4.0/5 | Get OpenClaw |
When It’s Worth Paying
If your agent runs one job a week and you are usually near the machine, the free fixes are genuinely enough. Do not rent a server to run two tasks.
Paying starts to make sense the moment your agent is doing work you would otherwise miss. If a nightly report, an overnight inbox triage, or a scheduled publish has to happen whether or not you are at your desk, then the machine has to be the reliable part, not you. A VPS at around 5 to 10 dollars a month pays for itself the first time it saves you an evening of catch-up, and a managed host at $29 a month is worth it if the alternative is you becoming the on-call engineer for your own automation. Weigh it in hours saved, not features, and the maths is easy.
One more cost to keep in view: long-running agents burn tokens, and that bill is separate from hosting. If your runs are getting expensive, here is how to bring OpenClaw token costs back under control.
FAQ
No. If the agent is running on that laptop, closing the lid suspends the machine and every scheduled task in that window is skipped. The agent has to run somewhere that stays awake, either an always-on machine, a VPS, or a managed host.
No. A Mac mini is one option, but a cheap VPS or a managed host will run the agent around the clock for less money up front. You only need dedicated hardware if you want to run models locally on it.
A VPS is cheaper and gives you full control, but you handle setup, updates, and security. A managed host costs more but removes the server work entirely. Choose the VPS if you are comfortable in a terminal, otherwise choose the managed host.
The floor is roughly 5 to 10 dollars a month for a small VPS, plus your model or API costs. A managed OpenClaw host starts at $29 a month. Keeping it on your own hardware costs nothing monthly, but you spend a few hundred dollars up front.
Yes. macOS ships with caffeinate and pmset, and Windows has a lid-close and sleep setting you can switch to Never while plugged in. They work, but only until the next reboot, which is why they are a stopgap rather than a fix.
Final Thoughts
Do this first, in the next ten minutes:
- Run the five-minute check above and find out whether you are dealing with sleep, a reboot, or a network drop.
- If you just need today’s job to finish, use
caffeinateor your sleep settings right now. - If this has to work every night, decide between a VPS and a managed host based on whether you want to touch a terminal. If you would rather not, start the ClawTrust free trial and let it run one full overnight cycle before you commit.
If your agent still misses runs after all of that, the problem is the schedule rather than the host, and understanding heartbeat versus cron will get you the rest of the way.
Comparing always-on options for your agent?
VPS, a Mac mini, or a managed host: the trade-offs in cost, maintenance, and uptime, side by side.
See Our ComparisonThis post contains affiliate links. If you buy through them, I may earn a small commission at no extra cost to you.

