Long-Horizon Agentic Reinforcement Learning: Approaching the Performance-Cost Frontier with 64 GPUs in 5 Days

    This article breaks down a public recipe for long-horizon agentic reinforcement learning that trains a roughly 300B-parameter agent on terminal tasks to 46.2% Pass@1, while cutting per-task cost by more than 30x compared with the highest reasoning-effort baseline. It covers why long-horizon agents are hard and expensive to train, the full-parameter RL method, verifiable-reward environment design, inference-cost controls, evaluation across three benchmarks, and practical guidance for enterprises running on mid-sized clusters.

    1. Why Long-Horizon Agents Are Hard and Expensive to Train

    Over the past two years, agents have moved from single-turn question answering to multi-step execution. A typical form is the terminal or coding agent: the model must read files, modify code, run tests, inspect logs, and roll back and retry in a real or simulated shell environment until the task passes validation.

    The defining characteristic of these tasks is that they are long-horizon: a single task may involve dozens of tool calls, the reward appears only at the end, and there is almost no supervision signal for the intermediate steps.

    This creates two engineering challenges:

    1. Difficult credit assignment: attributing final success or failure to one specific step among dozens is a classic sparse-reward problem.
    2. Uncontrolled inference cost: to make the model “think longer,” a common approach is to increase reasoning effort (longer chains of thought, more sampling and retries), which rapidly drives up the cost per task and creates a situation where performance rises but so does the bill.

    As a result, what the industry really cares about is not just benchmark scores but the performance-cost Pareto frontier: who is stronger at the same cost, or cheaper at the same performance.

    2. Core Finding: Make Cost-Effectiveness the Primary Goal

    The central conclusion of this public recipe is that a roughly 300B-parameter agent, after full-parameter reinforcement learning, reaches 46.2% Pass@1 on a terminal-task benchmark, on par with the current leading approaches. More importantly, when compared against the highest reasoning-effort configuration, the cost per task is more than 30x lower. This capability is not limited to terminal tasks; it also transfers to two software engineering benchmarks.

    The training scale is equally notable: 64 accelerators in under 5 days. This means long-horizon agentic reinforcement learning is no longer a game that requires thousands of GPUs to start; a mid-sized cluster can complete a meaningful iteration.

    A note on evaluation methodology: because the model was deployed by the team itself, cost is converted using the public pricing of the base model; all three benchmarks report the average Pass@1 over 5 trials, baseline results are taken from each benchmark’s official results, and the new model was measured in the team’s own evaluation harness. This “in-house harness plus public baselines” approach is common in engineering, but it also reminds readers that cross-framework comparisons should be made cautiously, and ideally re-tested under the same harness.

    3. Method Breakdown: A Reproducible Recipe for Long-Horizon Agentic RL

    3.1 Starting Point: Begin with a Fast, Cheap Base

    The recipe does not start from the slowest and most expensive reasoning-oriented base. Instead, it chooses a Flash-class base with low latency and low cost for full-parameter reinforcement learning. The reason is practical: reinforcement learning requires massive rollouts, and a slower base means lower sampling throughput and a longer training cycle. Using a cheap base and trading reinforcement learning for capability is the key first step on the cost-effectiveness path.

    3.2 Tasks and Data: Building Long-Horizon Environments with Automatic Scoring

    Long-horizon agent training depends on environments rather than static corpora. In engineering practice, this typically includes:

    • Task pool: terminal operations, repository-level code changes, test-driven fixes, and similar work;
    • Verifiable rewards: using unit tests, command exit codes, and file-state checks as binary or graded rewards;
    • Environment isolation: each rollout runs in a separate container to avoid cross-contamination;
    • Failure-sample recovery: treating timeouts, infinite loops, and destructive commands as negative samples to train the model to “fail safely.”

    Illustrative reward logic:

    1. def reward(workspace, tests):
    2. # 1) Safety: penalize traces of destructive commands
    3. if workspace.has_destructive_ops():
    4. return -0.5
    5. # 2) Correctness: fraction of tests passing
    6. passed = run_tests(workspace, tests)
    7. return passed / max(1, len(tests))

    3.3 Algorithm: Full-Parameter RL, Not Just Prompt Tuning

    “Full-parameter” means the backbone is not frozen and no large set of adapter parameters is added; instead, the policy is updated as a whole during long-horizon interactions. Accompanying standard engineering practices include variance control for advantage estimation, decoupling backpropagation between rollouts and training, and strict gradient clipping with learning-rate annealing. For long-horizon tasks, step penalties or length normalization are usually also needed to prevent the model from trading “infinite thinking” for score.

    3.4 Inference-Cost Governance: Achieving the 30x Gap

    A 30x lower cost per task is usually not a single-point optimization but a combination:

    • Control chain-of-thought length and maximum step count;
    • Reduce ineffective retries and repeated file reads;
    • Run rollouts and evaluations concurrently in batches;
    • Use caching and state reuse to cut redundant computation;
    • Fix the harness on the evaluation side to avoid piling on sampling just to boost scores.

    4. Evaluation and Transfer: What Three Benchmarks Show

    • Terminal-task benchmark: measures the ability to complete composite tasks in a real command-line environment, the closest indicator to a “digital worker”;
    • Two software engineering benchmarks: measure repository-level understanding, defect fixing, and patch generation, showing that the capability transfers rather than overfitting a single environment.

    The engineering takeaway is to design evaluation around the environment for long-horizon agent training, and to enforce strict distribution separation between training and evaluation sets to prevent inflated results caused by environment leakage.

    5. Implementation Guidance: How Enterprises Can Reuse This Approach

    1. Establish a cost baseline first: treat average cost per task and task pass rate as two first-class metrics, and report both for any optimization;
    2. Environment first: build a sandbox and test set with automatic scoring before discussing training;
    3. Start with a mid-sized cluster: a budget at the 64-GPU level is enough to validate the recipe’s effectiveness before deciding whether to scale up;
    4. Security and permissions: terminal agents have real operational capability and require least privilege, command allowlists, operation auditing, and log retention;
    5. Platform support: a container platform handles environment isolation and elastic scaling, object storage holds datasets and checkpoints, logging services and monitoring alerts provide observability for training and inference, and a message queue decouples the sampling and training pipelines.

    6. Limitations and Risks

    • There are methodology differences between an in-house harness and public baselines; evaluation should be unified when reproducing;
    • Building and maintaining long-horizon task environments is costly, and environment quality directly determines the upper bound of training;
    • Terminal operations raise security-boundary issues; production use requires supporting permissions and auditing;
    • Cost conversion relies on public pricing, and actual deployment cost fluctuates with resource utilization.

    Overall, the greatest value of this recipe is pulling “long-horizon agent capability” back from a parameter-scale narrative onto a track of engineering reproducibility and measurable cost: mid-sized compute, a short cycle, a public recipe, and rigorous evaluation and cost methodology are the key path for agents moving into production.