Best sandbox · SWE-bench evals
The best sandbox for SWE-bench-style coding evals
Updated
A coding eval runs a model's patch against a repository at a fixed commit and counts how many hidden tests pass. The sandbox has to rebuild that repository exactly, keep tasks from touching each other, keep the model away from the tests and the network, and do it for hundreds of tasks at once. kosa8 prepares a repository once, forks it per task into live microVM copies, applies each patch and runs the tests in parallel, then deletes the copies.
01What a coding eval needs from a sandbox
Each SWE-bench-style task is an issue, a repository at a base commit, a set of tests that should go from failing to passing, and a set that must keep passing. The harness checks out the commit, installs the project, applies the candidate patch and runs both sets.
Reproducibility is the hard part: the same task has to see the same files and packages every time. Throughput is the other: installing a project per task is slow, and it is repeated for every model you compare. And because agents sometimes edit tests or fetch answers, the sandbox should make both impossible during the agent's turn.
02Checklist for choosing one
- Exact environment per task. Repository at the base commit, dependencies pinned, built once.
- Copy instead of reinstall. Fork a prepared repository rather than installing it per task.
- Isolation per task. One task's patch or stray process cannot affect another.
- Hidden tests. Tests added after the agent's turn, where it cannot edit them.
- No network during the agent's turn. So answers cannot be fetched.
- Exit codes you can script. Pass or fail read from the test run.
- Cleanup that cannot be forgotten. Copies deleted even when the harness crashes.
03How kosa8 meets it
Build one template per repository and base commit, with the project installed, so the sandboxes need no network. Then fork a prepared base per task. Every plan carries sandboxes, checkpoints, rewind and forks; kosa8 explore needs Pro and governance Team, and the plan sets how many forks run at once (see pricing).
FROM python:3.12-slim ARG COMMIT RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/* RUN git clone https://github.com/pallets/click /repo && git -C /repo checkout "$COMMIT" \ && pip install --no-cache-dir -e /repo pytest
kosa8 template build click-base ./env --build-arg COMMIT=<base commit>
from concurrent.futures import ThreadPoolExecutor from kosa8 import Kosa8Client client = Kosa8Client() client.create_sandbox(name="base-click", template="click-base", egress="deny", mem_mb=2048) client.shell("base-click", "cd /repo && git status --short") # start the shell session before forking def run(task, sid): client.write_file(sid, "/workspace/patch.diff", task["patch"]) r = client.shell(sid, "cd /repo && git apply /workspace/patch.diff && " "python -m pytest -q " + " ".join(task["tests"]), timeout_s=900) return task["id"], r.ok forks = [f["id"] for f in client.fork("base-click", len(tasks), prefix="task-")["forks"]] try: with ThreadPoolExecutor(8) as pool: results = dict(pool.map(run, tasks, forks)) finally: for sid in forks: client.delete_sandbox(sid) print(f"resolved {sum(results.values())}/{len(results)}")
tasks is your list of records with an id, a patch and the tests to run, one per instance of that repository and commit. The step-by-step guide covers the Dockerfile, running an agent in each fork before scoring, and keeping the network closed during the agent's turn.
04When another option fits better
- Leaderboard submissions. SWE-bench's official harness builds a Docker image per instance and is what published results are compared on. Use it for numbers you will report; use forks for fast iteration during development.
- Very large sweeps in someone else's cloud. Hosted eval platforms run thousands of instances on their fleets. kosa8 Cloud runs up to 1,000 sandboxes at once on the Scale plan; locally you are bounded by your machine.
- Repositories that need a GPU. A kosa8 sandbox with a GPU cannot be forked, so those tasks need a fresh sandbox each.
05FAQ
Can kosa8 run the official SWE-bench harness?
The harness drives Docker, and kosa8 answers the Docker API on your machine, but kosa8 has not tested the harness against it. The fork-per-task pattern on this page uses only kosa8's own documented SDK calls.
How are tasks kept from affecting each other?
Each fork is its own microVM with its own kernel, disk and network rules, restored from one snapshot of the prepared base. A patch, a test run or a stray process in one cannot reach the others or the base.
How do I keep the agent from editing the tests?
Let the agent work in the fork first, then write the hidden tests in with write_file and run them. The agent's turn never sees them.
What does it cost?
Locally, nothing per sandbox; the plan sets how many forks run at once. On kosa8 Cloud, a running sandbox uses the Cloud sandbox-hours its plan includes; see pricing.
06Get started
Install kosa8 on a Mac, Linux or Windows (WSL2) machine, or make an account and run the same sandboxes on kosa8 Cloud.
07Sources
- kosa8 docs: RL rollouts and evals (Python)
- kosa8 docs: Try several ideas at once
- SWE-bench
- SWE-bench repository
- kosa8 command reference
Related
- How do I run SWE-bench-style evals in parallel sandbox forks?
- How do I build an RL environment rollout loop on sandboxes?
- How do I try several AI agent approaches in parallel?
- How do I run untrusted LLM-generated code safely?
- All best-sandbox pages
Updated 2026-11-14