STACX — STandAloneCompleX

A Modular Infrastructure for End-to-End
Agentic Reinforcement Learning.

Changhao Li*† · Haotian Sun*‡ · Huijie Tang* · Rushi Qiang · Chenxiao Gao
Lab PI: Bo Dai  ·  Georgia Institute of Technology
* Core Contributor    Agent Systems & Project Lead    Training Lead
Modular Orchestration Declarative Recipes Pluggable Model Specializations Agent-as-a-Service
Motivation

Why Agentic RL Needs a New Infrastructure Stack

Standard RLHF stacks assume a single model, a reward signal, and a relatively closed training loop. Agentic RL breaks this assumption: policies call tools, run inside scaffolds, and interact with long-horizon environments that must be executed, scheduled, and scaled.

Motivation: Existing RL Infra vs STACX The left panel shows existing RL infrastructure built around single-model RLHF pipelines. The right panel shows STACX targeting agentic RL with unified multi-model support and agent-environment scaling. Existing RL Infrastructure OpenRLHF · veRL · TRL Single LLM Reward Model PPO / RLHF Limitations: Single model type only No agent scaffolding Limited env interaction Hard to scale agents STACX — Agentic RL Purpose-built for the agentic paradigm Automatically incorporating agent-environment interactions Unification Heterogeneous models & agents LLMs Diffusion Reward Custom Diverse Scaffolding Unified Agent ✓ SFT · RL · Eval · Multi-turn Agent-Env Scaling Agents × diverse environments at scale Agent Agent Agent Code Math Tool-use Multi-node Docker clusters ✓ Heterogeneous environments ✓ Containerized sandboxes

The core shift: Agentic RL turns post-training from single-model optimization into two infrastructure requirements: unifying heterogeneous models and agent scaffolds, and scaling agent-environment interaction across distributed sandboxes.

System Overview

RL post-training as a distributed
orchestration problem

Agentic RL is no longer dominated by model compute alone. STACX decouples training, rollout, and sandboxed environment execution into independently schedulable services, allowing each component to scale, evolve, and be optimized around its own bottleneck.

Design principle

Keep algorithms lightweight; move system complexity into stable service boundaries: training, rollout, inference serving, sandbox execution, and data buffering.

STACX Overall Framework A continuous loop connecting Data Buffer, Customized Rollout Logic, Environment Engine, Training Backend and Model Inference Server with GPU arrays. Trainer Pretrain + SFT + RL Rollout + Environment Generation & evaluation Data Buffer Replay & batching Customized Rollout Logic Environment Engine GPU GPU GPU GPU Training Backend Megatron / FSDP Model Inference Server SGLang inference send sample send request send exec result training data send request update weights GPU GPU GPU GPU GPU GPU GPU GPU

STACX system loop. Training, rollout, inference-time serving, and environment execution are separated into services connected by shared data buffering and weight synchronization.

ROLLOUT ENGINE

Generate

Orchestrates inference, agent scaffolds, and environment execution to generate training-ready trajectories.

TRAINER ENGINE

Optimize

Consumes trajectory batches and updates policy weights through recipe-defined objectives.

ENVIRONMENT ENGINE

Execute

Runs long-lived sandbox environments behind a narrow, scalable interface.

Key Features

Capabilities Enabled by the Architecture

STACX decomposes training, rollout, scheduling, and environment execution into stable, independently extensible services.

Modularization

Decouples training, rollout, model serving, data buffering, and environment execution into independently scalable subsystems.

Versatility

Supports post-training for LLMs across SFT, RL, reward modeling, and evaluation workflows.

Customizable Agent Runtime

Plugs in agent scaffolds, tools, and multi-turn task logic through a standard rollout interface.

Automatic Environment Scaling

Scales long-running, containerized environments across multi-node clusters for parallel agent-environment interaction

22
Built-in Recipes
2
Training Backends
64
Concurrent Sandboxes
6
Built-in Benchmarks
ENGINE 01 — ROLLOUT SERVICE

The Rollout Engine

We now zoom into the rollout side of the system loop: the Rollout Engine receives samples, schedules evaluator instances, and runs multi-turn agent–environment interactions to produce training-ready trajectories.

01Level 1 — RolloutManager Control Plane

This expands the Customized Rollout Logic box from the system overview. The RolloutManager pulls samples from DataSource, allocates resources through TaskScheduler, and dispatches task-specific Evaluators to execute trajectories.

