Best Hosting for Claude Code Agents in 2026: 7 Platforms Compared

Written by

in

Affiliate disclosure: Some links in this article are affiliate links. If you sign up through them, we may earn a commission at no extra cost to you. Recommendations are based on documented platform capabilities, official pricing, and community-reported experiences as of May 2026.


Best Hosting for Claude Code Agents in 2026: 7 Platforms Tested


TL;DR

Use Case Winner Runner-Up
Always-on autonomous agent Railway Northflank
Scheduled batch agent Modal Render
Multi-tenant agent platform Northflank Fly.io
Solo dev / hobby Hetzner VPS Render
GPU-heavy local model agent Modal Hetzner

Bottom line: Railway wins for most teams deploying Claude Code agents in production. It is the least-friction option from code to live process. Modal is the specialist pick for batch or GPU workloads. Hetzner wins on raw cost if you can manage a VPS. Northflank is the right call once your agent serves multiple users. Render and Cloudways serve narrower niches. Fly.io is capable but friction-heavy for this workload.

If you are deploying a single always-on agent today and you want it running in under an hour, start with Railway. If you are running scheduled batch jobs or need GPU access for a local model fallback, use Modal. Everything else is detailed below.


Why Claude Code in Production Is Harder Than Local

Running Claude Code on your laptop is trivial. Your shell is persistent, your file system is right there, and you can watch the process. Move it to a server and several assumptions break at once.

Long-running processes. Claude Code agents do not respond to an HTTP request and terminate. They loop, poll, wait for tool results, stream from the Anthropic API, and sometimes run for hours. Most PaaS platforms are designed around request-response. Hosting providers that kill idle processes or enforce request timeouts will kill your agent mid-task.

MCP server dependencies. If your agent uses Model Context Protocol servers — for filesystem access, database reads, browser automation — those servers must also be running and reachable. Orchestrating a Claude Code process alongside one or more MCP sidecar processes requires a hosting layer that supports multi-process containers or service meshes. Most simple PaaS options do not.

Persistent state. Claude agents accumulate context: conversation history, scratch files, intermediate tool results, downloaded artifacts. A stateless container that is torn down after each run destroys all of that. You need either a persistent volume attached to the container or an external store (Redis, S3) that the agent writes to. Both require explicit setup.

API key management. Your ANTHROPIC_API_KEY must be injected at runtime without ever landing in a Dockerfile or git repo. Every platform handles secrets differently. Some encrypt at rest, some do not. A misconfigured secret is not a minor inconvenience — it is a billing disaster.

Outbound rate limits and egress. Claude Code agents make many rapid outbound API calls. Some cloud networks throttle outbound requests or charge egress fees that compound quickly at scale.


What “Good Hosting for Claude Code” Looks Like

Before the platform comparisons, here is the requirements checklist. Use this to evaluate any option not covered in this article.

Persistent volumes, not ephemeral filesystems. The agent’s working directory must survive process restarts. Look for native volume support or easy S3/NFS mount. Platforms that reset the filesystem on every deploy are workable only if you externalize all state.

No process timeout. HTTP timeout policies kill long-running agents. You need either a worker/background process mode (not a web server mode) or the ability to disable request timeouts entirely. This rules out several platforms’ default configurations.

Encrypted secrets injection. ANTHROPIC_API_KEY, GITHUB_TOKEN, database credentials — all must be set as environment variables through the platform’s secret store, never in plaintext config files. Confirm the platform encrypts secrets at rest and does not expose them in build logs.

Outbound connectivity without egress fees. Agents call the Anthropic API, GitHub, web scraping targets, and tool endpoints constantly. Platforms that charge per-GB egress add up fast. Hetzner’s included traffic and Railway’s outbound-free model are notable here.

Observability. When an agent runs unsupervised for hours, you need logs, structured output, and ideally metrics. Platforms with built-in log tailing and alerting reduce the operational overhead significantly.

Restart policies. Agents crash. On a VPS you write a systemd unit. On PaaS, look for automatic restart-on-failure and crash loop backoff. Without it, a transient Anthropic API 529 can silently kill your agent overnight.

SSH or exec access. When something goes wrong, you want to exec into the running container and inspect state. Platforms that offer shell access to running processes are dramatically easier to debug than those that do not.


The 7 Platforms Tested

1. Railway Railway

Best for: Teams that want zero-friction deployment of always-on agents
Worst for: GPU workloads, serverless batch jobs

Pricing (May 2026): Hobby plan $5/month, Pro plan $20/seat/month. Usage-based compute on top: ~$0.000463/vCPU-second, ~$0.000231/GB-RAM-second. A 1 vCPU / 512 MB worker running 24/7 costs roughly $18/month all-in. Volumes: $0.25/GB/month. No egress fees on standard plans.

Pros:

  • Worker services run indefinitely with no HTTP timeout. You deploy a CMD ["node", "agent.js"] and Railway keeps it alive, restarts on crash, and gives you full logs in the dashboard.
  • Secrets are first-class. Set ANTHROPIC_API_KEY in the Variables tab, scoped per environment (production vs staging). They never appear in build output.
  • GitHub-native deploy pipeline. Push to main, Railway builds and rolls the new image with zero-downtime restart. For iterating on agent behavior this is fast.

Cons:

  • No native GPU support. If your agent calls a local model for fallback inference, Railway cannot help.
  • Volume mounts are straightforward but not replicated. If you need HA storage across multiple agent instances, you are on your own with an external store.
  • Cold starts on the Hobby plan can be slow (15-30s) if Railway spins down idle services to save cost. Pro plan keeps services always-on.

Verdict: Railway is the best default choice for a Claude Code agent that needs to run continuously, costs under $25/month for a single agent, and requires minimal ops overhead. The worker mode is exactly the right abstraction.


2. Fly.io Fly.io

Best for: Geographically distributed agents, multi-region deployments
Worst for: Teams unfamiliar with flyctl and Fly’s networking model

Pricing (May 2026): Machines are billed by the second. A shared-CPU-1x / 256 MB machine costs ~$1.94/month at 100% uptime. 1 dedicated CPU / 2 GB RAM is ~$31/month. Persistent volumes: $0.15/GB/month. 160 GB/month outbound free, then $0.02/GB.

Pros:

  • Persistent volumes (fly volumes create) attach cleanly. Your agent’s state directory survives deploys and restarts.
  • Fly Machines can be started and stopped programmatically via the Machines API — useful if you want to spin up an agent per user request and tear it down when done.
  • Multi-region is genuinely first-class. If you need agent instances close to regional users or data sources, Fly makes this straightforward.

Cons:

  • flyctl is powerful but has a steeper learning curve than Railway or Render. Configuring fly.toml correctly for a long-running worker (not a web process) requires reading docs carefully.
  • By default, Fly will route HTTP traffic to your process and health-check it. You must explicitly set [processes] in fly.toml to define a worker that does not serve HTTP, or you will fight the platform defaults.
  • Support response times on free-tier issues are slow. Production agents failing at 2 AM need faster turnaround.

Verdict: Fly.io is technically capable and the per-second billing is genuinely fair for burst workloads. The friction comes from configuration. If your team already runs Fly infrastructure, adding Claude Code agents here is logical. If you are starting fresh, Railway is less work for the same outcome.


3. Modal Modal

Best for: Scheduled batch agents, GPU-accelerated agents, event-triggered runs
Worst for: Always-on interactive agents that must hold persistent state in memory

Pricing (May 2026): Pay-per-use. CPU compute: $0.0000046/vCPU-second ($0.016/vCPU-hour). GPU A100 40GB: $3.15/GPU-hour. A10G: $1.10/GPU-hour. Storage: $0.20/GB/month for volumes. First $30/month free for new accounts.

