LLM-in-Sandbox

Put your LLM inside a Docker-isolated code sandbox and it beats the standalone model on math, physics, chemistry, long-context and instruction-following tasks — no extra training required, and RL amplifies the gains further.

Stars
★ 248
Last updated
3mo ago v0.2.0
FARS reviewed
Nov 08, 2026
License
Apache-2.0
Primary language
Python

At a glance

How it runs
CLIFramework
Works with
Universal · cross-platformOpenAI API · Claude API
Cost
Free software; you pay for model usage
Setup effort
Low · running in minutes
You'll need
Python 3.10+DockerShell / CLINetwork accessLocal filesystem
Typical use
Researchers reproducing the paper's evaluation showing sandboxing boosts LLM performance on chemistry, physics, math, biomedicine, long-context understanding, and instruction following
Not a fit if
  • Restricted environments where Docker cannot be installed or running code in containers is not allowed
  • Teams wanting a fully hosted, zero-install cloud product
Website
arxiv.org/abs/2601.16206 ↗ set on GitHub
Maintenance
Commits in the last 6 monthslast commit 2026-08-22latest release v0.2.0 (2026-02-11)

What does this agent do, and when should you use it?

LLM-in-Sandbox is an open-source research framework (Apache-2.0) from RUC AI Box at Renmin University of China, accompanying the paper 'Computer Environments Elicit General Agentic Intelligence in LLMs'. Its core idea: place any LLM inside a code sandbox with basic computer functionalities such as a file system and command execution, turning it into a general agent that outperforms standalone LLMs across diverse non-code domains. The software ships as a CLI (llm-in-sandbox run) and is backend-agnostic, connecting to OpenAI, Anthropic, and self-hosted OpenAI-compatible servers like vLLM and SGLang. Execution happens in the Docker image cdx123/llm-in-sandbox:v0.1 (~400 MB, auto-pulled on first run) for security through isolation. Each run writes a timestamped folder under ./output containing answer files and a trajectory.json execution history. The repository also includes a v0.2.0 benchmark module for reproducing paper results, and a companion repo, LLM-in-Sandbox-RL, releasing RL code, models, data, and training logs.

You submit a task via llm-in-sandbox run with a --query and model configuration; the framework launches a Docker sandbox (default image cdx123/llm-in-sandbox:v0.1) and hands the task to the selected LLM, which iteratively executes commands and reads/writes files inside the sandbox for up to --max_steps (default 100) conversation turns. You can mount an input folder via --input_dir; results go to a timestamped folder under --output_dir (default ./output) containing files/answer.txt, produced files, and trajectory.json. The file system acts as long-term memory, with up to 8× token savings reported in the paper. Prompt templates are switched via --prompt_config (default ./config/general.yaml), and the llm_in_sandbox/benchmark/ module reproduces paper evaluations, evaluates any LLM, or adds custom tasks. llm-in-sandbox build builds a custom image from docker/Dockerfile.

  1. Researchers reproducing the paper's evaluation showing sandboxing boosts LLM performance on chemistry, physics, math, biomedicine, long-context understanding, and instruction following
  2. Teams running self-hosted models (e.g., Qwen3-Coder-30B, DeepSeek-V3.2 on vLLM or SGLang) who want general agentic capability without training
  3. Engineers who want LLM code and file execution inside Docker isolation rather than unrestricted setups like OpenClaw
  4. Researchers running reinforcement learning experiments using the open code, models, and wandb logs from LLM-in-Sandbox-RL
  5. Evaluators benchmarking any LLM behind an OpenAI-compatible endpoint across domains via the built-in benchmark module
  6. Agent developers looking for examples in non-coding tasks: scientific reasoning, travel planning, video production, music composition, poster design

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • pip install llm-in-sandbox==0.2.0
  • pip install -e
Config files
./config/general.yaml
Runtime
Python 3.10+
Install notes cover
Linux · Docker

How do you install or deploy this agent?

Prerequisites: Python 3.10+ and Docker. Install Docker if not present:

curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
dockerd > /var/log/dockerd.log 2>&1 &

Install via pip:

pip install llm-in-sandbox==0.2.0

