STACX (STand Alone CompleX) is a modular framework for agentic training, evaluation, and reinforcement learning.
Every run follows the same path: a benchmark task is handed to an agent that works inside a real sandbox container, a verifier scores the result, and the scored traces flow back to the trainer.
dataset config → rollout scheduler → agent + sandbox → verifier reward → trainer
With STACX you can:
- Train an agent with GRPO, SFT, DAgger, or on-policy distillation (jump to Train)
- Evaluate an agent — installed scaffolds or the in-house agents (jump to Evaluate)
- Integrate a new benchmark environment (jump to Integrate)
STACX glues three engines together. In practice, you set up two things: the
sandbox engine, a ROCK-based Python service that owns Docker containers
and exposes the rock admin CLI, and the train/eval runtime, a pinned
Docker image the train and eval drivers run in.
| Path | What it is |
|---|---|
rl_engine/trainer/ |
Training engine — declarative recipes over Megatron / FSDP backends. |
rl_engine/rollout/ |
Task scheduler, agents/scaffolds, reward routing. |
rl_engine/examples/ |
One directory per benchmark. |
env_engine/ |
Sandbox engine — starts task containers and runs verifiers. |
scripts/ |
End-to-end training launchers (GRPO, SFT, DAgger, distillation). |
Agents run in one of two lanes, and both training and evaluation are organized around them:
- In-house agent lane — the agent loop is implemented in this repo
(
rl_engine/examples/{swe_agent,mle_dojo,retool}), so the trainer and evaluator see every token natively. This is the lane behind allscripts/train/swe/recipes. - Installed-agent lane — an external scaffold (OpenHands / Terminus-2) is
installed black-box inside the task container, with its LLM traffic
redirected to your SGLang server. Any benchmark in the standard task format
runs through the shared infra in
rl_engine/examples/shared/.
- Linux with Docker (NVIDIA runtime for GPU workloads); the sandbox engine also supports Podman
uv—curl -LsSf https://astral.sh/uv/install.sh | sh- CUDA-capable GPUs for model serving and training
- Enough local disk for per-task Docker images, logs, and checkpoints
docker login— anonymous Docker Hub pulls hit rate limits during task-image builds- No HuggingFace login needed — all referenced models and datasets are public
(one exception: the ReTool example expects a user-supplied checkpoint — see
rl_engine/examples/retool/README.md)
Clone the repo, then set up the three components below.
git clone <this-repo> && cd stacxThe sandbox engine runs in its own environment and must be started before any eval or training that executes verifiers. In a separate terminal:
cd env_engine
uv venv --python 3.11 --python-preference only-managed
uv sync --all-extras
source .venv/bin/activate
rock admin start # listens on http://127.0.0.1:8080Verify Docker and the sandbox engine are reachable:
docker --version
curl http://127.0.0.1:8080/More detail lives in env_engine/README_ROCK.md.
Train and eval drivers run inside this image via the thin wrappers
shared/docker_run_train.sh / shared/docker_run_eval.sh:
docker pull lichangh20/slime-rl:stableInstalled-agent eval talks to an external SGLang server; it runs from a small pinned uv env at the repo root (SGLang new enough for Qwen3.5 — the training image's is too old):
uv venv .venv-sglang --python 3.11
source .venv-sglang/bin/activate
uv pip install --prerelease=allow "sglang[all]==0.5.10rc0"Only installed-agent eval uses this external server. Everything else — training in both lanes and in-house agent eval — is self-contained: the run serves SGLang in-process inside the training image, so those models are limited to what the image supports (Qwen3 family), while installed-agent eval also covers newer models like Qwen3.5.
Once per server, set the host IP in the site profile (the sandbox GPU
budget — gpus, minus the serving GPUs — lives in the same file; see
AGENTS.md §2.4):
sed -i "s/REPLACE_WITH_SERVER_IP/$(hostname -I | awk '{print $1}')/" \
rl_engine/examples/shared/profiles/cluster_layout_default.jsonDevelopment setup (optional). For host-side development and CPU tests only:
bash scripts/setup_env.sh(add--cpufor a CPU-only install), thensource activate_stacx.sh.
The full runbook with per-step verify points is AGENTS.md.
The launch scripts under scripts/ encode the model, data, Docker, Ray, SGLang,
sandbox engine, checkpoint, and W&B settings for each recipe — start from one of
these rather than calling rl_engine.train directly.
| Recipe | Script (_4b; use _8b for the 8B variant) |
|---|---|
| GRPO — on-policy RL, reward-only | scripts/train/swe/grpo/grpo_4b.sh |
| SFT — iterative SFT on saved teacher trajectories | scripts/train/swe/sft/sft_4b.sh |
| OPD — on-policy distillation (reverse-KL vs. teacher) | scripts/train/swe/opd/opd_4b.sh |
| DAgger — online DAgger + OPD (β-mixture rollin) | scripts/train/swe/online_dagger/dagger_4b.sh |
| DAgger (AggreVaTe) — DAgger + OPD, forced-expert tail | scripts/train/swe/online_dagger/aggrevate_4b.sh |
See scripts/train/swe/QUICKSTART_OPD.md for the DAgger-OPD walk-through.
Other in-house training recipes:
- Tool-calling math GRPO (ReTool) —
rl_engine/examples/retool/README.md
Example:
WANDB_KEY=<your_key> bash scripts/train/swe/grpo/grpo_4b.shEvery training run needs:
- Sandbox engine admin running on
127.0.0.1:8080 - The runtime Docker image
lichangh20/slime-rl:stable(or equivalent) - Model checkpoints under
external/models/and datasets underexternal/data/ - A W&B key when W&B logging is enabled
Each launch script has a detailed header documenting its data, model paths, GPU
layout, defaults, and override variables — read it before running. The
scripts auto-resume from resume_state.json and write checkpoints, logs, and
eval artifacts under external/{ckpts,logs,results}/.
rl_engine/examples/shared/train.sh is the closed-loop train entry for the
installed-agent lane: rollout on the train bench through the recording proxy
(token capture) → SFT/GRPO update → weight sync → periodic eval on the eval
bench — all in one Ray job.
Prerequisite: both the train bench and the eval bench need their generated task artifacts first — run each bench's
prepare_jsonl.py+build_images.shstep (seerl_engine/examples/skyrl/README.mdand the Evaluate a benchmark section below).train.shexits with a clear error iftasks.jsonlor the tests bundle is missing.
# SFT on SkyRL-293, eval on SWE-bench (Django-100) — the defaults
BENCH=skyrl EVAL_BENCH=swebench SCAFFOLD=openhands ALGO=sft \
bash rl_engine/examples/shared/docker_run_train.sh
# GRPO, same axes
ALGO=grpo bash rl_engine/examples/shared/docker_run_train.shAxes: BENCH (train-enabled: skyrl), EVAL_BENCH (default swebench; any
example with config/eval_datasets.yaml + build_evaluators_${SCAFFOLD}),
SCAFFOLD (openhands | terminus2), ALGO (sft | grpo).
Routing is by task_type == evaluator_id: the train rollout registers the
bench's evaluator with proxy, eval registers the plain one.
docker_run_train.sh is a thin container wrapper — with a suitable host env,
run train.sh directly. It detaches and prints a tail -f command to follow
the run (driver log: external/results/train/<container name>.log).
Evaluation follows the same two lanes:
| Lane | Benchmarks | Entry point |
|---|---|---|
| Installed agent — OpenHands / Terminus-2 run black-box inside the task container | swebench, terminal_bench, algotune, kernel_bench, seta, skyrl |
rl_engine/examples/shared/docker_run_eval.sh |
In-house agent — this repo's own agents, via the eval-only path of rl_engine.train (--num-rollout 0) |
SWE-bench Verified, MLE-Dojo, AIME | per-example scripts/eval.sh |
Evaluation is four commands: download the Harbor task tree, convert it to a
tasks.jsonl, build the per-task Docker images, then run the shared eval
script.
Before you start: The site profile must be set up (Installation step 4), the sandbox engine must be running (step 1 above), and a SGLang server for your model must be reachable at
SGLANG_ROUTER_IP:SGLANG_ROUTER_PORT. The eval driver connects to that server rather than launching one. To start one (in its own terminal, using the env from step 3):source .venv-sglang/bin/activate bash rl_engine/examples/shared/serve_sglang.sh curl http://<node-ip>:9001/v1/models # 200 = readyIt reads the same site profile as the eval, so the serving GPUs, TP size, and address match automatically (defaults:
Qwen/Qwen3.5-35B-A3B-FP8, port 9001); see the script header for MODEL/PORT/GPU knobs.
Example — SWE-bench (Django-100 subset). Harbor task trees stage in the
repo-local external/harbor-datasets/ (gitignored), downloaded straight
from the public Harbor registry — no Harbor install needed:
# 1. Download the Harbor task tree (Django-100 subset; without
# --task-names-file the FULL ~500-task verified set downloads and
# step 3 then builds ~500 images)
python rl_engine/examples/shared/download_tasks.py [email protected] \
-o external/harbor-datasets/swebench-verified_1.0 \
--task-names-file rl_engine/examples/swebench/config/django100_task_names.yaml
# 2. Harbor task dirs → tasks.jsonl
python rl_engine/examples/shared/prepare_jsonl.py \
--tasks-dir external/harbor-datasets/swebench-verified_1.0 \
--task-names-yaml rl_engine/examples/swebench/config/django100_task_names.yaml \
--output rl_engine/examples/swebench/config/tasks_django100.jsonl \
--registry swebench
# 3. Build the per-task images
bash rl_engine/examples/shared/build_images.sh \
rl_engine/examples/swebench/config/tasks_django100.jsonl
# 4. Run eval (OpenHands scaffold; use SCAFFOLD=terminus2 for Terminus-2)
BENCH=swebench SCAFFOLD=openhands SGLANG_ROUTER_PORT=9001 \
bash rl_engine/examples/shared/docker_run_eval.shOutputs land under external/results/eval/: the per-task results JSONL, its
.summary.json, the driver .log, and per-task sandbox logs under
container_logs/<run>/. The wrapper detaches and prints a tail -f command
to follow the run.
Each example shares the same layout (evaluator_config.py + config/ +
README.md) and runs through shared/docker_run_eval.sh with BENCH=<name>.
Each example's README is the self-contained walkthrough: download (or
generate) the task tree, prepare, build, run.
BENCH |
README |
|---|---|
swebench |
rl_engine/examples/swebench/README.md |
terminal_bench |
rl_engine/examples/terminal_bench/README.md |
algotune |
rl_engine/examples/algotune/README.md |
kernel_bench |
rl_engine/examples/kernel_bench/README.md |
seta |
rl_engine/examples/seta/README.md |
skyrl |
rl_engine/examples/skyrl/README.md |
docker_run_eval.sh is a thin container wrapper — eval logic stays in
eval.sh, and the variables below pass through (see the header of eval.sh
for the full list). Path-valued vars (EVAL_CONFIG, CLUSTER_LAYOUT) are
read inside the container, where the repo is mounted at /root/stacx_eval:
pass repo-relative paths (valid on host and container alike), never
host-absolute ones like $PWD/.... The exception is EVAL_DETAILS_PATH,
whose external/results default is same-path mounted:
| Variable | Meaning |
|---|---|
BENCH |
Example dir under rl_engine/examples/ (required). |
SCAFFOLD |
openhands (default) or terminus2. |
PROFILE |
Site profile in shared/profiles/; defaults to default. |
HF_CHECKPOINT |
Model checkpoint used by the rollout/eval process. |
SGLANG_ROUTER_IP / SGLANG_ROUTER_PORT |
Address of the SGLang server the scaffold talks to. |
EVAL_CONFIG |
Eval dataset YAML; defaults to the example's config/eval_datasets.yaml. Repo-relative path (see above). |
EVAL_DETAILS_PATH |
Output JSONL of per-sample results (reward, termination reason, verifier data). Defaults to a timestamped file under external/results/eval/ — set only to write elsewhere. |
Each in-house agent example ships a standalone eval script that drives the
eval-only path of rl_engine.train (--num-rollout 0) — the same agents the
training recipes use, so a trained checkpoint evaluates in exactly the loop it
was trained in. These runs are self-contained: the container serves the model
in-process, so no external SGLang server (Installation step 3) is needed.
| Eval | Script |
|---|---|
| SWE-agent — in-house SWE agent on SWE-Gym / SWE-bench Verified | rl_engine/examples/swe_agent/scripts/docker_launch.sh (host wrapper around eval.sh) |
| MLE agent — MLE-Dojo Kaggle competitions (eval-only lane) | rl_engine/examples/mle_dojo/scripts/eval.sh |
| ReTool — tool-calling math agent on AIME | rl_engine/examples/retool/scripts/eval.sh |
Each script's header documents its environment variables (dataset paths, required host mounts, Ray ports) — read it before running, and see each example's README for the full walkthrough.
Two steps take a benchmark from raw source to a runnable STACX example.
Step 1 — convert to Harbor task format. One directory per task, each with
instruction.md, task.toml, environment/Dockerfile, and tests/test.sh.
The verifier must write a bare float reward to /logs/verifier/reward.txt.
If the benchmark is already in the public Harbor registry
(python rl_engine/examples/shared/download_tasks.py --list), download it
directly; otherwise write an adapter using the
stacx-adapter-creator skill.
Step 2 — add the STACX example. Use the
stacx-example-integrator skill to create
rl_engine/examples/<bench>/ so the benchmark runs through the shared eval
path (shared/docker_run_eval.sh).
The skill documents the required layout and the
profile knobs. Then run:
python rl_engine/examples/shared/prepare_jsonl.py \
--tasks-dir external/harbor-datasets/<bench> \
--output rl_engine/examples/<bench>/config/tasks.jsonl \
--registry <evaluator_id>
bash rl_engine/examples/shared/build_images.sh \
rl_engine/examples/<bench>/config/tasks.jsonl
BENCH=<bench> bash rl_engine/examples/shared/docker_run_eval.shKey invariant: BenchmarkProfile.evaluator_id must equal task_type in
config/eval_datasets.yaml. Reference implementations: terminal_bench (none),
swebench (artifact capture), algotune / kernel_bench / seta (one or two
correctness-only overrides).
- Diffusion RL — reinforcement learning for diffusion models. An experimental version already lives under
rl_engine/examples/diffusion/. - More installed-agent scaffolds — bring additional black-box coding agents (e.g., Claude Code) into the installed-agent lane, alongside OpenHands and Terminus-2.
If you find STACX helpful, please cite:
@misc{stacx2026,
author = {STACX Contributors},
title = {STACX: A Modular Infrastructure for End-to-End Agentic Reinforcement Learning},
year = {2026},
howpublished = {\url{https://github.com/STACX/stacx}},
urldate = {2026-07-15}
}STACX is released under the Apache License 2.0.
The SWE-bench evaluation backends under
rl_engine/examples/swe_agent/evaluation/backends/ vendor MIT-licensed code from
SWE-bench and its forks — see
THIRD_PARTY_NOTICES.md.
STACX builds on excellent foundation work from the open-source community: