arXiv(opens in a new tab)cs.ROOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.40799

CaPtain: A Pipeline for Post-Training Code-as-Policy Robot Agents

Yijia Fan, Xilin He, Yilei Jiang, Dongming Wu, Jiaxu Wang, Xiangyu Yue

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Across coding, web, and tool-use tasks, language-model agents are now routinely trained with the same recipe: supervised fine-tuning (SFT) to learn the interface, then multi-turn reinforcement learning (RL) to master it. Code-as-policy (CaP) puts robot manipulation in the same form, as the policy writes code against robot APIs and reads back the results, so the same recipe should apply. Yet, existing CaP agents sidestep training: they either prompt closed frontier models or delegate manipulation to pre-trained vision-language-action models (VLAs) and high-level skills, while small open vision-language models (VLMs) fail outright. We present CaPtain, an open post-training pipeline that brings this recipe to CaP and turns a small open VLM into a capable CaP agent, with no VLA, frontier model, or privileged state at test time. CaPtain trains and deploys the policy inside CaPtain-Harness, which exposes low-level perception, geometry, and guarded-motion primitives across simulation and real hardware. Within this harness, we first align the base model via SFT on synthetic trajectories generated with GPT-6 Astra, and then apply multi-turn RL. Multi-turn RL, however, must credit tens of requests from the agent, whose physical effects often surface several turns later, with a single outcome observed only at the end of the episode. Since training runs in simulation, we introduce a physical critic that reads the privileged physical state in simulator, which the policy never sees, and credits each request by how much it changes the predicted chance of success. Starting from Qwen3.5-4B (0% zero-shot), CaPtain-4B achieves 55.4% held-out LIBERO success after SFT and 73.8% after RL. On LIBERO-PRO, it reaches 78.5%, surpassing several frontier-model agents, and its RL gains persist across three perturbation suites (+17.6 to +21.2 points). Without target-domain training, it attains 83.3% on SimplerEnv WidowX, exceeds frontier models on CaP-Bench, and runs on a real robot after simulation-only adaptation. We release all code, data, and model weights.

1 Introduction

Language-model agents have improved rapidly in coding, web navigation, and tool use, and much of this progress follows a common recipe: the agent acts inside a fixed execution harness, supervised fine-tuning (SFT) teaches it the interface, and multi-turn reinforcement learning (RL) refines its behavior from the outcomes of its own interactions [19, 25, 26, 72]. Code-as-policy (CaP) agents [27, 43, 58] give robot manipulation the same form: the policy observes camera images, writes programs against perception and motion APIs, and reads back what happened. Since the program is composed at test time, a CaP agent inherits much of the generalization of the language model that writes it, and frontier models have made this approach strikingly capable. Used directly as a robot policy, GPT-6 Astra ranks above every public entry on the RoboDojo leaderboard [90], and with a coding harness it solves 94.0% of LIBERO-PRO episodes [67]. This raises a natural question: Can a small open model be trained into such a CaP agent with the same SFT-and-RL recipe, rather than relying on a frontier model at test time?

In practice, existing CaP agents sidestep training, and in doing so hand the manipulation itself to components the agent cannot learn to improve. One line of work prompts closed frontier models without weight updates [13, 39, 40, 50, 93]. These systems come with high finical cost of calling frontier models in each episode [13, 39, 93], cannot be fine-tuned for new robots or tasks, and cannot run on onboard compute. Another line delegates manipulation to pre-trained vision-language-action models (VLAs) or high-level skills. PyRUA trains a 4B coder over a frozen VLA and a motion planner [67], AgenticRoboRL trains a planner around a frozen LIBERO-trained VLA [48], SenseNova-RoboRSI builds a 27B agent around reusable skills and optional VLA calls [64], and Gemini 4 Argon exposes code-as-policies through skills such as grasp and place [22]. In these systems, the code decides which skill to call, but the skill decides how to grasp, approach, and place. Therefore, the agent stays bounded by the data on which the skill was trained, and RL can at best learn to sequence it. Small open vision-language models (VLMs), meanwhile, fail outright when asked to control a robot directly. Qwen3.5-4B solves none of the LIBERO episodes in our harness, and the few efforts that train such models rely mainly on SFT [45] or single-turn text-only RL [20]. What is missing is a complete SFT-and-RL recipe that teaches a small open VLM to manipulate through low-level primitives, with every manipulation decision made by the policy itself.

