Modal vs Railway

Modal is a serverless AI cloud whose sandboxes are gVisor containers that sit next to its GPUs and last at most 24 hours. Railway is an app platform whose sandboxes are Linux VMs that live next to your apps and databases and are destroyed when they go idle.

The companies and products

Modal

Modal is a serverless cloud for AI work: inference, training, batch jobs and sandboxed code, all driven from Python, TypeScript or Go code.

Modal Sandboxes are containers you create from code, run commands in, and then terminate. By default they run under gVisor, a user-space kernel from Google; since October 2026 you can also pick a VM runtime with its own Linux kernel for Docker and FUSE (Battleships tracks that as a separate card, Modal VM Sandboxes). It suits teams that already run models on Modal and want short-lived, scalable code execution next to their GPUs.

Railway

Railway is a cloud platform for deploying web apps, servers and databases, which now also sells sandboxes and cloud agents.

Railway's main product is app hosting: you deploy services and databases as containers on its own hardware. In 2026 it added Sandboxes, isolated Linux VMs you create from the CLI or a TypeScript SDK, run commands in and destroy, and Cloud Agents, a personal VM for running a coding agent, in early access. It suits teams already hosting on Railway who want throwaway machines next to their apps.

Which use cases each one fits

For each use case, Battleships prices every sandbox provider on the same workload and sorts them from the cheapest monthly bill up. “19th cheapest of 345” means 18 of the other 344 providers run that workload, with every feature it needs, for less. “With limits” means the provider runs it but misses something, so it is listed after every full match. Open a use case for its whole ranking and what each provider misses.

Use case and its workloadModal: price rankRailway: price rankboat: price rank
Software factory
100 at once · 4 vCPU / 8 GB · 2,200 sessions of 8 h a month
A software factory needs Docker, a desktop and a disk that survives between runs; Modal resets its root disk, Railway destroys idle sandboxes, and boat keeps all three.
Can't run it51st of 367, with limits
$342 a month
3rd cheapest of 367
$634 a month
Always-on AI employees
50 machines 24/7 · 2 vCPU / 4 GB
An always-on agent hits Modal's 24-hour sandbox limit, while Railway can keep one running by setting the idle timeout to 0, and boat has no session cap on paid plans.
196th of 366, with limits
$1,924 a month
16th cheapest of 366
$3,977 a month
5th cheapest of 366
$657 a month
Code interpreter bursts
100 at once · 1 vCPU / 2 GB · 200,000 sessions of 1 min a month
For bursts of short code runs both fit, and Modal ranks 19th against Railway at 36th, helped by fast starts and very high concurrency.
19th cheapest of 345
$181 a month
36th cheapest of 345
$413 a month
186th of 345, with limits
$2,000 a month
Sandboxes for your users
300 at once · 2 vCPU / 4 GB · 30,000 sessions of 23 min a month
Modal fits 300 user sandboxes at once on Team, while Railway caps Pro at 100 per environment; boat ranks 1st because a stopped sandbox keeps its disk and costs nothing.
11th cheapest of 361
$811 a month
42nd of 361, with limits
$290 a month
Cheapest of 361
$209 a month
RL rollouts
1,000 at once · 2 vCPU / 4 GB · 1,000,000 sessions of 3 min a month
RL rollouts launch many short sandboxes at once, which is what Modal is built for, so Modal ranks 5th while Railway's per-environment cap makes it a compromise.
5th cheapest of 360
$19,038 a month
78th of 360, with limits
$4,450 a month
34th of 360, with limits
$2,000 a month
Agent evals
250 at once · 4 vCPU / 8 GB · 15,000 sessions of 20 min a month
59th cheapest of 364
$1,244 a month
108th of 364, with limits
$364 a month
10th cheapest of 364
$200 a month
CI runners
40 at once · 8 vCPU / 16 GB · 6,000 sessions of 12 min a month
126th cheapest of 377
$1,793 a month
113th cheapest of 377
$1,210 a month
4th cheapest of 377
$86 a month
24/7 dev boxes
1 machine 24/7 · 4 vCPU / 8 GB
Railway's Cloud Agents keep a disk and can sleep and wake, though they are early access; Modal sandboxes end within 24 hours.
138th of 368, with limits
$23 a month
66th cheapest of 368
$89 a month
18th cheapest of 368
$26 a month
Computer-use agents
50 at once · 4 vCPU / 8 GB · 20,000 sessions of 15 min a month
Both are headless, so computer-use agents are a compromise on each, while boat ships a 60fps desktop, Chromium and a computer-use API.
98th of 369, with limits
$183 a month
77th of 369, with limits
$103 a month
6th cheapest of 369
$200 a month
Browser-use agents
50 at once · 2 vCPU / 4 GB · 30,000 sessions of 10 min a month
177th of 367, with limits
$136 a month
53rd of 367, with limits
$93 a month
7th cheapest of 367
$200 a month
Scraping & bots (startup scale)
50 at once · 1 vCPU / 2 GB · 100,000 sessions of 3 min a month
267th of 346, with limits
$394 a month
60th cheapest of 346
$570 a month
6th cheapest of 346
$90 a month
Mass scraping & bots (undetectable)
1,000 at once · 1 vCPU / 2 GB · 3,000,000 sessions of 2 min a month
223rd of 338, with limits
$8,795 a month
109th of 338, with limits
$2,988 a month
71st of 338, with limits
$1,800 a month
Parallel red teaming
200 at once · 2 vCPU / 4 GB · 5,000 sessions of 30 min a month
Can't run it43rd of 360, with limits
$574 a month
2nd cheapest of 360
$200 a month
GPU eval jobs
10 at once · 8 vCPU / 32 GB · 500 sessions of 30 min a month
Only Modal has GPUs, from T4 to B300; Railway and boat are CPU only.
19th cheapest of 98
$1,187 a month
Can't run itCan't run it
macOS agents
5 at once · 4 vCPU / 8 GB · 1,000 sessions of 20 min a month
Can't run itCan't run itCan't run it