RolloutManager Architecture RolloutManager DataSource Training Samples TaskScheduler ResourcePool GPU • CPU • Memory Agent Manager Scaffolding · Lifecycle Schedule Strategy 1. FIFO Strategy2. Task-Aware Strategy Retool Evaluator Agent Env Reward Resource MLE Evaluator Agent Env Reward Resource SWE Evaluator Agent Env Reward Resource

Task environments are normalized into a unified Harbor-style format, with shared metadata, prompts, tools, stopping conditions, and reward definitions, so new tasks can be added with minimal glue code.

Zooming in: Each evaluator dispatched by the RolloutManager runs the multi-turn loop below.

Multi-turn Agentic Loop for turn in range(max_turns): Agent.action() tool_call Environment.step() acquire resource → step → release tool_response Agent.manage_context() next turn Reward.get_reward() Environment.cleanup()

Each Evaluator runs an async-native multi-turn loop, enabling hundreds of trajectories to execute concurrently.

02Level 2 — Evaluator Multi-Turn Loop

This expands a single Evaluator launched by the RolloutManager. Each Evaluator runs a multi-turn episode by coordinating agent actions, environment steps, reward computation, resource management, and trajectory construction.

Resource allocation

Resources are acquired before each env.step() and released immediately after, including on exceptions.

Loss mask

Only model-generated tokens are trained on; environment observations are masked out.

03Task Scheduling

The scheduler groups pending tasks by type and dispatches them to evaluators. Scheduling policies are pluggable: FIFO, priority, fair-share, or task-aware strategies can be swapped in without changing evaluator logic.

FIFO Strategy

Processes batches in arrival order. Simple and predictable for homogeneous workloads.

Task-Aware Strategy

Interleaves task types across batches to balance multi-task training and reduce catastrophic forgetting.

Task Scheduling Incoming Tasks Retool MLE SWE Retool MLE SWE TaskScheduler 1. Compose batches by task_type Batch: Retool ×2 Batch: MLE ×2 Batch: SWE ×2 2. Agent Manager Scaffolding · Lifecycle Per-task agent orchestration 3. Decide execution order Schedule Strategy FIFO or Task-Aware Evaluators Retool Agent Env Reward MLE Agent Env Reward SWE Agent Env Reward

Tasks are grouped into batches by task_type, agents are managed per task, then the active strategy (FIFO or Task-Aware) sets execution order before dispatch to the matching evaluators.

04Resource Scheduling

Users specify a global resource budget, and STACX allocates per-task resources before launching evaluators or sandboxes. Resources are acquired atomically and released when each episode finishes.

Two-level pools

Evaluators draw from a global budget to form local pools, while each task acquires the resources it needs at runtime.

Deadlock prevention

Before scheduling, STACX verifies that the pool can satisfy each evaluator’s budget, ensuring all-or-nothing resource acquisition.

05Agent-as-a-Service

STACX plugs external agent scaffolds into the RL loop as black-box services. A lightweight proxy captures actions, tool calls, observations, rewards, and traces from systems such as Terminus2 or OpenHands, then converts them into training-ready rollout trajectories.

Black-box integration

Connect existing agent frameworks without modifying their internals.

Unified rollout interface

Normalize heterogeneous agent executions into trajectories that support evaluation, reward computation, and policy training.

06Two RL Workflows

The same rollout interface closes the RL loop in two complementary ways: Batch RL collects high-throughput trajectories from parallel simulated environments, while On-Call RL learns continuously from a deployed agent's real-world interactions.

Batch RL Training
Enumerate agents across diverse simulators in parallel
Batch RL Training Agent Pool Agent 1 Agent 2 Agent 3 Simulators Code Env Math Env Tool-use Env Trajectory Buffer Policy Update Offline · Parallel · Large-scale enumeration

Offline & high-throughput. Agents run across simulated environments in parallel; trajectories are buffered and consumed by the trainer for reproducible large-scale policy updates.

On-Call RL Training
Collect real-world interactions; a daemon resumes training
On-Call RL Training Deployed Agent act observe Real-World Scenario Interaction Log monitor Daemon Agent triggers training Resume Train update weights Online · Real-world · Continuous improvement

Online & continuous. A deployed agent produces interaction logs in live scenarios; a daemon monitors those logs and triggers training when new data is ready, closing the loop with real-world feedback.

ENGINE 02 — TRAINING SERVICE