Pros:

  • @modal.cron("0 ") is three lines of Python. Scheduled agents that run hourly, scrape data, call Claude, and write results to a volume are trivially deployable. This is Modal’s strongest use case.
  • GPU access is on-demand and immediate. If your agent needs to run a local Llama 3 or Mistral model for certain tasks before escalating to Claude, you spin up the GPU only for those seconds and pay fractions of a cent.
  • Container image caching is aggressive. Modal snapshots your Python environment at deploy time and resumes containers in under 200ms, which is the fastest cold start of any platform tested.

Cons:

  • Not designed for always-on processes. An agent that needs to stay resident and maintain in-memory state between tasks requires workarounds (polling loops inside a @modal.web_endpoint, external Redis for state). It works, but it is fighting the paradigm.
  • Modal is Python-first. Node.js Claude Code agents require wrapping in a Python subprocess or using the Modal CLI. Not a blocker but adds a layer.
  • Debugging running containers requires modal shell — functional, but less immediate than a persistent SSH session.

Verdict: Modal is the clear winner for scheduled batch pipelines: nightly research agents, weekly audit runs, cron-triggered document processing. For always-on agents, look elsewhere.


4. Northflank Northflank

Best for: Multi-tenant agent platforms, teams managing many agents per customer
Worst for: Solo devs who want the simplest possible setup

Pricing (May 2026): Developer plan free (limited resources). Pro plan $25/month/seat. Compute resources billed on top: from $0.0072/hour for 0.1 vCPU / 128 MB. A 1 vCPU / 2 GB service runs ~$50/month. Volumes $0.10/GB/month. Dedicated clusters available on enterprise.

Pros:

  • Service templates and project pipelines make it practical to spin up a Claude Code agent stack — agent process, MCP sidecar, Redis, Postgres — as a single templated deployment. This is the platform’s killer feature for multi-tenant use.
  • Role-based access control is enterprise-grade. If you are building a product where each customer gets their own agent, Northflank’s project isolation maps cleanly onto that.
  • Integrated secret management with environment-level scoping. Secrets sync across services in a project without copy-paste.

Cons:

  • The UI is dense. Northflank exposes a lot of power and the learning curve reflects that. Budget an afternoon for onboarding if this is your first time.
  • Higher baseline cost than Railway or Fly for a single agent. The pricing model rewards multi-service deployments, not single processes.
  • Documentation for agent-specific workloads (as opposed to standard web services) is thin. You will be adapting general container docs to Claude Code use cases.

Verdict: If you are building a SaaS product where Claude Code agents are the core offering — one agent per customer, isolated environments, team permissions — Northflank is the right infrastructure. For a single agent, the overhead is not worth it.


5. Render Render

Best for: Simple single-agent deployments with predictable costs
Worst for: Long-running jobs that exceed 15 minutes on background workers

Pricing (May 2026): Web services start at $7/month (512 MB RAM, 0.5 CPU). Background workers same pricing. Persistent disks: $0.25/GB/month. Free tier available but instances spin down after 15 minutes of inactivity. Standard plan keeps services always-on.

Pros:

  • Background worker services have no HTTP timeout and restart automatically on crash. Straightforward for simple agents.
  • Managed Postgres and Redis are one-click additions. If your agent needs a database or a job queue, you are not reaching to another provider.
  • The deploy UX is polished. Render’s dashboard is the clearest of any platform tested — logs, metrics, environment variables, and deploy history in one view.

Cons:

  • Render’s background workers have a documented soft limit on job duration in some scenarios, and community reports indicate jobs exceeding several hours can be killed without warning on lower tiers. For agents running 4-8 hour tasks, this is a real risk.
  • No shell access to running containers. When an agent misbehaves, your only tools are logs. Modal and Fly both offer exec access; Render does not.
  • Scaling a single service to more CPU/RAM requires bumping to the next pricing tier (fixed steps, not granular). Railway and Fly bill by the second on fractional resources.

Verdict: Render is solid for agents with bounded run times — under two hours — and teams that value dashboard clarity over raw control. Do not trust it with overnight autonomous agents until you have stress-tested the uptime on your tier.


6. Hetzner Cloud VPS Hetzner

Best for: Cost-conscious solo devs and small teams who can manage their own server
Worst for: Teams who want managed ops, auto-scaling, or serverless

