Skip to content

Hybrid sandboxes

A new primitive for how agents work.

Your agent runs on a small, diskless worker with access to its workspace. When it needs a full VM, it boots one with the same files.

Agent worker

Small, no disk. Runs your agent through the whole task.

VM

A full environment, there while a command needs it.

Workspace

Your source files. One copy, there the whole task.

Pay less for agent compute

Your agent uses a small worker to read and edit files. It boots a full VM when it needs to run a build or test.

  1. 1Call the model and plan the change

    Runs on the worker

  2. 2Search the workspace and read source files

    Runs on the worker

  3. 3Edit the code and write a test

    Runs on the worker

  4. 4Run the test suite

    Runs on the VM

  5. 5Read the results and revise the code

    Runs on the worker

Agent worker

60 min

Full VM

10 min

tests

$0.120 → $0.039

68% less compute spend for this workload.

ComputeBilled timeCost
Agent worker, 0.25 vCPU and 0.5 GiB60 min$0.019
VM, 2 vCPU and 2 GiB10 min$0.020
Hybrid sandbox$0.039
2 vCPU, 2 GiB machine for the full hour60 min$0.120

Billed VM time includes the time it stays warm after a command. Storage bills separately.

Measured in prod

Median times from the SDK on a laptop, network included. Installed packages and files stay on the sandbox's disk when its VM stops.

  • 0.26 s

    First command on a new sandbox, which boots its VM from a snapshot

  • 26 ms

    Read a file with no VM attached, so no compute bills

  • 0.48 s

    Resume a paused sandbox with its memory and processes

  • 66 ms

    Create a sandbox from an agent worker, on the same host

See every measurement and what survives a stop

Build with Python

Create sandboxes, edit files, and run commands with the floo-sandbox Python SDK. Its API follows Modal's Python sandbox API.

agent.py
# Runs on your agent workerimport floo_sandbox as modal CART = "def total(prices): return sum(prices)\n"TEST = ("from cart import total\n"        "def test_total(): assert total([2, 3]) == 5\n") app = modal.App.lookup("my-agent")image = modal.Image.debian_slim().pip_install("pytest")sb = modal.Sandbox.create(    app=app, image=image, timeout=600, cpu=2, memory=2048) # Edits go straight to the workspacesb.filesystem.write_text(CART, "/app/cart.py")sb.filesystem.write_text(TEST, "/app/test_cart.py") # The test boots a 2 vCPU VM on the same filessb.exec("pytest", "-q", "/app").wait()

Inspired by Cursor

Cursor separates the agent loop from the environment that executes its commands. Hybrid sandboxes bring that architecture to developers building their own agents.

Pricing

Compute bills by the second while a machine runs. Agent workers and VMs use the same rates.

  • $0.045

    per vCPU-hour

  • $0.015

    per GiB-hour of memory

  • $0

    additional compute for workspace file edits

CPU bills at the amount reserved or used, whichever is higher, up to the machine's limit. A paused sandbox's memory and workspace files bill at the storage rate.

Build your agent on floo

Give your agent a workspace it can work in and a full VM when it needs one.