The Trainer Engine

A modular optimization layer that consumes rollout batches, applies recipe-defined objectives on distributed GPU workers, and publishes the updated policy weights. New algorithms, model specializations, and training backends drop in cleanly — without touching rollout or environment execution.

01Architecture

A single training path covers GRPO, PPO, DPO, SFT, and online reward modeling — so there is no need to maintain a separate trainer implementation for each method.

Trainer Architecture StacxTrainer orchestration loop • dispatches to roles • runs syncs + add new recipe via TrainingConfig shared infra role-specific algo TrainBackend Computation engine for gradient updates BACKEND OPTIONS Megatron-LM TP + PP + DP + CP FSDP v2 HuggingFace transformer models + add new backend... RoleWorker Per-role Ray actors for model training delegates to ModelSpecialization SPECIALIZATION OPTIONS Actor Critic DPO DualRole Diffusion + add new spec...

StacxTrainer separates shared infrastructure from role-specific algorithm logic: the backend handles the mechanics of distributed training, while role workers and model specializations carry the method-specific behavior.

Training orchestration

Every step ingests a batch of rollout data, applies the recipe's optimization objective, and dispatches trainable roles to distributed GPU workers — coordinating shared weights safely throughout.

Role-based workers

Each semantic model role maps to a RoleWorker group on a Ray pool, cleanly separating algorithm-level responsibilities from physical resource placement.

Backend ↔ specialization split

Backends own system concerns — sharding, checkpointing, and weight synchronization — while model specializations define the objectives and role-specific behavior, reusable across model families.

02RoleWorker Flexibility

The specialization layer decouples a model's identity from its training role, unlocking flexible deployment across algorithms.

RoleWorker Flexibility One Model → Multiple Roles DeepSeek-R1 single checkpoint Actor policy gradient Critic value function Reference KL anchor DualRole shares weights across roles Multiple Models → One Role DeepSeek-V3 model A Qwen-72B model B Policy same role type Ensemble training, model comparison RoleWorker = Ray Actor Pool • Any model ↔ Any role via Specialization
RoleWorker = Ray Actor Pool

Any model maps to any role through its specialization — covering policy-only, actor-critic, reference-model, reward co-training, and heterogeneous experiments alike.

One model → many roles

A single checkpoint can serve as actor, critic, and reference at once. DualRole shares those weights across roles for PPO-colocated, GRPO, and online reward-modeling setups.

Many models → one role

Heterogeneous models (for example, DeepSeek-V3 alongside Qwen-72B) can fill the same semantic role within one training loop, enabling ensembles and head-to-head model comparison.

03Declarative Recipes

Algorithms are expressed as configuration rather than hard-coded trainer paths. Each recipe declares its model roles, specializations, training behavior, weight synchronization, and inter-role data dependencies.

recipes.py
# Algorithm = data
@recipe("grpo")
def grpo_config():
  return TrainingConfig(
    name="grpo",
    roles=(ModelRole(name="policy",
      specialization_cls=ActorSpecialization),),
    syncs=(),  # no inter-role syncs
  )

# Adding a new algorithm?
@recipe("my_algo")
def my_algo_config():
  return TrainingConfig(
    name="my_algo",
    roles=(policy_role, value_role),
    syncs=(DataSync(source="value",
      target="policy", keys=("values",)),),
  )
grpo
Reward-only policy
ppo
Actor-critic training
dpo
Preference optimization
sft
Supervised fine-tuning
reinforce_pp
Discounted returns
ppo_colocated
Shared actor-critic
dpo_distributed
Distributed reference
online_reward
Reward co-training
diffusion_rwfm
Reward-weighted flow
diffusion_dpo
Preference denoising

04Pluggable Specializations

All model-specific logic sits behind three methods the backend calls; everything else remains shared infrastructure.

Specialization Class Hierarchy ModelSpecialization (ABC) ALL SPECIALIZATIONS ARE ROLE-SPECIFIC CausalDecoderSpecialization DiffusionSpecialization flow matching loss Actor Critic DPO PPO / GRPO value fn preference DualRole actor + critic shared + your new specialization here...

Every algorithm lives as a specialization.

compute_loss()

The core of the algorithm — returns (loss, metrics) and computes advantages when the objective requires them.

prepare_batch()

Transforms raw rollout data into model-ready micro-batches.

extract_model_output()

Pulls the right tensor out of the model's forward pass.