Applying the recipe at this low level is harder than at the skill level, for a reason that does not arise for language agents. Without semantic skills such as grasp and place, the policy must itself decide where to grasp, from which direction to approach, and when to close the gripper, and these decisions are spread over tens of requests per episode, most of which only perceive or verify. Multi-turn RL must then credit these requests, whose physical effects often surface several turns later, with a single outcome observed only at the end of the episode. Outcome-only RL assigns the same credit to every request, while a language-model critic would have to infer physical progress indirectly from text and images. Robot learning, however, offers an asymmetry that language agents lack: training runs in simulation, where exact object poses, grasp states, and sub-goal progress are known, even though the deployed policy must act from its cameras alone. A critic can thus read the physical state that the policy cannot see, and credit each request by how much it moves the task toward success, while the policy itself still acts from its cameras at test time.

We present CaPtain, an open post-training pipeline built on these two observations. CaPtain trains and deploys the policy inside CaPtain-Harness, an execution environment that exposes 22 low-level perception, geometric measurement, and guarded-motion primitives and nothing higher. There are no grasp, place, or open-drawer skills and no VLA. Perception returns masks and points, and motion takes an explicit end-effector pose or gripper command. Every call returns a structured text receipt reporting what physically happened, such as measured poses, contact forces, or why a motion stopped, and the policy-facing API is unchanged across LIBERO [44], RoboTwin 2.0 [11], RoboDojo [10], SimplerEnv [38], CaP-Bench [20], and a physical robot. We first apply SFT on in-harness trajectories generated with GPT-6 Astra, rendered in exactly the multi-turn format the policy sees at deployment. We then run multi-turn RL with a simulator critic that reads privileged physical state hidden from the policy and credits each request by how much it changes the predicted chance of success, combining the streaming RL formulation of SAO [25] with asymmetric actor-critic training [56]. Since this change is measured at a fixed time index, requests that only perceive or verify receive near-zero credit, and credit concentrates on grasps and placements. The critic is used only during training. At test time, the policy relies on camera images and receipts alone.

Applying CaPtain to Qwen3.5-4B yields CaPtain-4B, which raises the held-out LIBERO success from 0% to 55.4% after SFT and to 73.8% after RL. On LIBERO-PRO, CaPtain-4B reaches 78.5%, above frontier-model agents such as K1 [40] (77.2%), WAA [93] (75.6%), and ASPIRE [50] (71.7%). RL also gains more when it acts on low-level primitives: across the four LIBERO-PRO suites it adds 19.4 points to our SFT model, whereas RL over a frozen VLA adds 5.9 points in AgenticRoboRL [48], although the two start from different baselines. These gains persist under perturbation, ranging from +17.6 to +21.2 points across LIBERO-PRO [97], LIBERO-Plus [18], and LIBERO-MAX [95], with all seven LIBERO-Plus perturbation dimensions improving significantly; by contrast, reported results for end-to-end policies show π0.5\pi_{0.5} [55] falling from 97% on LIBERO to 12.8% on LIBERO-PRO [97] and the RL-tuned RIPT-VLA [68] scoring no higher than its base model on LIBERO-Plus [18]. Without target-domain training, CaPtain-4B reaches 83.3% on SimplerEnv WidowX, scores 75.0 on CaP-Bench, above frontier models and a 7B coder trained with RL on that benchmark, and completes tasks on a physical robot after adaptation in a coarse simulated twin alone. Transfer remains limited on RoboTwin 2.0 and RoboDojo (22.6% and 0.8% success), which require dual-arm coordination and unfamiliar arm kinematics. Together, these results suggest that robot manipulation over a low-level execution harness can be post-trained like any other language agent.

References (85)