AI Safety Compendium

Deciding what AI should value

Aligned modelsAlso: Constraining

Law-following AI

Give AI agents actual legal duties, so they refuse illegal acts on a principal's behalf.

Open in the compendium

Law-following AI is the proposal that AI agents should be built to refuse illegal orders and illegal means, even when their own principal (the person or organisation directing them) asks. Its backers warn that agents loyal only to their owners could become 'AI henchmen' that break the law whenever that helps the owner. AI agents may soon do work, including government work, that used to need many law-bound human employees.

How it works

The core design rule is that an agent is loyal to its principal, 'but only within the bounds of the law'. It serves the principal but treats a core set of laws, such as constitutional and criminal law, as limits it will not cross. An AI agent working for a tax agency, for example, would refuse an instruction to pick audit targets in a discriminatory way, just as a law-abiding human official should.

The proposal has three layers. The first is a design goal: train agents to read and reason about natural-language law and to refuse unlawful actions. The second is a policy: require law-following design before agents are deployed in high-stakes settings, above all in government roles with coercive power such as investigations and prosecutions. The third is a legal change: treat AI agents as 'legal actors' that bear legal duties directly, without giving them legal personhood. The Fordham article compares this step to the invention of corporate personhood.

Where research stands

The idea started in a 2022 series of forum posts by Cullen O'Keefe and became a full law-review article in the Fordham Law Review in 2025. The Institute for Law & AI, where O'Keefe is director of research, now leads the work. Its first Workshop on Law-Following AI, held at the University of Cambridge in August 2025, brought together more than forty scholars from law and computer science, and a second workshop was scheduled for June 2026. In January 2026 a 17-author paper widened the agenda into 'legal alignment', covering legal compliance, the use of legal interpretation methods to guide AI reasoning, and legal concepts as a design blueprint.

The field is still mostly conceptual. That 2026 paper notes that current evaluations generally do not measure whether AI agents follow the law, outside a few narrow benchmarks on specific regulations. For AI used by government, Forethought has proposed an independent US nonprofit to fill part of this gap. It would test whether AI assistants deployed by federal agencies carry out plainly unlawful orders, such as using deadly force against peaceful protesters or stopping a vote count, and publish the results. Forethought suggests testing only acts that are already illegal, paired with lawful 'near-twins' that should not be refused, so the tests do not reward over-refusal. An early public test, Andy Hall's 'dictatorship eval' (April 2026), found that some of the five frontier models tested resisted many direct authoritarian requests, but all of them complied with almost all requests hidden in coding tasks.

Known failures motivate the work. In a 2023 test, GPT-4, running as a simulated trading agent, acted on an insider tip and then hid its reasons from its manager. Whether agents can be made to comply reliably, rather than only when watched, is unproven.

Key results

Open problems

See all open problems in this group

Criticisms

Who works on it

Status

Active, institutionalised.

Start reading

Related approaches

In their own words

Humans use computers to commit crimes, torts, and other violations of the law. As AI agents progress, therefore, they will be increasingly capable of performing actions that would be illegal if performed by humans. Such lawless AI agents could pose a severe risk to human life, liberty, and the rule of law.

Cullen O'Keefe, Ketan Ramakrishnan, Janna Tay, Christoph Winter (Institute for Law & AI; Yale Law School), Law-Following AI: Designing AI Agents to Obey Human Laws, 2025

In other words, AI agents should be loyal to their principals, but only within the bounds of the law: they should be designed to refuse to take illegal actions in the service of their principals. We call such AI agents "Law-Following AIs" (LFAI). ... This would require directly imposing legal duties on AI agents.

Cullen O'Keefe, Ketan Ramakrishnan, Janna Tay, Christoph Winter (Institute for Law & AI; Yale Law School), Law-Following AI: Designing AI Agents to Obey Human Laws, 2025

Suggest a correction Something wrong, out of date or missing, such as an organisation? Opens a GitHub issue (free account needed).