TL;DR
RAPID (Robot Agentic Programming from Demonstrations) is a novel framework that automatically generates, verifies, and refines robotic manipulation programs from just a single visual human demonstration. By combining real-to-sim environment reconstruction with an object-centric relational program representation, RAPID closes the "agentic coding loop" to produce highly generalizable skills without requiring pre-engineered primitives or hand-crafted reward functions.
What Problem Does This Paper Address?
Large Language Models (LLMs) acting as coding agents have shown immense promise in generating robot code (e.g., "Code as Policies"). However, current systems suffer from a major catch-22: they assume that testable task specifications, low-level action primitives, and resettable simulation environments are already provided a priori.
This engineering bottleneck is especially severe in nonprehensile manipulation (such as pushing, flipping, pivoting, or toppling objects). Unlike standard pick-and-place tasks, nonprehensile actions are highly contact-rich and geometry-dependent. Manually designing a fixed library of primitives for every unique object interaction is an engineering nightmare. RAPID addresses this challenge by bootstrapping all the necessary ingredients—the environment, the primitives, and the success criteria—directly from a single visual demonstration.
Methods
RAPID operates by closing the agentic coding loop through three main phases:
- Real-to-Sim Reconstruction: Given a single RGB-D frame of a human demonstration, RAPID uses vision-language models and 3D reconstruction tools (SAM 3, SAM 3D, and FoundationPose) to automatically build an interactive MuJoCo simulation environment. It also synthesizes scene variants (altering object mass, friction, and positions) to serve as a robust verification set.
- Object-Centric Relational Programs: Instead of hardcoding trajectories or coordinates, RAPID represents primitives as local trajectory-optimization programs. These primitives focus on object-level effects (e.g., "flip the box against the fixture by 90 degrees") and resolve geometry dynamically at runtime using a geometry resolver. At the task level, these primitives are composed using relational constraints that determine how the outcome of one phase specifies the next.
- Iterative Verification and Refinement: An LLM-based coding agent generates candidate programs, executes them within the reconstructed simulation sandbox, catches failures, and iteratively refines the code until the inferred success predicate is satisfied across all scene variants.
Datasets
The authors evaluated RAPID across both simulation and real-world setups:
- Custom Nonprehensile Benchmark: A simulation benchmark created in MuJoCo featuring 8 contact-rich, multi-step nonprehensile manipulation tasks (e.g., pushing to a corridor, flipping to expose a graspable edge, toppling). Each task was evaluated against 50 novel test scenes varying in object pose, appearance, size, shape, and material.
- LIBERO-Pro: A standard prehensile manipulation benchmark used to evaluate RAPID's general applicability beyond nonprehensile tasks.
- Real-World Deployment: Evaluated on a physical Franka Research 3 robot arm across all 8 nonprehensile tasks.
Key Insights and Ideas
- Demonstrations as Bootstrappers: A single visual demonstration contains enough implicit information to extract the task specification (what success looks like), the required primitives (how to move), and the environment structure (where to test).
- Relational Coding Enhances Generalization: Traditional code generation often overfits to specific spatial coordinates. By forcing the LLM to write code in an object-centric relational format, the underlying strategy remains invariant even when object shapes, sizes, or initial poses change drastically.
- Simulation as a Debugging Sandbox: The true power of LLM coding agents isn't one-shot generation; it's their ability to debug. Reconstructing the scene into a simulator gives the agent a safe sandbox to fail, learn from execution logs, and rewrite its code before deploying on real hardware.
Key Results
- Simulation Performance: RAPID achieved a 75.9% average success rate across the 8 nonprehensile tasks, vastly outperforming vanilla Code as Policies (1.3%) and CaP-Agent0 (14.6%), which lacked the object-centric relational structure and variant-based verification.
- LIBERO-Pro Benchmark: RAPID achieved the highest success rate on 5 out of 6 task settings, proving its generality extends to prehensile manipulation without being given predefined primitives.
- Real-World Transfer: Trajectory-optimization programs refined in simulation transferred directly to a physical Franka robot arm with high reliability, demonstrating that the real-to-sim gap can be effectively managed.
Limitations and Future Work
- Quasi-Static Assumption: The framework currently assumes rigid-body, quasi-static manipulation. It may struggle with highly dynamic tasks, such as catching, throwing, or sliding objects into place using momentum.
- Complex End-Effectors: The primitives are optimized for standard parallel grippers. Extending RAPID to multi-fingered dexterous hands will require integrating more advanced toolsets, such as reinforcement learning, into the primitive generation loop.
- Deformable Objects: Future iterations will need to leverage advanced simulation engines capable of handling soft or deformable objects (e.g., cloth or ropes).
Summary updated