05Adding a New Algorithm

Write a recipe and, where the objective demands it, a specialization. The trainer loop, workers, sync infrastructure, and weight export all stay untouched.

What you write

1
TrainingConfig~10 lines: roles, syncs, description
2
ModelSpecialization~40 lines: compute_loss, prepare_batch
~50 lines
Total new code needed

What you don't touch

TrainBackend (Megatron / FSDP)
RoleWorker / WorkerPool
Data sync infrastructure
Checkpointing & profiling
Weight sync to SGLang
StacxTrainer orchestrator
ENGINE 03 — ENVIRONMENT SERVICE

The Environment Engine

The execution layer for agent actions. Built on ROCK, it runs isolated sandbox sessions that manage container lifecycle, tool execution, and resource isolation, while exposing only a narrow HTTP gateway to the rollout engine.

Independent Scaling

Scales sandbox execution independently from training and rollout on separate CPU/GPU resource pools.

Gateway Abstraction

Routes agent actions to the appropriate sandbox and returns normalized observations, logs, exit status, and artifacts while hiding sandbox lifecycle details.

Lifecycle Isolation

Assigns each episode to its own sandbox session and releases resources predictably when the episode completes or fails.

Unified Environment Interface

Represents all task environments through a common Harbor-style interface for metadata, prompts, tools, stopping conditions, and reward definitions.

Environment Service gateway Rollout Engine HTTP Gateway Action Observation Sandbox ROCK session Sandbox ROCK session Sandbox ROCK session Sandbox ROCK session ... up to 64 concurrent

The rollout engine interacts with environments only through a narrow gateway; The environment engine manages sandbox sessions, routing, execution, and cleanup behind the interface.

64
Concurrent sandbox episodes
12h
Max single sandbox execution
HTTP
Gateway interface
Session
Per-episode cleanup
Experiments

Validating STACX as agentic RL infrastructure

We validate STACX across three agentic RL settings: end-to-end RL improves tool-integrated math reasoning, multiple post-training strategies improve software-engineering agents over their base models, and rollout-only evaluation shows that STACX reproduces reference infrastructure behavior across diverse agentic task suites.

Tool-Integrated Reasoning

rl_engine/examples/retool/scripts/rl.sh
# Tool-integrated math RL: GRPO on DAPO-Math-17K with the ReTool scaffold
git clone https://github.com/STACX/stacx.git && cd stacx

# 1. Start a slime container with repo + data + model mounts
docker run --gpus all -d --name stacx_retool --network host --shm-size 16g \
  --ulimit memlock=-1 --ulimit stack=67108864 --ulimit nofile=524288:524288 \
  -v $(pwd)/rl_engine:/root/rl_engine \
  -v $(pwd)/external/data:/root/data \
  -v $(pwd)/external/models:/root/models \
  -v $(pwd)/external/ckpts:/root/experiments \
  lichangh20/slime-rl:stable sleep infinity

# 2. Run GRPO training inside the container (rl.sh handles Ray setup)
docker exec -it stacx_retool bash -c \
  'cd /root/rl_engine/examples/retool && WANDB_API_KEY=<key> bash scripts/rl.sh'
MinervaMath greedy14.0 → 18.8%
10%14%18%22% 0405 Training Step
MATH greedy20.6 → 27.8%
15%20%25%30% 0405 Training Step
GSM8K greedy26.1 → 56.5%
20%30%40%50%60% 0405 Training Step
AIME 2024 greedy + BoN@4BoN 26.7 → 46.7%
0%20%40% 0486 Greedy BoN@4 Training Step

We train Qwen3-4B-Instruct with GRPO on DAPO-Math-17K, using ReTool as the tool-integrated rollout scaffold, and evaluate checkpoints across math reasoning benchmarks. Accuracy improves consistently over training on MinervaMath, MATH, GSM8K, and AIME 2024, demonstrating that STACX supports the full rollout-to-training RL loop.

Software Engineering

We post-train software-engineering agents end-to-end with STACX on SWE-Gym, generating and evaluating trajectories through the OpenHands scaffold. With a Qwen3-Coder-30B teacher, STACX supports a range of post-training strategies: SFT, On-Policy Distillation, and DAgger- / AggreVaTe-style mixture-policy imitation, that improve Qwen3-4B / 8B students on both SWE-Gym Holdout and SWE-Bench Verified.

