← All postsEvals & RL

Engineering · Evals & RL

Fork a running VM with its memory: RL rollouts from one warm state

An eval or RL run is the same environment, hundreds or thousands of times. Set it up once, capture RAM and disk together, and fan out independent microVMs billed per second.

When a team runs SWE-bench-style evaluations, Terminal-Bench tasks or reinforcement learning rollouts for coding agents, the harness usually provisions a fresh sandbox for every single trajectory. Each sandbox pulls layers, boots services, installs dependencies, warms a database or starts a headless browser — and then runs the actual agent loop for five minutes.

You pay twice for that setup: once in wall-clock iteration speed while engineers wait for runs to finish, and again in compute seconds spent executing the exact same setup script thousands of times.

Set up once, fork for every rollout

In TaskCloud, every sandbox is a Firecracker microVM with its own Linux kernel, Ubuntu 24.04, root, systemd and Docker inside. Instead of scripting cold-start setup into every rollout, you prepare one parent VM until the repo, services and caches are warm, and call fork with a count.

The platform captures the parent's memory and disk once and spawns up to 50 independent child microVMs per call (up to 500 on request). Admission is atomic: either your account concurrency quota and host capacity can take every child in the batch, or none is created and you get a clear 409 concurrency_limit_reached or 503 capacity_unavailable.

Our target for bulk fork latency is under 2 seconds. That is an engineering target we are validating on hardware in Phase 0, not yet a published measurement; we will publish measured p50/p95/p99 numbers on the status page once the hardware benchmark runs.

Code: 32 parallel rollouts from one warm parent

Here is the entire pattern using the Python SDK. Pass priority="batch" to queue the rollouts at half price (−50%) and set a safety ttl_seconds so an unhandled exception in the runner never leaves a VM billing overnight:

from concurrent.futures import ThreadPoolExecutor
from taskcloud import Client

client = Client()  # reads TASKCLOUD_API_KEY

# 1. Prepare one parent VM with dependencies and services already running
parent = client.sandboxes.create(template="coding-agent", size="default")
parent.exec("git clone https://github.com/acme/repo && cd repo && make deps")

# 2. Fan out 32 identical VMs, RAM + disk included, at -50% batch rate
children = parent.fork_many(
    32,
    priority="batch",
    labels={"run": "eval-17"},
    ttl_seconds=3600,
)

def run_rollout(child, prompt):
    try:
        child.wait_for("running")
        return child.exec("python /eval/run.py", env={"TASK_PROMPT": prompt})
    finally:
        child.delete()  # per-second billing stops immediately

with ThreadPoolExecutor(max_workers=32) as pool:
    results = list(pool.map(run_rollout, children, prompts))

# 3. Pause the warm parent between runs at $0 compute
parent.pause()

Each child diverges independently on copy-on-write storage (dm-thin) and its own network namespace. A crash, rm -rf or runaway Docker container inside rollout #14 cannot affect rollout #15 or the parent.

Using your existing harness (Harbor, SWE-ReX, OpenHands)

Most eval teams do not want to rewrite their runner to test a new sandbox cloud. We maintain Python backend packages for three harnesses on top of the taskcloud SDK:

  • Harbor (Terminal-Bench 2.0): plugs directly into Harbor's official custom sandbox mechanism via harbor run -e harbor_taskcloud:TaskCloudEnvironment, including fork_trials from one warm parent and streaming exec over SSE.
  • SWE-ReX: implements AbstractDeployment (TaskCloudDeployment) with persistent bash sessions, file upload/download, pause/resume and batch fork.
  • OpenHands SDK: implements RemoteWorkspace (TaskCloudWorkspace) with private port tokens and pause_on_close.

During the private beta, these packages are shared directly with beta teams ahead of public PyPI publication and upstream PRs.

The bill for a whole run: 2,000 rollouts × 6 minutes

What matters for evals and RL is not the headline hourly rate, but the cost of a full run. Two thousand six-minute rollouts on a default machine (4 vCPU / 8 GB RAM / 50 GB disk) equal exactly 200 active VM-hours:

Provider / modeList rate (4/8)200 VM-hours
TaskCloud, batch (−50%)$0.015/h$3.00
TaskCloud, on demand$0.030/h$6.00
E2B / Daytona (list)$0.331/h$66.20
Modal (list)$0.760/h$152.00
Compute only, 4 vCPU / 8 GB per hour. Competitor list prices per battleships.dev (snapshot 2026-10-14); verify current prices on E2B, Daytona and Modal. Excludes setup time saved by forking, plan fees and storage.

Because batch jobs (−50%) may wait in a queue when our EU fleet is busy, every batch create or fork returns a start_deadline (default 12 hours, configurable 1–24 h) and an estimated_start_at so your scheduler always knows when a run will start. Jobs started in the EU night window (22:00–07:00 CET) get the −50% rate automatically.

Things to watch out for when forking live RAM

Memory cloning is powerful, but it changes a few assumptions you might be used to from cold-booted containers:

  • Randomness and unique IDs: all 50 children inherit the parent's userspace memory at the instant of fork. Re-seed PRNGs and generate per-rollout tokens, trace IDs or temp filenames after the fork. TaskCloud's guest agent handles unique VM identity and per-sandbox tokens (such as JupyterLab) automatically.
  • Open external sockets: connections to remote servers created before the fork will not multiplex cleanly across 50 clones. Open outbound HTTP/DB connections inside each child after fork, while keeping local loopback services (Postgres, Redis, dev server inside the VM) running before fork.
  • No GPUs inside the VM: TaskCloud sandboxes are CPU-only on dedicated AMD Ryzen servers. Keep model inference on your inference cluster or API provider and run the environment, tests and browser on TaskCloud.

If you run agent evals or RL rollouts and want to test bulk fork on your workload, tell us which harness and rollout size you run — we will send back a bill breakdown and beta capacity.