Key features

FeatureModalRailwayboat
IsolationgVisor container by default; a VM runtime with its own kernel is a separate optionSandboxes are isolated Linux VMs; app services are containersEvery sandbox is a full VM with its own kernel
Docker insideOnly with the VM runtimeThe sandbox docs do not mention DockerDocker, root, systemd and /dev/kvm on every machine
When the sandbox stopsNo paused state; a finished sandbox is gone, only Volumes keep filesDestroyed after the idle timeout (30 minutes by default); files survive only in checkpoints you takeStops for free and resumes later with the whole disk, saved every minute and on stop
Longest session24 hours (default 5 minutes)No documented cap while active; idle timeout can be set to 0 for neverNo cap on paid plans (default TTL 1 h, changeable)
Fork and snapshotsSnapshot the filesystem into an image; memory snapshots in alpha, which end the sandboxFork a running sandbox's filesystem; named disk checkpoints (no memory)Fork a running sandbox without stopping it; named snapshots as templates (disk only)
GPUsT4 to B300; 10 at once on Starter, 50 on TeamNoneNone
Sandboxes at once100 containers on Starter, 5,000 on Team50 per environment on Hobby, 100 on Pro; Enterprise can ask for more100 to 2,000 by plan
Desktop and computer useNot offered; an example shows how to set up VNC yourselfHeadless: terminal, exec and SSH only60fps desktop and Chromium, computer use and browser control, embeddable stream
Coding agentsExamples only; you install and wire up the agent yourselfClaude Code, Codex, OpenCode and Pi preinstalled; you run them headless through execClaude Code, Codex, OpenCode and more preinstalled, with a prompt, steer and events API
Keeping keys out of the sandboxSecrets are environment variables, or you run your own proxy in a sidecarSecrets are environment variables, or signed in and saved in a checkpointAI credentials proxy for model providers and any HTTPS API you register
Reaching the sandboxEncrypted and raw TCP tunnels, connect tokens, inbound IP allowlistUp to 10 public HTTPS domains, set only at creation; SSH and port forwardingHTTPS URLs for up to 50 ports, token-protected by default, plus raw TCP
Outbound network rulesBlock all, IP-range allowlist, domain allowlist (beta)No provider-side allowlistNo provider-side allowlist
Apps and databases nearbyInference, training and batch jobs on the same platformDeploy Postgres, Redis and services in the same project; a sandbox can join their private networkNo hosted databases or app services; host your own inside a sandbox
RegionsUS, EU and Asia-Pacific; pinning a region costs 1.15x to 1.75xCalifornia, Virginia, Amsterdam and Singapore; new sandboxes start in US WestEU only: Germany, Finland, France
Every feature Battleships tracks (43)
FeatureModalRailwayboat
Full VM (own kernel)NoYesYes
Docker insideNoNot publishedYes
Nested virtualizationNoNoYes
RootYesYesYes
SystemdYesNot publishedYes
Desktop GUINoNoYes
BrowserNoYesYes
Computer-use APINoNoYes
SSHYesYesYes
Persistent diskYesYesYes
Pause/resumeNoYesYes
Automatic snapshotsNoNoYes
Fork/cloneYesYesYes
Live fork (no pause)NoYesYes
Memory forkYesNoNo
Custom image (Docker or snapshot)YesYesYes
≥24 h sessionsYesYesYes
Idle auto-stopYesYesNo
Wake on requestNoNoNo
HTTPS preview URLsYesYesYes
Raw TCP inboundYesNoYes
Public IPv4NoNoNo
Egress allowlistYesNoNo
Secret proxyNoNoYes
Secret proxy for any APINoNoYes
Preinstalled agentsNoYesYes
Agent harness APINoYesYes
MCP serverNoYesNo
GPUYesNoNo
WindowsNoNoNo
Arm64NoNoNo
Self-hostingNoNoNo
BYOCNoYesNo
Open sourceNoNoNo
Scoped API keysNot publishedNot publishedYes
Spend limitsNot publishedYesYes
Usage per sandbox (API)Not publishedNoYes
Audit logsYesYesNo
SSOYesYesNo
SOC 2YesYesNo
HIPAAYesYesNo
EU data residencyYesYesYes
Zero data retentionNot publishedNot publishedYes

Performance

Modal12.79 runs/s
RailwayNot measured
boat26.69 runs/s

In StarSling's public benchmark at 4 vCPU / 8 GB, Modal's default gVisor sandbox finished 12.79 Node.js build-and-test runs per second and boat finished 26.69, about twice the work. Railway has no result in that benchmark yet, so we cannot say how it compares on speed.

Node.js build-and-test loop at 4 vCPU / 8 GB, higher is better. Measured with the open hpc-sandbox-benchmarks suite. Modal measured on: Sandbox (gVisor), request = size, any region. Railway has no published run in this suite yet, so there is no like-for-like number to compare.

Pricing in five scenarios

Each bill is priced from the providers' public price lists by the open Battleships engine, with the cheapest plan that runs the scenario.

ScenarioModal, a monthRailway, a monthboat, a month
One coding agent, workdays
4 vCPU / 8 GB, 50 GB disk, 8 hours a day, 22 days a month, files kept between days
$15 · Starter · with limits$16 · Hobby · with limits$20 · $20/mo
One agent that never stops
4 vCPU / 8 GB, 50 GB disk, running 24/7 all month
$178 · Starter · with limits$70 · Hobby · with limits$26 · $20/mo
50 agents in parallel
50 machines of 4 vCPU / 8 GB at once, 8-hour sessions, 1,100 sessions a month, Docker inside
$2,229 · Starter · with limits$739 · Hobby · with limits$317 · $20/mo × 3 seats
Sandboxes for your users
2 vCPU / 4 GB, 30,000 sessions of 10 minutes a month, up to 300 at once
$792 · Team$223 · Pro · with limits$200 · $100/mo × 2 seats
1,000 short jobs at once
2 vCPU / 4 GB, 1,000 at once, 3 minutes each, 200,000 jobs a month
$3,193 · Team · with limits$781 · Pro · with limits$2,000 · $2000/mo · with limits

Modal: Modal bills by the second for whichever is higher, the CPU and memory you request or what you use, and an idle sandbox pays until it is terminated. Starter is free with $30 of monthly credit and Team is $250 a month with $100 of credit; pinning a region multiplies the price by 1.15x to 1.75x.

Railway: Railway bills sandboxes per second at $50 per vCPU-month on CPU actually used and $50 per GB-month on memory in use, which keeps billing while a sandbox waits. The Hobby ($5) and Pro ($20) fees count toward usage, and Railway does not publish a price for sandbox disk, so our bills leave disk out.

Railway: boat charges one hourly rate per machine size, by the second, only while the sandbox runs. Plans start at $20 a month and the whole fee becomes usage credit; a stopped sandbox costs nothing.

Limits in those scenarios

On Modal, a sandbox lives at most 24 hours and only files in a Volume survive, and Docker needs the VM runtime, so the always-on agent and the 50-agent fleet do not fit. Railway is an app platform first with no published sandbox disk price, and Pro caps sandboxes at 100 per environment, so 300 user sandboxes or 1,000 jobs at once need several environments. Modal's Team plan fits 300 user sandboxes at once, but its shared vCPUs can slow the 1,000-job burst. On boat, that burst is queued above 90 starts a minute and needs more starts a day than the top plan allows.

ScenarioModalRailwayboat
One coding agent, workdays
  • files survive a stop only in Volumes: packages installed elsewhere reset
  • different kind of product: app platform
  • disk beyond 0 GiB: price unknown
None that bite
One agent that never stops
  • Starter: sessions capped at 24 h
  • files survive a stop only in Volumes: packages installed elsewhere reset
  • different kind of product: app platform
  • disk beyond 0 GiB: price unknown
None that bite
50 agents in parallel
  • missing Docker inside
  • files survive a stop only in Volumes: packages installed elsewhere reset
  • not confirmed: Docker inside
  • different kind of product: app platform
  • disk beyond 0 GiB: price unknown
