Programming Agents That Command Robots: Tiered Evaluation and Step-Level Failure Localization

    When a programming agent moves from generating code to commanding a robot performing physical tasks, evaluation cannot stop at whether the code runs; it must ask whether the code reliably produces correct actions in a dynamic environment. This article describes an evaluation framework built around a 1,156-task full set and a 456-task high-difficulty core set, three assessment modes—end-to-end black-box, step-observable white-box, and privileged diagnostic—and a step-level trajectory model for failure localization and root-cause analysis. It also covers the metrics and engineering controls needed to make robot-agent evaluation reproducible, diagnosable, and actionable.

    When a programming agent moves from generating code to commanding a robot in physical tasks, evaluation is no longer only about whether the code compiles or runs. It must answer whether the code can reliably produce correct actions in a dynamic environment. A humanoid robot performing a high-dynamic action such as striking a ball over a net, for example, depends on task understanding, motion planning, control-code generation, exception recovery, and safety constraints. If evaluation relies only on an end-to-end success rate, failures are compressed into a single number and it becomes difficult to answer: “where did it go wrong?” A useful evaluation system must therefore address three questions: Is the task set representative? Can the test modes distinguish capability differences? Can failures be localized step by step?

    1. Task Set: From 1,156 Tasks to a 456-Task High-Difficulty Core Set

    A reference evaluation setup provides a useful scale: a full pool of 1,156 tasks, from which 456 high-difficulty tasks are selected as the core set. The full set is used to cover breadth, while the core set improves discrimination and evaluation efficiency. Selection should not be based on difficulty alone; it should consider the following principles:

    • Skill coverage. Skills such as moving, grasping, placing, pushing/pulling, dynamic catching, collaboration, and long-horizon orchestration should all be covered, so the core set does not skew toward one action type.
    • Difficulty stratification. Keep simple regression tasks as a baseline, then concentrate high-difficulty tasks in the discriminating set. High-difficulty tasks should include long-horizon dependencies, dynamic disturbances, partial observability, and failure recovery.
    • Reproducibility. The same task should be replayable under a fixed random seed, fixed initial state, and fixed scorer; otherwise failures cannot be attributed.
    • Diagnosability. Tasks should expose step-level state, subgoal completion, and action logs so that the first failed step can be located.
    • Anti-leakage and anti-overfitting. The core set should not heavily overlap training examples. Hidden task families and perturbed variants can be used to test whether the agent truly generalizes.

    The process of moving from 1,156 tasks to 456 high-difficulty tasks can be understood as “full-set coverage plus core-set discrimination plus regression-set safety net.” The 456 tasks are not simply the hardest tasks; they are high-information samples that expose planning errors, code errors, perception errors, and control errors.

    2. Three Assessment Modes: From Black-Box Results to White-Box Process

    To compare multiple programming agents meaningfully, three assessment modes are recommended. Each answers a different question.

    2.1 End-to-End Black-Box Mode: Did the Task Succeed?

    In this mode, the agent receives only the task description, environment interface, and scoring function. It generates a control program and executes a complete episode. Evaluation metrics include task success rate, completion time, energy consumption, collision count, safety violation rate, and timeout rate. This mode is closest to real-world use but has weak explanatory power. It is suitable for an overall leaderboard and regression baseline.

    2.2 Step-Observable White-Box Mode: Was Each Step Reasonable?

    The agent is required to output an interpretable plan, subgoal sequence, and code blocks. At each checkpoint, the evaluator records an environment state summary, action primitive, subgoal completion, reward change, and exception information. This mode supports step-level replay and makes it possible to determine whether failure occurred during task understanding, planning decomposition, code implementation, or execution control. It costs more than black-box evaluation, but it greatly improves failure localization.

    2.3 Privileged Diagnostic Mode: Distinguishing “Does Not Know” from “Cannot Do”

    In non-scoring diagnostic rounds, the evaluator injects privileged information such as ground-truth state, subgoal hints, or teacher actions, and observes whether the agent can correct its strategy when information is sufficient. If success improves noticeably after injection, the bottleneck is likely in perception or state estimation. If the agent still fails, the problem is more likely in planning or code generation. Privileged diagnostic rounds must be isolated from formal scoring so that diagnostic information is not counted as final capability.

    3. Step-Level Failure Localization: Structured Trajectories and Root-Cause Classification

    To localize failures to each step, a unified trajectory model is essential. Each episode should record:

    • task ID
    • episode ID
    • step index
    • observation summary
    • action
    • code block ID
    • subgoal
    • reward
    • collision
    • timeout
    • exception type

    Code blocks should be mapped to action primitives, so that a particular code segment can be traced to a specific anomalous action. Root-cause categories can include:

    • task understanding error
    • environment perception error
    • planning decomposition error
    • code implementation error
    • interface call error
    • execution control error
    • exception recovery failure

    Results can be aggregated by task family, step interval, and root cause to produce a failure heatmap. For example, if an agent performing a dynamic catching task consistently fails first at the “posture adjustment after approaching the target” stage, the optimization focus should be on end-effector control code and state feedback, not on the task description.

    Pseudocode:

    1. for task in core_set:
    2. agent.reset(task)
    3. plan = agent.generate_plan(task)
    4. code = agent.generate_control_program(plan)
    5. episode = environment.execute(code)
    6. for step in episode.trajectory:
    7. record(
    8. task_id,
    9. step_index,
    10. observation_summary,
    11. action,
    12. code_block_id,
    13. subgoal,
    14. reward,
    15. collision,
    16. exception
    17. )
    18. if episode.failed:
    19. first_failed_step = locate_first_incomplete_subgoal(episode.trajectory)
    20. root_cause = classify_root_cause(
    21. first_failed_step, plan, code, episode.trajectory
    22. )
    23. write_failure_report(task_id, first_failed_step, root_cause)

    4. Metrics and Engineering Implementation

    In addition to aggregate success rate, the evaluation should report subgoal completion rate, first-failed-step distribution, recovery success rate, code exception rate, safety violation rate, and resource consumption.

    On the engineering side, the following controls are needed:

    • versioned tasks and scorers
    • reproducible random seeds
    • sandbox isolation
    • privileged-mode isolation
    • regression testing

    For cloud-based batch evaluation, a generic container platform, logging service, and monitoring/alerting capabilities can support task scheduling and trajectory analysis. The core of the evaluation, however, remains task design, mode isolation, and step-level attribution.

    Conclusion

    Evaluation for programming agents that command robots should move from a single-point result to a layered system: task stratification, three assessment modes, and step-level trajectory analysis. The 1,156-task full set provides coverage, the 456-task high-difficulty core set provides discrimination, and the black-box, white-box, and privileged diagnostic modes answer whether the task was completed, whether each step was reasonable, and where the bottleneck lies. Only by localizing failures to individual steps can evaluation truly guide capability iteration.