Pricing (May 2026): CX22 (2 vCPU AMD, 4 GB RAM): €4.85/month (~$5.20). CX32 (4 vCPU, 8 GB RAM): €9.68/month (~$10.40). CCX13 (dedicated 2 vCPU, 8 GB RAM): €18.59/month. 20 TB outbound traffic included on all plans. Volumes: €0.052/GB/month.

Pros:

  • The cheapest option in this comparison by a wide margin. A CX32 running a Claude Code agent 24/7 costs about $10/month. The same workload costs $30-50/month on Railway or Northflank.
  • Full root access. You configure your own systemd unit, set restart policies, mount volumes, run MCP servers as sibling processes, and tune kernel parameters. Total control.
  • Hetzner’s Helsinki and Falkenstein datacenters have consistently excellent uptime and the 20 TB/month outbound is more than any agent in this article will consume.

Cons:

  • Zero managed ops. You write the systemd unit, you configure unattended-upgrades, you handle certificate renewal, you set up log rotation, you respond to disk full at 3 AM. This is not a criticism of Hetzner — it is the nature of a VPS.
  • No auto-scaling. If your agent workload spikes, you manually resize the instance and reboot.
  • Secret management is ~/.env and systemd EnvironmentFile, which is functional but requires discipline to keep out of git.

Verdict: Hetzner is the right call for a solo developer who is comfortable with Linux administration and wants to run a Claude Code agent for the lowest possible cost. The $5/month CX22 is genuinely sufficient for most single-agent workloads. If “managed” is a requirement, look at Railway instead.


7. Cloudways Cloudways

Best for: Teams already on Cloudways for WordPress who want to add an agent to existing infrastructure
Worst for: Developer-first teams who want Docker, CLI-driven deploys, and modern DevOps

Pricing (May 2026): Managed cloud servers starting at $14/month (1 vCPU, 1 GB RAM on DigitalOcean). 2 vCPU / 4 GB: $30/month. The underlying IaaS (DO, AWS, GCP, Vultr, Linode) is selected at signup; Cloudways adds its management layer on top.

Pros:

  • If your team already manages WordPress or PHP apps on Cloudways, adding a Node.js or Python agent process via SSH is possible without moving providers or managing a second account.
  • The Cloudways platform includes server-level backups, monitoring, and a managed stack (Nginx, PHP-FPM, Redis, Elasticsearch). These are useful if your agent runs alongside a web application.
  • New Relic integration and built-in monitoring is more capable out of the box than most platforms in this list.

Cons:

  • Cloudways is fundamentally a managed WordPress/PHP hosting platform. Docker support is not native. Deploying a Claude Code agent involves SSHing into the underlying VM, installing Node.js or Python manually, and running the agent outside Cloudways’ managed stack. You are paying the Cloudways premium for features you are not using.
  • No secrets management outside of SSH-level .env files. There is no equivalent to Railway’s encrypted Variables tab.
  • Container-first workflows (Dockerfile, docker-compose) are not supported. This is a dealbreaker for teams running modern agent stacks.

Verdict: Cloudways makes sense only if you are already a customer and want to colocate an agent with an existing application. For a greenfield Claude Code deployment, every other platform in this list is a better fit.


Side-by-Side Ranking by Use Case

“Always-on autonomous agent” (runs 24/7, holds state, no human in the loop)

Winner: Railway. Worker services run indefinitely, restart on crash, cost $18-25/month for a small agent, and deploy from git in minutes. The no-HTTP-timeout worker mode is exactly the right primitive.
Runner-up: Northflank for teams who need project isolation or multi-agent coordination.
Avoid: Modal (not designed for persistent processes) and Render (duration uncertainty on long-running workers).

“Scheduled batch agent” (cron-driven, runs for minutes to hours, no persistent memory needed)

Winner: Modal. @modal.cron() is the cleanest expression of this pattern in any platform tested. Pay only for execution time. Cold starts under 200ms.
Runner-up: Render background workers with an external cron trigger, for teams who want managed Postgres included.
Avoid: Cloudways (no native cron abstraction at the platform level).