Or from source:

git clone https://github.com/llm-in-sandbox/llm-in-sandbox.git
cd llm-in-sandbox
pip install -e .

The default Docker image (~400MB) is pulled automatically on first run. No local GPU is needed when using API services. Tested on Ubuntu 22.04 with Python 3.10.

How do you use this agent?

Option 1: cloud/API services (supply a base URL and API key):

llm-in-sandbox run \
    --query "write a hello world in python" \
    --llm_name "openai/gpt-5" \
    --llm_base_url "http://your-api-server/v1" \
    --api_key "your-api-key"

Option 2: self-hosted models. Start a vLLM server:

vllm serve Qwen/Qwen3-Coder-30B-A3B-Instruct \
    --served-model-name qwen3_coder \
    --enable-auto-tool-choice \
    --tool-call-parser qwen3_coder \
    --tensor-parallel-size 8  \
    --enable-prefix-caching

Then run the agent in a new terminal:

llm-in-sandbox run \
    --query "write a hello world in python" \
    --llm_name qwen3_coder \
    --llm_base_url "http://localhost:8000/v1"  \
    --temperature 0.7

SGLang serving DeepSeek-V3.2 is also documented (add --extra_body '{"chat_template_kwargs": {"thinking": True}}'). Common parameters: --input_dir (mount input files), --output_dir (default ./output), --max_steps (default 100), --prompt_config (default ./config/general.yaml). Run llm-in-sandbox run --help for all options. See llm_in_sandbox/benchmark/README.md to reproduce paper results.

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • confirmation before acting — Turn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.

What are this agent's strengths and limitations?

Pros
  • Backend-agnostic: works with OpenAI, Anthropic, vLLM, SGLang and any OpenAI-compatible endpoint, avoiding vendor lock-in
  • Docker-isolated execution, a concrete security differentiator versus unrestricted setups like OpenClaw
  • File system as long-term memory with up to 8× token savings per the paper, and cross-domain gains without extra training
  • v0.2.0 benchmark module for direct reproduction; the RL release includes code, models, data, and wandb logs
Limitations
  • Docker is mandatory; the sandbox image pulls ~400MB on first run
  • Effectiveness depends on the underlying LLM — cloud APIs incur per-use costs and self-hosted models need GPU hardware
  • The value rests on research findings; the README offers no documentation for production deployment, authentication, or multi-tenant use
  • Validated on Ubuntu 22.04 with Python 3.10; compatibility on other systems is not explicitly documented

How does this agent compare with similar options?

The README contrasts the project with 🦞 OpenClaw: OpenClaw is an unrestricted agent environment, while LLM-in-Sandbox emphasizes Docker isolation for security. Design and code borrow from R2E-Gym. Related ecosystem releases by the authors include scale-openclaw (Docker-free large-scale OpenClaw trajectory collection on a single machine) and ClawGym (a scalable framework for building claw agents).

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
LLM-in-Sandbox This agent 47 · Major gaps CLIFree + model costs ★ 248 3mo ago Python OpenAI API · Claude API
Functionary: Conversational LLM for Controlled Tool Use 44 · Major gaps Self-hosted serviceFree ★ 1.6k 5mo ago Python OpenAI API
OSWorld 2.1 Computer-Use Agent Benchmark 70 · Some gaps CLIFree + model costs ★ 445 19d ago Python OpenAI API · Claude API
MARTI: Multi-Agent Reinforced Training & Inference for LLMs 40 · Major gaps CLIFree ★ 573 3mo ago Python —

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
47/ 100 5-point scale 2.4 / 5
Trust 8/29
Reliability 8/14
Adaptability 10/18
Convention 11/18
Effectiveness 7/13
Verifiability 3/8
Why each dimension lost points
Trust8 / 29 · 1.4/5

The README claims Docker isolation, but the CLI can mount user directories as input or output, call external LLM APIs, and let task code execute Bash. The supplied evidence does not show container permissions, network restrictions, or a least-privilege configuration, so credit is limited. Per-action confirmation and rollback are not shown. The CLI accepts API keys, and the Agent can save model requests and responses; sensitive-data controls are only lightly described. Dependencies have minimum versions but are not pinned, and no security audit evidence is included. The README acknowledges reused design and code from R2E-Gym and links the paper and project, providing partial attribution evidence.

