Readie: Low-Latency Code Sandboxes for AI Agents

Arjun Sivaraman, Zhaoheng Li, Alan Shi, Sanjay Malisetty, Eugene Wu, Yongjoo ParkarXiv 2026 · arXiv

TL;DR

Readie is a high-performance code sandbox system designed to eliminate the "cold start" problem for AI agents. By using a small set of optimized, pre-warmed memory-state snapshots instead of giant static images, Readie reduces sandbox startup latency by 3–22× and end-to-end runtime by 1.3–3.3× while remaining highly storage-efficient.

What Problem Does This Paper Address?

AI agents (like those powered by LLMs) act by iteratively generating and executing code. To keep these agents secure and portable, their code is typically run in isolated "sandboxes." However, these sandboxes are notoriously slow to start.

The authors identify a fundamental tension:

  1. Custom Images: Building a unique container for every request is slow because layers must be downloaded and provisioned.
  2. Fat Images: Using one giant image (like Google Colab) containing every possible package is heavy to load and still incurs significant overhead because Python must still "import" packages from disk into memory.
  3. Dynamic Needs: Agents often don't know what packages they need until they are mid-task. As shown in the paper's analysis, agents frequently request new packages several turns into a session.
Figure 2. New packages that each of 10 agent sessions requests for the first time at each turn (light blue), and their mean at each turn (red), rounded up. It also shows the actual packages requested in one of the trajectories (solid blue).

Methods

Readie introduces the concept of learned startup snapshots. Instead of one-size-fits-all, it creates a small set of "memory-state" snapshots—checkpoints of a process that has already imported a specific set of libraries.

The Core Approach:

  • Memory-State Restoration: Rather than loading files from disk, Readie clones a sandbox from a pre-warmed memory snapshot. This skips the slow process of searching for modules, reading files, and compiling bytecode.
  • Optimization Problem: The authors formulate snapshot selection as a Budgeted Facility Location problem. They aim to find a set of snapshots that minimizes the total initialization time (restore time + residual import time for missing packages) across a large training workload, all within a fixed storage budget.
  • The Cost Model: Readie calculates the cost of a request based on the time to restore a snapshot (which grows with snapshot size) plus the time to import any "residual" packages that the snapshot lacks.
  • Greedy Selection: Since finding the absolute optimal set of snapshots is NP-hard, Readie uses a greedy approximation algorithm to select the most effective snapshots for a given workload.
Figure 4. Conceptual difference between per-request snapshots (massive storage) vs. Readie's shared snapshots (efficient storage with small residual imports).

Datasets

The authors evaluated Readie using a diverse dataset of 15,299 code execution requests spanning 16 data science domains. The data was sourced from:

  • LLM-Generated Content: Snippets and notebooks synthesized by frontier models.
  • Agent Benchmarks: Real-world trajectories from benchmarks like DA-Code, DSBench, and InfiAgent.
  • Public Repositories: Scripts and notebooks from Kaggle and Hugging Face.

The evaluation included a "Planning set" for training the optimizer, a "Validation set" for tuning, and a "Test set" (plus an out-of-distribution set) to measure real-world performance.

Key Insights and Ideas

  • The Power of "Close Enough": You don't need a perfect snapshot for every request. A small set of snapshots can cover the "heavy hitters" (like numpy, pandas, torch), and the agent can quickly pip install or import the few remaining niche packages it needs.
  • Cloning Beats Importing: Restoring from a memory snapshot is significantly faster than importing from a file-based image. For a package like nltk, restoring a snapshot takes ~0.42s, whereas importing from source takes ~7.28s.
Figure 3. Analysis of startup cost. (a) Loading a pre-built image becomes slower if layers need to be downloaded or artifacts are missing; (b) If artifacts reside on disks, cloning/restoring from a memory-state snapshot is faster than reading artifacts (i.e., Python packages here) from original source code or cached bytecode.
  • One-to-Many Mapping: Data science workloads naturally cluster. The authors found that just a few snapshots could efficiently serve thousands of diverse requests. For example, one core cluster (containing matplotlib, numpy, pandas, scikit-learn, and seaborn) served 82% of their requests.

Key Results

  • Massive Speedups: At a 15 GB storage budget, Readie initializes sandboxes 3× faster than per-request snapshots with caching and 6.3× faster than a standard "fat" image.
  • Storage Efficiency: Readie matches the performance of "perfect" per-request snapshots while using 14× less storage.
  • End-to-End Impact: For complex agent tasks, Readie reduced the total time to complete a benchmark by 1.3–3.3×. On the InfiAgent benchmark, initialization time was slashed by 16×.
  • Robustness: Even on "unseen" workloads (out-of-distribution), Readie remained 2× faster than the next best baseline.

Limitations and Future Work

  • Import Side Effects: The current cost model assumes that importing extra packages (residuals) doesn't interfere with the environment. However, some Python packages perform "monkey-patching" or have global side effects upon import, which could lead to subtle bugs.
  • Static Planning: While Readie generalizes well, the snapshots are currently planned offline. Future iterations could explore online learning to adapt snapshots dynamically as agent behavior evolves.
  • File System Isolation: Currently, sandboxes do not share the host file system for security. Data must be passed into the remote function as variables, which might be inefficient for massive datasets.

For more details, you can find the full paper on arXiv under the identifier 2611.22171v1.

Summary updated

Abstract

From quantitative research to personal assistance, AI agents act by iteratively generating and executing code. To decouple the agent harness from code execution, many agents offload execution to dedicated systems called code sandboxes. However, existing code sandboxes suffer from slow startup. Whether they rely on custom snapshots or a single fat image, the root cause is the same: it is hard to build a compact, pre-warmed snapshot that can be shared across diverse agent-generated code while covering nearly all the artifacts (e.g., packages, datasets) it requires. In this work, we propose learned startup snapshots for low-latency code sandboxes. Our insight is that while it is hard for a single snapshot to be both compact and cover most workloads, a set of snapshots can achieve both. Each snapshot is small, initializes quickly, and covers a fraction of agent-generated code; together, the set covers most of it. We learn this set from a large training workload by formulating snapshot construction as an optimization problem and solving it with an approximation algorithm. Planned on 15K public and LLM-synthesized scripts, our system, Readie, reduces startup latency by 3-22$\times$ and end-to-end runtime by 1.3-3.3$\times$ compared to existing approaches at the same storage budget.
BibTeX
@misc{sivaraman2026readie,
  author = {Arjun Sivaraman and Zhaoheng Li and Alan Shi and Sanjay Malisetty and Eugene Wu and Yongjoo Park},
  title = {{Readie: Low-Latency Code Sandboxes for AI Agents}},
  year = {2026},
  eprint = {2611.22171},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.22171},
}
Figure