Which Claude Code Server Survives Your Outages?

Use a persistent Claude Code CLI for a human-led session, a self-hosted Agent SDK worker for application-driven jobs, or Anthropic Managed Agents when Anthropic should run the agent loop. Qualify each candidate against the same recovery drill.

Test a disconnected operator and a dead process separately

On a test host, open Claude Code against a disposable repository. Put one harmless marker in an uncommitted file and a different marker in the conversation. Disconnect the operator terminal, reconnect, and check whether the original session still knows the conversation marker and can read the file marker. Repeat after restarting the test worker, then repeat on a replacement host. Start each timer at the interruption and stop it only when both markers are verified. A persistent terminal can keep a CLI session alive through an operator disconnect. If you depend on Channels, add an inbound probe after recovery, since the channel delivers to an open session. A freshly launched session that answers the probe but forgets the conversation marker has recovered transport only. Record that outcome separately from a timing miss.

Push events into a running session with channels - Claude Code Docs

Choose who owns the agent loop

For one operator driving changes from a shell, start with a persistent CLI on a host the operator can administer. Use a self-hosted Agent SDK worker when an application needs to launch jobs and track their results. Count provisioning the working directory, supervising the subprocess, and making session files available at recovery as part of the application design. With Anthropic Managed Agents, Anthropic runs the loop, and you can choose where tool execution runs from the documented sandbox options. Compare these paths by assigning responsibility for the loop and for the workspace separately. In an illustrative drill, a worker that responds in 12 seconds but takes 90 seconds to make the correct checkout usable misses a 60-second recovery objective. Time the completed recovery, including the workspace check, on every candidate.

Hosting the Agent SDK - Claude Code Docs

Decide what the server has to keep running

Define what should happen when the operator closes a terminal, the agent process exits, and the machine reboots. Write a separate pass condition for each event. A persistent terminal can handle a disconnect. Recovery after a process exit needs supervision or an explicit restart procedure, and recovering unfinished work also depends on what was saved before the exit.

This distinction matters if you use Claude Code Channels. A channel sends events into an open Claude Code session, so a reachable server with a closed session can still miss an event. Check the documented authentication and organization requirements before building around a channel. Send a harmless event from a test account after disconnecting, then repeat after your restart procedure. Record both whether a reply arrived and whether it reached the intended session.

Push events into a running session with channels - Claude Code Docs

Size for the jobs that overlap

Anthropic lists 4 GB or more of RAM for Claude Code. Use that as the documented baseline and size above it when your repository tools need more. Run the real build or test command on a disposable checkout while Claude Code is active. Capture peak memory, free disk after dependency installation, and whether the jobs complete without termination or sustained swapping.

For an illustrative trial, assume the server has 4 GB of RAM, the OS and operator services use 1 GB, and each of two simultaneous jobs peaks at 2 GB including its agent and tools. If those peaks coincide, demand reaches 5 GB. Run the jobs serially and verify that the resulting queue meets your deadline, or test a larger server if both jobs must finish in parallel. Repeat the test with a cold checkout to capture dependency and cache growth.

Advanced setup - Claude Code Docs

Match the host to the recovery job

Pick a Docker host if your team can rebuild an image, restore a workspace volume, and verify that each client's process has access only to its own data. For an Agent SDK deployment, include session files in the recovery exercise because the SDK runs a Claude CLI subprocess tied to local state. Start with a disposable job and prove that a fresh deployment can find the expected repo, artifact, and required session state.

A Mac mini or Mac Studio is a candidate when the build requires macOS. Test recovery after loss of network access or power before relying on it for unattended work. For an E2B pilot, verify the sandbox lifetime, artifact export, and restart behavior. Run the same task on a persistent server and on a fresh sandbox. A sandbox can pass for batch work if a new job starts cleanly and the prior job's artifacts are available outside it.

Hosting the Agent SDK - Claude Code Docs

Sources