Reliability8 / 14 · 2.9/5

The README, CLI, and pyproject.toml are broadly consistent on Python, Docker, the default image, and run options, and describe configuration and retry paths. Dependencies have open-ended lower bounds and the image uses a fixed older tag; additional installation fallback evidence is limited. The CLI gives readable messages for image pulls, build failures, and missing Docker. Static materials do not establish runtime correctness.

Adaptability10 / 18 · 2.8/5

The README targets developers and researchers and describes science, long-context, and instruction-following scenarios, with configuration examples for several model services. The code exposes capabilities such as Bash execution, while the supplied materials give limited detail on permission boundaries, networking, and container isolation. CLI parameters and endpoint options are clear. Python 3.10+ and Docker requirements make environment expectations concrete.

Convention11 / 18 · 3.1/5

The README organizes installation, quick start, parameters, outputs, examples, benchmarks, and citation. Package, command, and version naming are consistent. Docker and pip installation plus a custom image build are documented, and the Apache-2.0 license text is present. News lists releases, but the supplied material does not identify a maintenance owner or commitment. Limitations are mostly confined to system requirements and inference latency.

Effectiveness7 / 13 · 2.7/5

Runs produce timestamped answers, files, and trajectories that can be used and inspected. The stated value is file-system memory, cross-domain gains, and support for multiple model backends. Deployment requires Docker and an approximately 400 MB image; API use also incurs model-service costs. The materials do not quantify end-to-end cost-benefit, so credit is partial.

Verifiability3 / 8 · 1.9/5

The README links a paper and provides installation, parameter, and reproduction entry points; pyproject.toml and CLI support some configuration and dependency claims. The supplied materials do not provide independent result checks or corroboration from multiple sources. Performance gains and up-to-eightfold token savings are primarily project claims. Some requirements, tested environment, and performance claims are distinguished, but the evidence behind the claims remains limited.

Risks and how to mitigate them
  • Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
  • Task code can execute Bash and interact with external model services. Check container mounts, network access, and credential handling before supplying sensitive data or keys.
  • Performance gains and token savings are claims in the project materials; this review did not run the code or independently verify those results.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision b58c85c1447b
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/llm-in-sandbox.svg)](https://followagents.com/en/agents/llm-in-sandbox)
<a href="https://followagents.com/en/agents/llm-in-sandbox"><img src="https://followagents.com/badge/llm-in-sandbox.svg" alt="FARS review"></a>

Recent releases

Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.

  1. v0.2.0
    Release notes excerpt
    What's New Benchmark Module - Added benchmark framework to reproduce our paper results and evaluate any LLM/task - Support reward function to facilitate LLM-in-Sandbox-RL - Support for LLM-in-Sandbox and vanilla LLM modes - LLM-as-Judge evaluation Improvements - Restructured README and benchmark docs - Better error handling and Docker cleanup guidance - Clean action, improve observation PyPI - pip install llm-in-sandbox==0.2.0
    View on GitHub ↗

FAQ

Do I need a local GPU?
No. LLM-in-Sandbox is backend-agnostic and connects to any OpenAI-compatible endpoint (OpenAI, Anthropic, or a hosted vLLM/SGLang server). GPUs are only needed if you self-host a model; hardware needs then depend on the model and serving framework.
How long does the first run take?
On a normal desktop, installation takes about 1 minute and the one-time Docker image pull (~400 MB) about 1 minute; subsequent runs start instantly. The quick-start demo completes in ~1 minute, excluding model inference latency.
How do I reproduce the paper's results?
v0.2.0 ships a benchmark module (llm_in_sandbox/benchmark/README.md) for reproducing paper results, evaluating any LLM, and adding your own tasks.
Where does the output go?
Each run creates a timestamped folder in the output directory (default ./output) containing files/answer.txt (final answer), produced files, and trajectory.json (execution history).
Can I use a custom environment?
Yes. Modify docker/Dockerfile and run llm-in-sandbox build to create your own image, then point to it with --docker_image.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts