Will your agent still be running tomorrow morning?
A long-running agent is only as reliable as the computer and terminal session underneath it. Claude Code can be midway through a job when your laptop sleeps, your SSH connection drops or the server restarts. Having the right model does not help when its process has stopped.
Use this check to describe where your agent runs, how you keep its session alive and what happens when something fails. You will get a practical risk assessment and an ordered list of fixes. It is not a live health monitor, and its score is not a prediction of uptime. If an ordinary VPS with tmux and a restart service solves your problem, we will tell you that rather than pretending you need managed hosting.
Does not survive tonight
How this setup dies, worst first
1. Lid close suspends the machine
-35 ptsYou close the lid at 11pm. The OS suspends every process mid tool call, network sockets die, and the run makes no progress until morning. There is no error to tell you.
Free fix: keep the machine awake while the agent runs. On macOS, caffeinate blocks sleep while it runs, full system sleep only on AC power, and closing a MacBook lid still sleeps it unless you set up closed-display mode with an external display. On Linux, set HandleLidSwitch=ignore in /etc/systemd/logind.conf. Honest tradeoff: battery drain, heat, and a laptop you cannot close or carry.
caffeinate -is
2. A crash is permanent
-15 ptsThe agent hits an unhandled error at 2am and exits. Nothing notices and nothing restarts it. The server is fine; the process is just gone.
Free fix: a systemd unit that starts the agent in a detached tmux session and is set to restart it on failure. Replace User=you with your username, then run: sudo systemctl enable --now agent. Test it once: run tmux kill-session -t agent, wait ten seconds, then run tmux ls to check a new session is back. To stop the agent for good, run sudo systemctl stop agent. Honest tradeoff: it restarts a fresh session, not your conversation. Whatever context the run had is gone.
# /etc/systemd/system/agent.service [Unit] Description=Agent tmux session After=network-online.target [Service] Type=forking User=you ExecStart=/usr/bin/tmux new-session -d -s agent claude Restart=always RestartSec=10 [Install] WantedBy=multi-user.target
3. Reboot comes back empty
-10 ptsunattended-upgrades reboots the server at 4am for a kernel patch. The machine comes back up clean. The agent does not, because nothing starts it at boot.
Free fix: the same systemd unit covers this. WantedBy=multi-user.target makes it start at boot, so a reboot brings the agent back on its own.
sudo systemctl enable agent.service
4. Failures go unnoticed for hours
-8 ptsThe run died at midnight. You find out at 9am. The failure cost you the whole night, not the ten minutes the fix would have taken.
Free fix: an SSH client on your phone plus tmux attach lets you check and restart from anywhere. Honest tradeoff: a phone terminal is a rough place to read diffs.
tmux attach -t agent
5. Wifi drops cost you runs
-6 ptsThe wifi drops for two minutes mid tool call. The API request times out, and if you were attached over SSH, that session went down with it.
Free fix: plug into ethernet, or move the run onto a machine with a wired or data centre connection. Honest answer: there is no config flag that fixes a bad link. tmux limits the damage to the one interrupted call.
What this costs you:interruptions a week xminutes to restore at $an hour is about $170 a week of your time.
Agent Survival Check: 26/100 (Does not survive tonight) Top failure modes: 1. Lid close suspends the machine 2. A crash is permanent 3. Reboot comes back empty https://hivra.cloud/tools/agent-survival-check
Assumptions: severities and interruption counts are rough estimates from common failure reports, not measurements of your machine. The free fixes are real and often enough; a VPS with tmux and a systemd unit is a fine setup if you want to run it. Commands and defaults last checked September 2026 against the macOS, OpenSSH, tmux, systemd and util-linux manuals.
A managed always-on computer takes the lid and the server upkeep off your list. Hivra runs Claude Code on a cloud computer with your own sign-in (subject to the provider's terms), and that paid computer stays on with your files, sessions and login. Start a run inside tmux in its Terminal tab, or send it from Telegram, and it keeps going after you close the laptop. The $9.99 a month plan gives it 2 vCPU and 4 GB, and paid plans are not paused for inactivity.
Skip the server upkeepCommon questions
Why does Claude Code stop when I close my laptop?
Sleep suspends every process on the machine, including your terminal and the agent inside it. On wake, network connections may have dropped and long running tool calls may have timed out. If the agent ran over SSH, the disconnect usually kills the remote session too unless it was inside tmux or screen.
Does tmux keep Claude Code running?
On an always-on machine, yes. tmux detaches the session from your terminal, so closing the SSH connection doesn't kill the agent. It does nothing for a laptop that goes to sleep, because the whole machine suspends, tmux included.
Can I just stop my laptop from sleeping?
Partly. On macOS, caffeinate blocks sleep while it runs. It blocks full system sleep only on AC power, and closing a MacBook lid still sleeps it unless you've set up closed-display mode with an external display. On Linux you can tell logind to ignore the lid. You pay in battery, heat and a machine you can't close or carry. Reboots, updates and network changes still kill the run.
How do I keep an AI agent running overnight?
Run it on a machine that stays on. That can be a desktop you leave running, a VPS with tmux, or a managed computer. Hivra runs Claude Code on a cloud computer with your own Anthropic sign-in (subject to the provider's terms). The $9.99 a month plan gives it 2 vCPU and 4 GB, and paid plans aren't paused for inactivity. Start the run inside tmux in the computer's Terminal tab, or send it from Telegram, and it keeps going with your laptop closed.
Is a VPS with tmux enough?
Often yes. A $5 VPS plus tmux keeps the process alive around the clock. You handle the install, the updates and the restart when something crashes. Checking in from a phone means SSH. Managed hosting is the same idea with the ops handled, plus a chat and a web terminal in the browser.
When you need a computer that stays on
If you want the computer to stay on after you leave your desk, Hivra offers a managed computer starting at $9.99 a month for 2 vCPU and 4 GB of RAM. A paid Hivra Cloud computer stays on and is not paused for inactivity. The plan does not include AI usage. Bring your own account or key where the agent supports it, or pay with Hivra credits. Claude Code can use your own Anthropic sign-in or Hivra credits. There is a 7-day money-back guarantee on card payments.
Hivra is independent and is not affiliated with Anthropic or OpenAI.