ClawGym II: Exploring Black-Box RL on Agent Harness

Huatong Song, Fei Bai, Ming Yang, Renyuan Li, Jia Deng, Jujie He, Zhange Zhang, Daixuan Cheng, Yan Xing, Qi Yun, Xuxing Chen, Danyang Li, Feng Chang, Chuan Hao, Ran Tao, Jian Yang, Bryan Dai, Wayne Xin Zhao, Mingjie Tang, Ji-Rong Wen

arXiv:2608.16798 · 2026-08-18 공개 · arXiv · PDF

long-horizon grpo agent-harness ppo black-box-rl clawgym-bench prefix-trees mix-harness

Abstract

Agent harnesses have substantially improved performance on long-horizon tasks by coordinating agent interactions with the environment. However, reinforcement learning through complex harnesses remains largely unexplored, as scaling such training to long-horizon agent tasks introduces fundamental challenges. In this work, we present a unified black-box RL framework for stable and scalable optimization of general agents through complex harnesses. Concretely, we first build a sandbox-based execution infrastructure that isolates task environments and harnesses within temporary sandboxes for large-scale concurrent rollouts. We then decouple policy optimization from opaque harness execution and place a serving proxy at the model boundary to capture model calls. To reconstruct multi-turn trajectories and improve training efficiency, we organize the captured calls into prefix trees and further adapt both critic-based PPO and critic-free GRPO to optimize over the recovered tree structure. Meanwhile, we maintain training-inference consistency throughout the optimization process. Finally, we introduce mix-harness training, allowing a single model to be jointly optimized by heterogeneous harnesses. With Qwen3-30A3B, black-box RL improves Pass@1 on ClawGym-Bench by 9.98 and 14.81 points through OpenClaw and Claude Code, respectively, while remaining stable over 200-400 optimization steps. Moreover, the framework yields consistent gains on more challenging tasks such as JobBench and OfficeQA. Overall, our framework enables effective, stable, and scalable optimization of general agents through black-box harnesses, supporting unified training across heterogeneous execution systems.

한국어 요약

한 줄 요약

ClawGym II는 복잡한 블랙박스 헤이브스를 통해 일반 에이전트를 안정적이고 확장 가능한 방식으로 최적화하는 통합 RL 프레임워크를 제시한다.

핵심 기여도

핵심 아이디어

기존 RL은 투명한 환경에서 작동했으나, 복잡한 헤이브스 내부 로직이 불투명한 경우 학습이 어려웠다. 본 연구는 헤이브스를 **블랙박스**로 취급하고, 모델의 실제 행동을 **서빙 프록시**를 통해 캡처하여 학습 데이터를 생성하는 새로운 접근법을 제시한다. 특히, **프리픽스 트리(prefix tree)**를 사용하여 분산된 모델 호출을 재구성하고, 이를 기반으로 **PPO**와 **GRPO** 알고리즘을 확장하여 안정적인 학습을 가능하게 한다. 또한, **트레이닝-인퍼런스 일관성**을 유지하기 위해 **token-in-token-out** 메커니즘과 **token-level importance-sampling rollout correction**을 도입한다. 이는 헤이브스 내부 로직의 복잡성에도 불구하고 모델 학습의 일관성을 보장한다.

기술적 접근법

주요 결과

의의 및 한계

본 연구는 복잡한 헤이브스 내부 로직을 직접 수정하지 않고도 모델을 최적화할 수 있는 **블랙박스 RL 프레임워크**를 제시함으로써, 실제 운영 환경에서의 학습 가능성을 확장한다. 특히, **이질적인 헤이브스**를 통합 학습할 수 있는 **mix-harness training**은 실용적 가치가 높다. 그러나, 현재는 **OpenClaw**와 **Claude Code** 두 헤이브스만 실험에 사용되었으며, 더 다양한 헤이브스에서의 확장성 검증은 필요하다. 또한, **초기화 전략**에 따라 성능 차이가 발생할 수 있으므로, 이에 대한 추가 연구가 필요하다.

실용적 활용

본 프레임워크는 **오피스 애플리케이션**, **코드 생성**, **AI 어시스턴트** 등 다양한 작업 환경에서 일반 에이전트를 헤이브스 내부에서 직접 최적화할 수 있는 기반을 제공한다. 특히, **Codex**, **Claude Code**와 같은 실제 시스템에 적용 가능하며, **소프트웨어 엔지니어링**, **자동화된 작업 플랫폼** 등에서 활용도가 높다.