scripts/train/swe/
# SWE-agent post-training: Qwen3-4B/8B student × Qwen3-Coder-30B teacher
git clone https://github.com/STACX/stacx.git && cd stacx

# Stage models + data under external/, then start the ROCK sandbox admin
# (one-time setup — see scripts/train/swe/QUICKSTART_OPD.md)
rock admin start &

# Pick a post-training strategy (append _8b for the 8B student)
export WANDB_KEY=<your-wandb-key>
bash scripts/train/swe/sft/sft_4b.sh                  # SFT
bash scripts/train/swe/opd/opd_4b.sh                  # On-Policy Distillation
bash scripts/train/swe/online_dagger/dagger_4b.sh     # DAgger
bash scripts/train/swe/online_dagger/aggrevate_4b.sh  # AggreVaTe
DAgger AggreVaTe SFT On-Policy Distillation
SWE-Gym Holdout
4%8%12%16%02000400060008000Effective Training Samples
SWE-Bench Verified-100
10%15%20%25%02000400060008000Effective Training Samples

Training-data scaling under matched effective-sample budgets (4B student), comparing four post-training strategies supported by STACX on SWE-Gym Holdout and SWE-Bench Verified-100.

MethodAgent ScaffoldTrain DataSWE-Gym HoldoutSWE-Bench Verified
Qwen3-4BOpenHands5.0%11.2%
+ SFTOpenHandsSWE-Gym15.0%22.9%
+ OPDOpenHandsSWE-Gym16.0%23.4%
+ DAggerOpenHandsSWE-Gym17.0%27.3%
+ AggreVaTeOpenHandsSWE-Gym16.0%24.5%
Qwen3-8BOpenHands2.0%7.7%
+ SFTOpenHandsSWE-Gym12.0%23.4%
+ OPDOpenHandsSWE-Gym16.0%26.2%
+ DAggerOpenHandsSWE-Gym19.0%29.8%
+ AggreVaTeOpenHandsSWE-Gym17.0%27.3%

Task-resolution rate, where higher is better. Under the same OpenHands scaffold, STACX supports multiple post-training strategies that improve Qwen3-4B and Qwen3-8B agents over their base initialization on both SWE-Gym Holdout and SWE-Bench Verified.

Infrastructure Parity with Harbor

We run rollout-only evaluation under identical agent scaffolds and benchmark settings, comparing STACX against Harbor across five agentic task suites. STACX closely matches the reference infrastructure across OpenHands and Terminus2, validating it as a drop-in execution layer for agentic RL workloads.

rl_engine/examples/shared/docker_run_eval.sh
# Rollout-only eval: BENCH ∈ swebench | terminal_bench | seta | kernel_bench | algotune
git clone https://github.com/STACX/stacx.git && cd stacx

# 1. Download the Harbor task tree, convert → tasks.jsonl, build images
python rl_engine/examples/shared/download_tasks.py <bench>@<ver> \
  -o external/harbor-datasets/<bench>
python rl_engine/examples/shared/prepare_jsonl.py \
  --tasks-dir external/harbor-datasets/<bench> \
  --output rl_engine/examples/<bench>/config/tasks.jsonl --registry <bench>
bash rl_engine/examples/shared/build_images.sh \
  rl_engine/examples/<bench>/config/tasks.jsonl

# 2. Serve the model, then evaluate (SCAFFOLD = openhands | terminus2)
MODEL=<hf-model> PORT=9001 bash rl_engine/examples/shared/serve_sglang.sh
BENCH=<bench> SCAFFOLD=openhands SGLANG_ROUTER_PORT=9001 \
  bash rl_engine/examples/shared/docker_run_eval.sh
System + ScaffoldSWE-bench VerifiedTerminal-Bench 2.0SETAKernelBenchAlgoTune
STACX + OpenHands47.00%24.34%47.80%19.00%1.14
Harbor + OpenHands47.00%24.71%45.67%19.00%1.19
STACX + Terminus257.33%28.46%51.67%36.00%1.28
Harbor + Terminus257.67%31.46%51.83%36.00%1.14

SWE-bench Verified, Terminal-Bench 2.0, SETA, and KernelBench report average success rate; AlgoTune reports harmonic-mean speedup reward.

More agentic results coming soon. We are actively expanding evaluations across additional scaffolds, task suites, and algorithms. Numbers above reflect the current public snapshot.

Citation

BibTeX

@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}
}