Where Should You Run Claude Code Unattended?
Use the local Claude Code CLI for supervised work, a VPS with a persistent Claude Code session for Channels, or Claude Managed Agents for an application-driven loop. Compare measured reply times, missed probes, and host downtime before choosing.
Set a reply budget for time away from the terminal
Keep Claude Code local when the work depends on a checkout you already supervise. If you need inbound events while you are away, trial Claude Code Channels in a persistent terminal on an awake host. A VPS removes the laptop’s sleep schedule from that route. The running session still has to receive the event. For a controlled comparison, use a test channel and send three uniquely numbered prompts that ask for an exact echo, with one before closing the operator’s terminal client, one while disconnected, and one after reconnecting. Allow each probe the full reply budget before marking it missed. Record the reply time and whether the echo matched. If the host stays reachable but the middle probe misses, inspect whether the Claude session remained open across the disconnect.
Push events into a running session with channels - Claude Code DocsMeasure what the host must carry between turns
If you are building an application wrapper, budget a process tree and transcript per active Agent SDK session. Measure the busiest representative turn, including any children started by tool calls. As an illustrative sizing check, six process trees peaking at 350 MiB each need about 2.1 GiB before the OS, application, and spare capacity. Give simultaneous sessions separate working directories when their edits must stay isolated. On a disposable checkout, put a short marker in the conversation and use a read-only follow-up to check whether it survives a fresh connection. If you need an application to submit events and stream results without operating the agent loop, evaluate Claude Managed Agents. Repeat the same fixture there and verify which sandbox can read the required files.
Hosting the Agent SDK - Claude Code DocsProve local access before moving the job
Use Anthropic’s documented installer for your operating system. In a terminal, change into a test checkout, run claude, and complete the first-use sign-in. If you set ANTHROPIC_API_KEY, Anthropic documents that approving the key when prompted skips the login prompt. Use the authentication method approved for that project.
Start with a read-only assignment. Ask Claude Code to name a known file and describe one existing test, then compare the answer with the checkout. If it reports missing files, confirm the working directory. If authentication fails, resolve it on the local machine before copying the setup to a server. This gives you a known working repository and account combination to test elsewhere.
Overview - Claude Code DocsKeep a VPS session alive for incoming events
Use a VPS you administer when Claude Code needs server-side tools or a live session after your laptop disconnects. Install Claude Code using Anthropic’s instructions for the VPS operating system, prepare a dedicated checkout, and launch it in a persistent terminal. If you need inbound messages, configure a supported Claude Code channel and check its authentication and organization requirements, since Anthropic describes Channels as a research preview.
In an illustrative test, use a checkout containing only sample files. Ask the channel to report the filename of a known fixture, disconnect from the VPS, and send another request with a unique identifier. A reply containing the identifier confirms the session was reachable after disconnect. If it answers only when you’re connected, inspect whether the Claude Code process survived your logout.
Push events into a running session with channels - Claude Code DocsCheck session recovery separately from uptime
For a self-hosted application built on the Claude Agent SDK, each session uses a separate CLI subprocess and stores its transcript on local disk. Decide where session files and working files should live before replacing a worker. When testing concurrent sessions, assign distinct working directories if their changes need to stay independent.
Run a recovery drill with a disposable checkout. Save a small draft artifact and record the session identifier. Restart the worker, then check whether you can recover the conversation and find the draft independently. A responding worker with a missing draft points to workspace persistence. A visible draft with missing history points to session storage or recovery. If continuity is optional, start a fresh job with explicit inputs and reuse the available artifact.
Hosting the Agent SDK - Claude Code Docs