None that bite
Sandboxes for your usersNone that bite
  • Pro: max 100 concurrent
  • different kind of product: app platform
  • disk beyond 0 GiB: price unknown
None that bite
1,000 short jobs at once
  • shared vCPUs on this tier (Modal sells dedicated cores separately as “Sandbox (gVisor), request = size, any region”): heavy, sustained CPU use can be slowed by other tenants
  • Pro: max 100 concurrent
  • different kind of product: app platform
  • disk beyond 0 GiB: price unknown
  • max 2,400 starts/day (needs ~6,667)
  • max 600 starts/hour (needs ~1,000)
  • bursts above 90 starts/min are queued (a burst of 333 takes ~4 min to start)

Which one should you use?

Use Modal when

your sandboxes need GPUs, outbound rules or regions in Asia-Pacific, or are huge bursts of short jobs that finish within a day.

  • GPUs next to your sandboxes. Useful if your agent trains or runs models: Modal rents GPUs from T4 to B300 on the same platform as its sandboxes.
  • Huge bursts of short jobs. Useful for RL rollouts and big batches: Modal runs up to 5,000 containers at once on Team, with fast starts.
  • Outbound rules and more regions. Modal can block a sandbox's outbound traffic or allow only chosen domains, and runs in the US, EU and Asia-Pacific.

Use Railway when

your app and databases already live on Railway and you want sandboxes on the same private network, billed for the CPU they actually use.

  • Your apps and databases in one place. Useful if your app already runs on Railway: sandboxes can join the same private network as your Postgres and services.
  • Sandboxes that can keep running. Useful for long jobs: a Railway sandbox has no session cap and runs until you destroy it if the idle timeout is 0.
  • Short jobs that bill for CPU used. Useful for quick code runs: a Railway sandbox bills for CPU actually used and is gone when the job ends.

Where boat fits

If your agents work for hours or days, neither fits cleanly: Modal ends a sandbox within 24 hours and Railway destroys one when it goes idle. boat gives each agent a full VM that stops instead of disappearing, keeps its disk, runs Docker and a desktop, and lets you drive coding agents inside from outside.

A disk that stays

On Modal everything outside a Volume is lost when a sandbox ends, and on Railway an agent idle past 30 minutes loses its installs. Turning Railway's timeout off keeps it, but memory bills until you destroy it. A stopped boat sandbox keeps its disk and costs nothing.

Docker, a desktop and KVM in every sandbox

Modal needs its separate VM runtime for Docker and Railway's docs do not mention Docker; both are headless. An agent that runs docker compose or tests its app in a real browser gets root, systemd, Docker, /dev/kvm and a 60fps desktop on boat.

Agents driven from outside, keys kept out

On Modal you install agents yourself, and on Railway you shell them through exec and parse the output. On both, API keys sit in environment variables code can read. boat adds a prompt, steer and events API and a credentials proxy.

Use boat when your agents work for hours or days: a full VM that keeps its disk, with Docker, a desktop, and coding agents you drive from outside while their keys stay out. Compare it one to one: boat vs Modal and boat vs Railway.

Questions people ask

Is Modal cheaper than Railway?

In most of our scenarios Railway comes out lower: one always-on agent is $70 on Railway against $178 on Modal, and 50 parallel agents are $739 on Railway against $2,229 on Modal. Railway's numbers leave out disk, which it does not price, and boat comes to $26 and $317 for the same two jobs.

Which is faster, Modal or Railway?

We cannot say yet, because Railway has no result in the public benchmark. Modal's default sandbox did 12.79 Node.js build-and-test runs per second at 4 vCPU / 8 GB, and boat did 26.69 in the same run.

Can Modal or Railway sandboxes run Docker?

Modal runs Docker only with its VM runtime, not in the default gVisor sandbox. Railway's sandbox docs do not mention Docker. Every boat sandbox runs Docker with no extra setting.

How long can a sandbox run on Modal and on Railway?

A Modal sandbox runs 5 minutes by default and 24 hours at most. A Railway sandbox has no documented cap while active, but is destroyed after its idle timeout, 30 minutes by default, unless you set it to 0. A boat sandbox has no session cap on paid plans and stops with its disk kept.

Do Modal or Railway have GPUs?

Modal does, from T4 to B300, with 10 at once on Starter and 50 on Team. Railway has none, and neither does boat.

Are Modal and Railway sandboxes VMs or containers?

Modal Sandboxes are containers under gVisor by default, with a separate VM runtime for Docker and FUSE. Railway's sandboxes are isolated Linux VMs, while its app services are containers. Every boat sandbox is a full VM.

Try boat

Install the CLI, then run boat new.

7-day free trial

More comparisons