Evaluating Code Agents That Control Robotic Arms: Benchmark Design and Engineering Practice
This article examines how to evaluate code-writing agents that drive a robotic arm, and what the results mean for engineering work. It explains why the benchmark measures general reasoning plus online code generation rather than memorized motion templates, breaks capability into control and dexterity, spatial reasoning, and adaptation and stopping, and describes a runtime architecture of perception, planning code, an execution gateway, and a judge. It also covers zero-shot task rules, partial scoring, human baselines, cost structure, known weaknesses with concrete hardening measures, and how to move from turn-based replanning toward production use.
What the Evaluation Needs to Answer
Connecting a large model to a robotic arm tends to stall at the level of “it can say what to do next.” What actually needs verification is whether the model can chain scene understanding, spatial reasoning, motion planning, and a closed execution loop together, and turn an instruction into repeatable joint motion through code, without task-specific fine-tuning. Tabletop manipulation looks simple, but it simultaneously tests control stability, dexterity, adaptation to occlusion and pose change, and whether the system keeps flailing after a failure.
One line of research narrows the problem to a coding agent: the model does not emit a joint-angle sequence directly. Instead it writes a motion-planning program in an isolated code environment, then sends motion commands to the arm through a controlled interface. The arm uses a common six-axis desktop configuration, where five joints handle reaching and orientation and one end effector handles open and close. The scene is covered by multiple cameras: fixed views around the table establish global spatial relationships, and a wrist view handles close-range alignment. The model receives only a short brief covering how to connect to the control interface, the arm’s kinematics and joint limits, and how to submit a task attempt.
The value of this design is not ranking one model against another. It separates “language ability” from “physical closed loop” so each can be measured. Pass criteria are written in advance: full completion earns full marks, partial completion earns partial marks by degree. All tasks run zero-shot, with no demonstration trajectories for the task and no task-specific training allowed. The resulting score therefore reflects general reasoning plus the ability to write code on the spot, not well-remembered motion templates.
Breaking Capability into Dimensions
A single aggregate score cannot guide engineering improvement. Three capability lines are more useful.
Control and dexterous manipulation. Grasping, placing, and pressing buttons are all contact tasks. The model must handle approach speed, gripper width, contact force, and the retreat path. The common failure is not “not knowing what to grasp,” but the gripper closing at the wrong height, no retreat after a collision, or pushing the object out of the reachable region.
Spatial reasoning. Extrinsics differ between cameras, and the table frame, base frame, and wrist frame do not align automatically. The model has to infer object poses relative to those frames from images and the state returned by the interface, then express them as executable waypoints. Occlusion, glare, and similar-looking shapes pull this dimension down directly.
Adaptation and stopping. Initial pose, lighting, and minor collisions all change the scene. An acceptable policy re-perceives when deviation exceeds a threshold instead of reusing the first estimate. Stopping matters more: once the pass condition is met, the agent must submit. A failure seen repeatedly in the study’s observations is that the task has already succeeded while the model keeps “optimizing,” knocking the object over or pushing it out of the judged region.
Scoring should retain both a result score and process signals. The result score checks whether the final state satisfies geometric and contact constraints; process signals record attempt count, collisions, timeouts, invalid commands, and extra actions after success. Grasp and fine-manipulation success rates should be tracked separately so they are not diluted by easier reaching subtasks.
Runtime Architecture
Split the system into four parts — perception, planning code, execution gateway, and judge — that communicate only through explicit data structures.
The perception side samples multiple image streams and joint state on a schedule, time-aligns them, and writes a read-only context. Do not pour raw video into the model context without limit: the study’s observations show that a substantial share of the cost goes to context processing, and long video plus repeated screenshots can multiply the cost of a single task several times over for very limited score gains. Key frames, detection boxes, depth or point-cloud summaries, and the last few execution receipts are the safer choice.
The planning side runs in an isolated environment. The model can read and write its own scripts, call simulation or geometry libraries, and query forward and inverse kinematics, but it cannot access the judge’s reference answers or modify arm firmware. Isolation is what makes runs reproducible and auditable, and it limits the blast radius of bad code.
The execution gateway turns high-level motion requests into constrained commands: joint limits, velocity caps, a workspace fence, gripper open/close range, and emergency stop. The gateway rejects out-of-bounds commands and returns a structured error rather than silently truncating. The model should be able to revise its code based on that error instead of blindly retrying the same command.
The judge scores only at the end of a round or on timeout, using the pass criteria, and gives no mid-run hints toward the reference answer. Permitted feedback is limited to sensor readings, whether execution was rejected, and the judging criteria disclosed in the task brief.
A vendor-neutral pseudocode sketch of the task loop, expressing control flow only and not any specific platform’s API:
state = observe(cameras, joints)script = agent.write_plan(task_brief, state, api_manual)for step in run_isolated(script):if not gateway.allowed(step):agent.revise(step.error)continuegateway.execute(step, speed_limit, workspace_fence)state = observe(cameras, joints)if judge.success(state):return partial_or_full_score(state)if budget.exceeded():breakreturn partial_score(state)
Tasks and Zero-Shot Rules
Desktop tasks should cover reaching, grasping, oriented placement, buttons or switches, and at least one perturbation that requires re-perception. Each task specifies the initial distribution, permitted interventions, timeout, and pass geometry. Partial credit must be computable — for example, an object inside the target region but with pose error earns a middle score, while no contact at all earns zero. Avoid unverifiable descriptions like “looks about right.”
Zero-shot means no expert trajectories for the task, no model weight updates mid-evaluation, and a prompt containing only the interface description, safety constraints, and task text. Trial and error within a single attempt is allowed, since that is part of online planning; writing failure samples back into a training set and then testing the same distribution is not, because that measures adaptation speed rather than capability on the spot.
The human baseline should use the same initial conditions and judging criteria, recording completion time and error types. The order-of-magnitude gap discussed publicly is roughly this: a model often needs tens of minutes per task while a skilled operator needs tens of seconds — close to two orders of magnitude. Exact minutes and dollar figures vary with hardware, context length, and pricing, and should not be cited as fixed metrics. The engineering conclusion that can be stated confidently is that with the current turn-based “look at images, write code, dispatch, look again” pattern, neither latency nor cost reaches production line takt time.
The cost structure deserves separate attention. If most spending comes from repeatedly reading long context, the optimization target is not a more expensive model but shorter perception summaries, caching of unchanged scene descriptions, and a cap on replanning rounds. Some configurations cost more per unit and score only slightly higher, which shows that spending more does not translate linearly into getting more work done.
Known Weaknesses and Hardening
Overly long startup calibration. Models often spend the first half of a task repeatedly homing, calibrating cameras, and probing the workspace. Provide a one-time calibration result and the base-to-table transform, and expose “calibrated” as a queryable state. If an evaluation deliberately withholds calibration, count calibration time separately from manipulation time, otherwise it penalizes the perception system rather than the manipulation policy.
Not stopping after success. When the judge returns success, the execution gateway should lock further motion and permit only gripper hold and retreat to a safe pose. The model-side prompt should also state that once the pass condition is met, no additional tidying is allowed.
Low grasp success rate. Fine manipulation is often markedly below coarse reaching. Split approach, pre-grasp, closure, and lift into separately testable stages, each with force or pose thresholds. On failure, return to the pre-grasp pose instead of jittering near the contact point.
Error accumulation. Inverse-kinematics failures, camera latency, and table sliding compound. Force re-observation after each contact, cap the number of waypoints, and fail the round once consecutive rejected commands hit a threshold, to avoid infinite loops.
Safety. A desktop arm can still pinch hands, sweep heavy objects off the table, or exceed speed limits. The evaluation environment needs a physical emergency stop, a software fence, and torque or current limits. The model has no permission to disable these protections. Logs should retain commands, rejection reasons, and key image frames for review, not just the final score.
Reading Results and Moving to Production
When reading this kind of evaluation, first check whether tasks are zero-shot, whether partial credit is recomputable, whether the human baseline uses the same judging criteria, and whether latency and cost are reported per success rather than per message. Four models landing close together while another is clearly slower suggests the bottleneck lies in the perception loop and contact policy, not merely in one model’s language fluency. If grasp success clusters in roughly the 30–45% band, research effort belongs on hand-eye calibration, a grasp state machine, and stopping conditions.
Moving to production requires at least four additions: replace turn-based replanning with time-bounded local replanning; replace very long raw context with structured scene state; promote safety and stopping from prompt instructions to gateway-enforced policy; and run the same task set as a regression suite rather than showing a single success video. Cloud infrastructure suits task orchestration, logging and object storage, monitoring and alerting, and isolated runtime environments, while real-time servo control should stay close to the arm. General-purpose cloud facilities such as Baidu AI Cloud can handle log retention, containerized evaluation environments, and monitoring, but they do not replace the on-site safety loop and should not be read as a customization commitment for any particular arm brand.
Until score, time, and cost all meet target, the more reasonable use is assisted programming, offline generation of candidate trajectories, and filtering clearly non-compliant scripts in simulation. Handing an unfenced model directly to production takt time is neither economical nor safe.
