Daily Brief Physical Devices

Coding Agents Write Robot Policies for Task and Motion Planning

Written with AI and published automatically

Matteo, a PhD student in Tübingen at the Tübingen AI Center supervised by Matthias Bethge, and Bowen Li, a final-year PhD at Carnegie Mellon's Robotics Institute advised by Sebastian Scherer, joined RoboPapers to talk about agentic task and motion planning. The work was done mainly while Matteo was a researcher at Fondazione Bruno Kessler in Trento, with Tom Silver's Purple Planning Group at Princeton as the main supervising group. Bowen's lab works on SLAM and drones; his own interest is long-horizon planning and reinforcement learning. The project asks how much you can leverage coding agents to write programs that control robots in task and motion planning.

Background: TAMP and generalized planning

TAMP problems need long-horizon, two-level decision making: discrete planning tasks must be fulfilled while continuous constraints are also met. The authors work with a variable number of objects, so the same environment can have one, two, or three objects, and a single policy must solve all of them regardless of object count.

The traditional pipeline has a human engineer, or more recently an LLM, write abstractions beforehand: predicates, operators, skills, samplers, depending on the pipeline. Then a planning algorithm is called at every episode to produce a plan for that initial state and goal. Those plans are made once per instance and are not a generalized plan.

Generalized planning, or generalized TAMP, keeps the abstractions but synthesizes them into a single generalized policy, which can be a program. Every initial state then goes through that one policy, with no replanning from scratch per instance. Since generalized policies are often implemented as code, and coding agents keep improving, the authors asked how well a coding agent would do if asked to write such a policy. They removed everything else: an environment, a coding agent, and a language model.

The problem setting

The environment is simulated. The agent gets a simple text description of the task, for example a 3D task where a robot must pick up cubes and place them on a shelf, with a variable number of cubes.

The agent gets object-centric state, not perception: a dictionary of items such as robot joint angles and object positions. Perception is assumed solved by an upstream module and deliberately isolated from the planning problem. Actions are symbolic: control joint angles, open and close the gripper, move the robot base.

The environment is exposed through an API on a server. The agent can call reset and step, start new initial configurations, step forward with an action, and observe the result. It cannot see the environment's implementation or source code. The dynamics must be recovered from interaction, which makes the setting similar to reinforcement learning, except the learner is a language model writing code rather than a policy.

The agent can also render images because it is a VLM, but the policy itself and the robot receive object-centric state parsed from the image. Images are only a tool for developing the policy.

How much the agents used images

Not much. At the start the agent usually renders an initial state to see what it looks like, and occasionally renders consecutive frames while debugging a policy, but this is very rare. More often it writes scripts to debug the object-centric state directly, since that is what the policy uses. This held even during early exploration, which the hosts found counterintuitive.

The authors' explanation: coding agents are biased toward code, and a Python dictionary is easier to manipulate and debug than pixels. They had expected more image use and spent time building tools for it. The camera is a global, fully observable overview of the scene, not an ego view or wrist camera, so the agent does not need to explore to see it. Sometimes the agent renders an image to identify the robot, for example recognizing a Kinova arm and using knowledge from pre-training to calibrate it. The task evaluation passes object-centric state to the policy, which likely conditioned the agent toward that representation; if the final policy had to take images, the authors suspect it would use them much more.

The policy interface and the rules of the experiment

The agent writes a Python class called Approach with two functions:

  • reset: runs at the beginning of every instance and sets up whatever the policy needs from the initial state.
  • get action: called at every step, takes a state input, and returns an action that advances the environment toward the goal.

Constraints on the experiment:

  • A budget of $20 per agent for policy synthesis, used to control experiment cost.
  • At most 60 seconds per instance at test time, so a brute-force Python class that searches slowly is not viable.
  • No LLM at test time; everything must be written beforehand in Python.
  • Only NumPy, SciPy, and the Python standard library. No internet, so the agent cannot download environment packages and solve them in advance.
  • 100 held-out instances per environment, unseen during synthesis, to measure generalization to configurations the agent never saw.

Boxing the environment properly was a major focus. The client-server architecture means the agent sees only reset, step, and render, not the source code or the held-out seeds. The authors stress-tested that this holds and that nothing unintended, such as internet access, happens. The agent also has a Git repository in its container and can commit, which lets the authors watch how the program evolves.

Bowen calls this the biggest lesson of the project: do not let agents onto the internet, because the internet changes every second and makes results irreproducible. He notes that open benchmarks such as LIBERO and Behavior Bench are likely already in agents' training sets, and an agent could in principle rebuild LIBERO from scratch in its sandbox, whereas the real world has no source code. His advice is to build problems from the real world, implement your own tasks, or test directly in the real world. The authors open-sourced their code, sandbox, and task implementations. Matteo adds that the environments used were released very close to the LLMs' release dates, and prompting did not reveal knowledge of them in the weights, but this can never be certain.

Worked example: the shelf environment

The robot must move around a room, use its arm to pick up cubes, and place them on a shelf. The agent's first move was to render the environment and look at the image to understand the problem, then reset the environment several times and inspect the symbolic state, probing because it started with only a vague text description and the API.

It recognized the arm from pre-training, copied the URDF from its own weights into a JSON file, and the model fit almost perfectly. The authors consider this fair, since it is a well-known robot model. But two things were unknown: where the arm was mounted on the base, and which gripper was used, so it did not know where the cube sat inside the gripper when grasped, and could not yet do forward or inverse kinematics.

Its fix: grab a block by trial and error, then move the arm through space while recording joint angles and the cube's x, y, z position from the object-centric state. With 41 such data points it fit offsets with a small least-squares solver, bringing the error down to 1.8 millimeters. It tested the resulting forward and inverse kinematics model in the environment itself.

It then wrote a first policy in phases: go to the cube, descend and grab, close the gripper, and so on until placing the cube on the shelf. It worked in some cases but only one of five self-chosen seeds succeeded. Debugging revealed that the shelf's initial position varies per seed, so the top shelf can be higher or lower. The agent reset many times to learn the range, wrote code covering all positions, and fixed further bugs across 13 commits. It expanded its own test suite and submitted. The policy solved 99 of 100 held-out instances.

The agent's self-tests are not the final tests. It samples from the reset distribution and picks its own test seeds; the held-out suite is separate.

Worked example: Stick Button

A 2D robot must touch all red buttons. Some are on a black area the robot cannot reach directly, so it must grab a stick and use the stick. The agent wrote probing scripts, including one that moved until it touched a wall and then followed the wall to map the range of its movement.

Its first policy touched the floor buttons, grabbed the stick, and touched the buttons on the table, and it solved all of its test seeds. With leftover budget it expanded testing across many initial states and found seed 312, a hidden edge case where the stick sits very close to the wall edge, leaving too little space to grab it, so the grasp strategy must change. The agent then wrote a targeted script that kept only states where the stick was near one side or the other, built a hard test suite, and tested every policy edit on both the normal and hard suites. It found a strategy of grasping from the side and from the bottom to reach high positions. After 2,400 instances with no failures it submitted, and all 100 held-out instances were solved.

Main evaluation: 28 environments, nine synthesis methods

The authors ran 28 environments with nine synthesis methods and five runs each for statistical significance, because closed models cannot be seeded or have temperature set, so every run differs even with the same prompt. Each was evaluated on 100 held-out instances.

Models and harnesses:

  • Claude Code with Opus 5 and Opus 5.5.
  • Codex with GPT-5.6 and GPT-6 Astra (as named in the talk).
  • Three other baselines for comparison.

The environments come mainly from the Kinder benchmark, developed by the group beforehand, with kinematic and dynamic, 2D and 3D environments designed to look simple but be very challenging for traditional planners, reinforcement learning, and vision-language-action models. The original Kinder paper reports most of these remained unsolved by most existing methods at the time. Some PDDLStream environments, more classical, were included to compare with prior work.

Results at 95% success or above:

  • Claude Code with Opus 5 solved 14 of 28.
  • GPT-6 Astra solved 20 of 28.
  • Opus 5.5 was best, solving 23 of 28.

All remaining failures were in the dynamic 3D environments, the most challenging tested.

Asked whether this means system-two reasoning is solved, Matteo says no. There is no perception, the settings are very controlled, and failures remain. The point is that anyone working on planning should check how a coding agent performs before building elaborate pipelines, because LLMs may already handle much of the planning, and these are powerful baselines rather than a complete solution.

Bowen adds two points. First, system two is hard not because these environments are fully observable but because the real world is partially observable; coding agents are not good at maintaining a belief space like humans, and sometimes get stuck on a corner case forever instead of exploring alternatives. Second, in robotics, system two, one, and zero are not easily separable: an agent may propose a system-two plan that no available system-one or system-zero controller can support, especially in the open world and with high-dimensional robots such as dexterous hands and humanoids. The group is now interested in designing all three together. He also notes that kinematic TAMP is not the real action space of robots, which is joint torque, with contact and balancing issues that affect what a system-two strategy can be.

Object counts, planners, and the value of the harness

Classical planners' success tends to fall as more objects are added, because the search space grows. The programs coding agents write keep a much more stable success rate as object counts rise, because they find environment-specific shortcuts and heuristics that solve the environment regardless of search space. They also tend to run much faster than a classical planner, such as PDDLStream on the PDDLStream environments or the SESAME planner on Kinder. All three agents beat the hand-designed planner by a large margin, with Opus 5.5 nearly solving the subset where a planner was implemented, which was 16 of the 28 environments.

LLM-based baselines were important to isolate the source of the gain. The LLM template baseline uses the same Opus 5 model but no coding-agent harness: a fixed pipeline where the LLM generates code and a fixed debugging procedure returns structured feedback, such as why compilation failed or which instances failed, in an almost graph-like flow. The coding agent instead runs free and designs its own flow, writing probing scripts, debugging specific policy issues, and interacting with the environment. The authors attribute the gains to this freedom, not the model, which is matched. A one-shot baseline, where the agent writes the policy once with no feedback or interaction, performs poorly: the first guess is typically wrong, and iterative debugging is what makes it work.

Matteo's reading: if agents can run scripts and interact directly, it makes sense to use that harness rather than hand-crafting one, since restricting them into boxes does not match their pre-training. This requires a simulator that can be exposed. The group is considering whether fixed demonstrations would work as well.

Bowen warns that agents can overfit simulation physics and write code that works in simulation but does not transfer to the real world. For real deployment, with safety and how robots should behave around people, a harness is still needed.

Giving the agent the source code

As an experiment, the authors gave the agent the environment source code. Performance improved across the board, though the gain shrank with stronger models because results were already good. But policies became much slower at test time. With source code, agents copy-pasted the simulator into their own policies as a model for planning, which is slow, for example running a full physics simulator at every step. With black-box access, the agent must fit a faster model, for example in NumPy, or skip the model and use heuristics, so the policy runs much faster.

Failure recovery and a PDDLStream-style problem

In a task to grab colored blocks and place them in matching bins, the agent's grasps were imperfect and blocks were dropped, but it could see where they fell, re-grasp them, and place them correctly.

In a PDDLStream-designed problem, the solution is obvious but planning is hard: move a blue block onto the red block on top of the green section, while a far-away table holds spare blocks. Removing an obstruction can be awkward because the obstructing block's initial rotation varies, so the agent's controller worked from one angle but not others. Traditional PDDLStream planners fail because the other table is too far away in the planning graph. A Codex run initially got stuck too, then halfway through synthesis found the other table and changed its high-level strategy, solving every instance where the grasp was awkward.

Surprising and unintended strategies

In Tossing, the robot must throw a cube into a box too far away. The authors expected a natural throwing motion, as in their hand-written demonstrations. The agent developed an overhead catapult throw that reached farther boxes better.

Two unintended strategies came from bugs the authors had not noticed:

  • The central barrier had physics enabled, so the robot could move fast, knock it down, and cross without tossing. This was the agent's first strategy.
  • After the barrier was made unmovable, the walls had no collision, so the agent grabbed the block, went outside the walls, crossed the barrier from there, came back in, and dropped the block.

Both were valid in the simulator and gave 100% success, but would not transfer to the real world. Given a simulator and only the task of solving it, the agents will find whatever the simulator allows, and use it if it is easier.

In Scoop Pour, an L-shaped tool should scoop objects to the other side, with the goal of moving at least half. The agent instead rotated the scoop to the other side, used it as a large bucket together with the wall to move all objects at once, and dropped them together. The authors had not thought of this, and demonstrations would not have produced it. The environment returns a reward of minus one per step, so faster completion is incentivized even though the text did not say so. The agent saw it had budget left and tried alternatives; it also found a bug where the tool could cross the divider but the objects did not follow, and discarded that route. Matteo attributes the result to language-based reasoning about what a scoop is for and how else it could be used, exploring more efficiently than random exploration. He stresses it is an outlier: most solutions, including agent-written ones, looked as expected, and only about twice did agents find this. Since the goal was only half the objects, the strategy is not much more efficient, and he suspects more agents would find it if the goal were to move all objects, though that was not tested.

In a 3D scooping task, a small gray scoop with a very small handle was consistently hard to grasp, so agents ignored it and grabbed the whole yellow tray, dumping it into the green tray. All coding agents did this and none grabbed the tool. A planner would not find this because it lacks the right abstractions.

In a sweeping task, the sweeper was hard to grasp and control, so agents used the gripper itself to push blocks into the drawer. In a ground-sweeping variant with more objects, this failed: moving objects individually was too slow and the policy timed out, so that case is unsolved. Asked why grasping was hard, Matteo says grasping itself was feasible; controlling the tool while moving was the problem. In one case with 10 cubes, the physics engine refused to move them all with the sweeper because of the force required, and the agent concluded the sweeper did not work rather than trying three at a time.

On how often solutions look like cheating: it depends on the environment. Many 2D environments offer no trick, and some 3D ones were solved traditionally. Matteo asked colleagues how they would solve Scoop Pour and a surprising number said to just grab the thing and move it, so humans may share the tendency, and agents may inherit it.

No direct human baseline comparison was made, though Kinder has some human references the authors did not examine. Matteo expects coding agents to use fewer steps, since humans teleoperating are imprecise while code can do shortest-path search. The more interesting question is whether agents use the same strategies.

Bowen argues success rate is far from the right metric for robots. In humanoid work, agents let the humanoid fall and crawl, which solves the task but would break a real G1 robot, and no user wants a G1 crawling at home. Elegance, safety, and human values matter, as in early RL humanoids whose efficient but strange gaits people disliked, which led graphics animators to make motion more natural. Agents write programs and do not understand the physical world well; they understand success. Matteo agrees the setting resembles RL: the agent optimizes success and reward and finds odd strategies, inheriting RL's problems while shortcutting exploration through internet-scale pre-training, along with its biases.

Failures

Many failures come from the code running open loop at test time with no correction or feedback. Examples:

  • Packing: one and two objects work, but three objects fail because the agent could not find the interlocking configuration that fits all three.
  • Drawer sweeping: the agent struggled to open the drawer, and once it had a policy for that, its budget was nearly gone, so it could not write a reliable grasp-and-place controller.
  • Scoop Pour: the tray-flip strategy dropped some cubes, and the policy had no working fallback, so it deadlocked.
  • Rearranging: a knocked-over object could no longer be grasped because the grasp code assumed it was upright, so the policy deadlocked.

What the work shows and does not show

Shown: a strictly controlled red-team sandbox for evaluating coding agents on simulated planning problems, giving the agent only the intended context. Off-the-shelf coding agents with only environment interaction and a brief text description already work well, calibrating, testing and finding edge cases, revising strategies, and probing without being told how. They are strong baselines: before building a hand-engineered planner, check how a coding agent does on your environment, and take inspiration from its solutions.

Not shown:

  • Perception: states are object-centric, exact, and fully observable, with no noisy perception or partial observability.
  • Unlimited resets: the setup assumes a simulator that can be reset arbitrarily. Doing this on a real robot is hard, since resets need the robot or a human.
  • Sim-to-real: simulators are inaccurate or exploitable, and agents maximizing success find unorthodox strategies that do not transfer.
  • Cost: synthesizing programs takes about 1 to 3 hours and up to $20, a cap set to keep experiments reasonable; some could use more. The authors ran much of it through Claude subscriptions, measuring equivalent API price rather than paying it all.

The authors argue this is an efficient use of coding agents because the cost is paid once upfront, and the program then runs in real time for free, unlike direct control where the agent outputs actions at every step, which is slow and costly.

Follow-up work

Bowen describes three follow-ups:

  • Real-to-sim: other students in Tom Silver's group are using perception and cameras to build scenes, develop strategies in simulation, and transfer back, and using the data to fine-tune a VLA and analyze its data distribution.
  • Sim-to-real: confine program expressiveness, as in prior work such as CaP, CaP-X, and SayCan, where perception and planner modules are sequenced by code rather than open Python. Also add RL to the pipeline, with domain randomization as a tool agents can call and agents drafting their own environments to train skills for non-prehensile, contact-rich manipulation.
  • High-dimensional robots: extend reasoning to joint torque, with the 29-DOF G1 humanoid plus dexterous hands exceeding 60 DOF, coupled with geometric and dynamic constraints. They are pushing for RSS in January, uncertain it will be ready.

Related work and open questions

Bowen points to work by Wood Cash and Kaven (as named in the talk) on coding agents for partially observable TAMP with real robot deployment, presented at the same CoRL late-breaking poster session. Matteo points to a project called Frobo Arcade, from Janet Polk's group (as named), which uses agents to control robots directly rather than write code, and says it also works well. He is curious how code-writing versus direct action will evolve, whether they will combine, and notes that demos often leave the evaluation setting unclear, so rigorous, clearly specified evaluations are valuable. Asked about hybrids, he suspects code that calls other APIs, including LLM APIs, is a promising direction, while expecting stranger combinations to appear.

Source: RoboPapers on YouTube

Thoughts? Reply to the email or join the Lab →

Get it by email.

Choose the Daily Brief, Articles, or both. Free.