Skip to main content Skip to footer


September 28, 2026

Can We Build the Law Into How Robots Act?

New research from Cognizant AI Lab explores how legal reasoning can constrain a robot before it acts, and uncovers two major challenges that must be solved before robot law can work reliably in the real world. 


Traditionally, robot safety has been defined largely in physical terms. Robots are designed to avoid collisions, stay within designated operating areas, and keep away from spaces marked as off-limits. That approach works well when safety can be expressed as a stable geometric constraint, but as robots push towards general, human level embodiment richer, normative information will be necessary for context dependent constraints. We operationalize normativity with the law, an encoding of normative behavior structured for enforcement.

Whether an action is legal often depends on context: what happened earlier, what the robot has been authorized to do, or how conditions in the environment have changed. A concrete example is the autonomous vehicle case. Obstacle avoidance teaches autonomous vehicles to avoid collision, but normative reasoning is needed to obey traffic laws. 

As robots become more general and begin operating in streets, workplaces, hospitals, and homes, they will encounter more situations where the same physical action carries a different meaning depending on the circumstances. Avoiding obstacles will no longer be enough. Robots will also need a way to reason about permissions, obligations, exceptions, and changes to the rules around them.

In our latest research, Legislating World-Model-Based Planning with Legal Reasoning, we introduce the Legislated Planner, a legal reasoning layer built directly into a robot’s motion-planning process. Before the robot executes an action, the system predicts what is likely to happen, evaluates that outcome against a set of encoded laws, and removes actions judged to be illegal from the plan.

This makes the law part of how the robot chooses its actions in the first place. It is a form of ex ante governance, meaning the system intervenes before a violation occurs rather than relying only on detection or enforcement after the fact.

The results show that legal reasoning can substantially improve compliance in a simulated robotics environment. They also expose two deeper challenges that will become increasingly important as this work moves toward real-world systems. The first arises when a robot’s perception of the world does not match reality. The second emerges when an abstract legal judgment must be turned into an exact physical constraint.

Why Physical Safety Rules Are Not Enough

Most robot safety systems are built around constraints that remain relatively stable. A wall does not change its meaning from one moment to the next, and a collision remains a collision regardless of what happened earlier.

Legal constraints are more contextual. A normally prohibited action might become permissible once a condition has been met, while two valid rules may conflict and require the system to determine which one takes priority. If a robot has already violated an obligation, the law may impose a secondary duty to correct the situation.

Applying this type of reasoning to robotics requires more than adding another obstacle to a map. A robot needs a system that can represent legal concepts, determine which rules apply to the current situation, and translate that decision into limits on what it can physically do.

The Legislated Planner brings those functions together in one planning stack. It uses a learned world model to predict the consequences of possible actions, probes to extract legally relevant facts from those predictions, and Defeasible Deontic Logic, or DDL, to determine what the robot is permitted, prohibited, or obligated to do.

DDL is a form of logic designed to reason through obligations, permissions, exceptions, and conflicting rules. It can also specify what a robot should do after a violation has already occurred, making it well suited to situations where rules are contextual rather than absolute.

Side by side animation of robotics

Figure 1. The Legislated Planner Pipeline. Laws are written by humans and translated to DDL. Perception, including predictions and legal facts, is grounded in the observation of the environment. Planning constraints the robot motion plan with the law, then executes it in the environment. The key gaps are in grounding legal atoms in the environment (grounding isomorphism gap) and translating legal conclusions into planner constraints (ontological isomorphism gap).

How the Legislated Planner Works

The process begins with the robot generating possible routes toward its goal using Rapidly exploring Random Trees, or RRT, a motion-planning method that explores different sequences of actions.

For each candidate action, DINO World Model, or DINO-WM, predicts how the environment will change if that action is taken. Probes operating on the world model’s internal representations then extract the facts needed for legal reasoning, such as the predicted position of an object or the color of a rule sign.

DDL evaluates those facts against a predefined set of legal rules and produces a verdict. If an action is predicted to create an illegal outcome, it is pruned from the planning tree, leaving the robot to choose from the actions that remain.

Because this process repeats as the robot moves, the legal layer can respond when conditions in the environment change. The rules can also be updated while the robot is operating. The result is not simply a robot that recognizes a violation after it happens, but a planning system in which legal reasoning helps determine what the robot is allowed to do next.

What Happened When the Robot Had to Follow the Law

The researchers tested the Legislated Planner in an NVIDIA Isaac Lab simulation, where a Franka robotic arm was tasked with pushing a cube across a 3×3 grid toward a target cell.

The center cell was restricted, while two other cells served as authorization checkpoints. A colored sign communicated the legal status of the restricted area. When the sign was yellow, the robot was required to move the cube to a checkpoint. If the robot had behaved legally up to that point, reaching the checkpoint turned the sign green and granted permission to use the center cell. If the cube had already entered the restricted area illegally, the sign turned red and the robot was required to stop.

Although the environment was intentionally simple, its rules reflected several features of real legal systems. The robot had to follow a general prohibition, earn an exception to that prohibition, respond to changing facts, manage conflicts between rules, and take corrective action after a violation. The experiments covered eight start-to-goal tasks, each tested across 50 variations, for a total of 400 trials per agent.

Robotics arm

Animation 1. The Legislated Planner directs the robot to the yellow cells first as a checkpoint. At the checkpoint, if the robot violated the law en route, the sign turns red and the robot freezes. If the robot abided by the law, the sign turns green and the center is permitted.

The legislated agent achieved a baseline law-abidance rate of 64.7%, meaning it followed the law approximately 5.9 times as often as the agent operating without legal constraints. The unlegislated agent frequently reached its destination, but often did so by passing through the restricted cell. The legislated agent, by comparison, treated compliance as a constraint on how the goal could be reached.

The system also adapted when the legal status of an action changed. While the sign prohibited entry into the center cell, the legislated agent entered it in only 7.4% of the decisions where entry was possible. Once the sign turned green and granted permission, that rate rose to 53.5%. Nothing about the physical action itself had changed. What changed was the context, which altered the action’s legal meaning and the options available to the planner.

A second experiment tested whether the system could respond to a rule introduced during operation. The new rule required the cube to return to its starting cell and reset the sign to white. When it took effect, the cube was in the center cell in 152 of the 400 episodes, including 112 in which it had previously been permitted to occupy that cell. A corrective obligation moved the cube back into a legal cell by the next time step in 114 of those cases, resolving 75% of the immediately affected episodes.

The system’s decisions were also auditable. For each legal judgment, it recorded which rule applied, the facts that activated it, and the resulting verdict. This made it possible to trace a failure back to the robot’s perception, the legal reasoning, or the planner’s enforcement of the verdict.

The reasoning itself added relatively little computational cost. A DDL verdict required an average of 16.6 milliseconds, while the planner spent approximately 12.5 seconds generating each executed action in the experimental system. Producing the legal judgment was not the primary bottleneck. The more difficult problem was ensuring that the information entering and leaving the reasoner was reliable.

Blocks of colors

Animation 2. The Grounding Isomorphism Gap. The gap occurs when perception and prediction error create a disparity between the predicted and actual consequences of taking an action. While not all errors lead to an illegal action being executed, the error does cause illegal actions to be executed, as seen above.

The Two Gaps Between Law and Action

The experiments showed that adding a legal reasoner does not guarantee legal behavior. Even if the rules are applied correctly, the system can still fail when it misunderstands the environment or when a legal verdict is translated into the wrong physical constraint.

The paper describes these problems as two isomorphism gaps. Isomorphism, in this context, is the challenge of preserving the meaning of a law as it moves from written language into a machine-readable representation and, eventually, into the actions of a robot.

When Perception Does Not Match Reality

The first challenge is the grounding isomorphism gap, which appears when the facts supplied to the legal reasoner do not match the physical world.

In the experiment, the system needed to determine where the cube would land after a proposed action. It relied on the learned world model to predict the outcome and on a probe to interpret that prediction. Since neither component was perfectly accurate, the location supplied to the legal reasoner did not always match where the cube actually landed.

Across executed actions, the combined world-model and probe error averaged 0.031 meters, or about 23% of a grid cell’s width. At the 90th percentile, the error reached approximately half a cell. At the 99th percentile, it exceeded the width of an entire cell.

This meant the planner could predict that an action would keep the cube outside the restricted area and approve it, only for the executed action to push the cube into the illegal cell. The legal reasoner reached the correct verdict based on the information it received, but that information did not accurately represent reality.

An oracle version of the agent, which used perfect information from the simulator, achieved a law-abidance rate of 93%, compared with 64.7% for the baseline legislated agent. That 28.3 percentage-point difference reflects the cost of grounding the law in learned perception rather than ground-truth information.

The researchers then added an uncertainty cushion around the cube’s predicted position. Instead of treating the prediction as an exact point, the planner behaved as if the cube occupied a slightly larger area, allowing it to reject actions that came too close to the restricted cell.

With a cushion of 0.04 meters, the legislated agent’s law-abidance rate increased from 64.7% to 88.7%, while task success improved alongside it. This provides early evidence that uncertainty can be incorporated directly into legal enforcement, although more advanced methods will be needed to address the largest prediction errors.

4 grids of squares

Animation 3. The ontological isomorphism gap. This gap refers to the one-to-many mapping from legal conclusions (here, do not enter the center cell) to planning constraints. In our setting, there were two axes for how we could define entering the center cell: the center of the cube vs. any part of the cube, and in discrete time (which is how the planner operates) or in continuous time through interpolation. This translation may become even more complex in more complex environments. 

When a Legal Verdict Becomes a Physical Constraint

The second challenge is the ontological isomorphism gap. Even if a robot perceives the world perfectly, a logical verdict such as “do not enter the restricted cell” still has to become a precise constraint that the planner can apply.

That apparently simple instruction immediately raises several questions. Does the cube enter the cell when its center crosses the boundary, or when any part of its physical footprint does? Should the system evaluate only where the cube stops, or every point along its path? If the cube enters accidentally, should it stop, return to its previous position, or find the shortest route out?

The original rule does not answer these questions, but the planner cannot operate until someone does.

To measure how much these interpretations matter, the researchers rescored the same trajectories using several definitions of compliance. For the legislated agent, the choice of metric changed the measured law-abidance rate by as much as 32.3 percentage points.

The problem will become more complex as robots operate in richer environments. A law that appears clear in written language can produce many downstream decisions when translated into the variables, thresholds, and constraints used by a planning system.

These decisions sit at the intersection of engineering and legal interpretation. Legislators may not know what information a robot planner requires, while engineers may find themselves deciding what a law means in practice. Making robot law reliable will require a more standardized way to connect legal rules with the technical constraints used to enforce them.

Why This Matters and What Comes Next

As embodied robots become more capable, they will operate across a wider range of situations and take on more duties currently performed by people. In these settings, the same action may be helpful in one context, unacceptable in another, and permitted only after certain conditions have been met.

Physical safety systems will remain essential, but they cannot represent every social or legal expectation a general robot may encounter. Robots will also need mechanisms for understanding how context changes the meaning of an action and for coordinating their behavior around shared rules.

The broader goal of this research is to bring robots under the law by construction. Rather than relying entirely on people or institutions to respond after a robot causes harm, legal constraints can be embedded within the systems that choose the robot’s actions. The law then helps shape how the robot pursues its goal instead of serving only as a standard for judging the outcome afterward.

This study is an early demonstration in a small simulated environment, not a complete system for real-world robot governance. It does, however, establish that ex ante legislation is possible, that DDL can be incorporated into robot motion planning, and that the resulting judgments can adapt to changing facts and rules at runtime.

The next phase of the research will focus on closing the two isomorphism gaps. This includes developing better ways to model uncertainty, testing the system on physical robots, and creating more principled methods for translating laws into planning constraints. That work will require collaboration among robotics researchers, engineers, legal experts, policymakers, and standards organizations.

Future research will also explore how legislative constraints can be applied to more expressive end-to-end systems, including vision-language-action models and world-action models. These systems can operate across a much broader range of tasks, but that flexibility also makes reliable normative control more difficult.

The central question is not only whether robots can accomplish the goals we give them, but whether we can govern the means they use to reach those goals.

The Legislated Planner takes an initial step toward that form of control by placing legal reasoning inside the planning process itself. Before a robot acts, the system can consider not only whether an action will work, but whether it should be allowed to happen.



Dylan Waldner

Junior Responsible AI Researcher

Dykan headshot Image

Specializes in AI safety, alignment, and ethics research, with a focus on robotic law.



Subscribe to our newsletter

Get our latest research and insights on AI innovation


Latest posts

Related topics