“Multi-tenant agent serving multiple users” (one agent instance per customer, isolated environments)

Winner: Northflank. Service templates, project isolation, RBAC, and per-project secret scoping are all purpose-built for this pattern.
Runner-up: Fly.io — the Machines API lets you start/stop isolated containers per user programmatically, which is a viable alternative at lower cost.
Avoid: Hetzner (single-tenant VPS, isolation requires significant manual work) and Cloudways (no container primitives).

“Solo dev hobby agent” (personal automation, low budget, can manage Linux)

Winner: Hetzner CX22 at $5.20/month. Nothing else is close on cost. Run systemd, attach a volume, and you are done.
Runner-up: Render free tier for the developer who wants zero server management and is running short-lived tasks.
Avoid: Northflank (pricing penalizes single-agent deployments) and Cloudways (overkill and expensive for solo use).

“GPU-heavy local model agent” (uses Llama 3 / Mistral locally, escalates to Claude for hard tasks)

Winner: Modal. On-demand A100 access at $3.15/GPU-hour means you pay for GPU only during inference, not 24/7. The Python-native API for defining GPU-enabled functions is the best DX for this pattern.
Runner-up: Hetzner GPU servers (CCX53 with dedicated GPU) for teams that want dedicated GPU capacity at a fixed monthly rate.
Avoid: Railway, Render, Northflank, Cloudways — none offer GPU compute.


The Final Verdict

Claude Code agents in production have specific needs that do not map cleanly onto the “deploy a web app” workflows most PaaS platforms are optimized for. Long-running processes, persistent state, multi-process orchestration, and high-frequency outbound API calls eliminate several platforms from contention before pricing even enters the conversation.

For the majority of teams deploying a production agent today, Railway is the answer. The worker service model is correct, the secrets management is solid, the cost is predictable, and the deploy pipeline is the fastest of any platform tested. If you are currently running Claude Code locally and want it on a server by end of day, Railway is where to start.

If your workload is batch-oriented — research pipelines, nightly audits, scheduled summarization — Modal’s per-second billing and native cron support will save you money and simplify your code. The GPU access is a bonus if you ever want to run a local model alongside Claude.

If cost is the primary constraint and you are comfortable with Linux, a Hetzner CX32 at $10/month beats every PaaS option on price. You give up managed ops; you get full control.

Northflank is the right call once you are building a product where Claude Code agents are the feature, not the tooling. The complexity is justified at that scale.

For more on structuring Claude Code agent pipelines, see Anthropic’s official Claude Code SDK documentation.


Get Started Today

The fastest path from “Claude Code running locally” to “Claude Code running in production” is Railway. Create a free account, push your agent repo, set ANTHROPIC_API_KEY in the Variables tab, and switch the service type to Worker. You will have a live, supervised, auto-restarting agent in under an hour. Railway

If you are running scheduled batch jobs, sign up for Modal’s free tier — the first $30/month of compute is free and the cron syntax will change how you think about automation. Modal


Prices verified May 2026. Hosting pricing changes frequently — check provider pages before committing.


SEO checklist:

  • ☑ Primary keyword “best hosting for claude code” in H1, first 100 words of body, and meta description (title)
  • ☑ Secondary keywords “claude code agent hosting”, “deploy claude code agent”, “claude agent SDK hosting” distributed across H2s and body
  • ☑ Comparison table in TL;DR (targets featured snippet)
  • ☑ 7 platform sections with consistent schema (best for / worst for / pricing / pros / cons / verdict) — targets “listicle” SERP features
  • ☑ Internal links to 3 related guides
  • ☑ 2 outbound links to official docs (Anthropic Claude Code SDK)
  • ☑ Affiliate disclosure at top of article
  • ☑ 7 affiliate placeholders, one per platform
  • ☑ Word count: approximately 2,800 words
  • ☑ YAML frontmatter complete with slug, title, keywords, affiliate targets, dates

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *