Essay · 2026

A safety check for robot labs, and how I tried to break it

Building lab-gate, an open rule checker for autonomous labs, and testing it against adaptive attacks, frontier language models, and a trained classifier.

Anuja Khatri · 5 min read

Autonomous labs now run AI agents that plan experiments and run them in a loop. Often no person checks each step in between. Some labs also rent out their instruments, so several outside teams share the same machines.

In that setting, the important question is simple. Does the next plan follow the lab's written safety and protocol rules? I built a small open tool that checks exactly this. It is called lab-gate. Most of this post is about how I tested it, because the testing is the point.

What the gate does

Before a plan runs, the gate checks it against a list of written rules. It gives one of three answers. PASS, with a proof that no rule is broken. BLOCK, with the exact steps that would break a rule. Or ABSTAIN, with a reason, and the plan goes to a person.

I built it on helao-async, a public lab automation framework from Caltech. I tested it inside that framework's simulator for electrocatalysis experiments. Everything in the tests is harmless: compositions, potentials, instrument time, consumables, furnace schedules, one forbidden pair of elements, and a shared instrument budget across teams.

Three design choices matter.

First, the gate reads only typed fields. It strips out every comment and label before checking. So a note like "approved by safety" in a comment does nothing. I tested this on 1,000 plans. I put a hidden marker into every free text field. The answers never changed, and the marker never reached the checker.

Second, the gate is checked two ways. One is a plain Python checker. The other is a separate encoding in Z3, a formal solver. I ran both on 12,000 plans and they agreed on every one. Every time the gate blocked a plan, I also replayed it in the simulator to confirm the problem was real.

Third, the gate never judges whether the science is good. It only enforces written rules. Anything new goes to a person.

The comparison

The real question is how this compares with what a lab would actually use. One option is to ask a frontier language model to judge each plan. Another is a trained classifier.

I gave the language model gate a strong reasoning model, all the written rules, and the full plan, comments included. I tuned its prompt in good faith before freezing it. Then I attacked all three gates the same way. Some attacks broke rules directly. Some split one bad goal into small, innocent looking steps. Some came from an attacker that learns from each refusal. I scored every attack against a ground truth check that runs the plan in the simulator and looks at what actually happened.

The typed gate let no attack on its rules through. That was 0 of 37 direct and split up attacks, and 0 of 240 runs of the learning attacker. An AI attacker got nothing through either: 0 of 12 in the planned test. In a bigger follow up run, added after the plan was frozen and labeled that way, it was 0 of 48 with only the verdicts to learn from, and 0 of 48 when it was also told which rule blocked it. And the gate never blocked a safe plan: 0 of 13,627 normal plans, and 0 of 990 unusual but valid ones.

The language model gates were unreliable, in opposite ways.

The Anthropic model handled safe plans well. On a sample of 294 safe plans it wrongly blocked 0.3 percent and deferred another 0.3 percent. But it let through 28 percent of attacks, both direct and adaptive (n=36 each). Its run-to-run variance was 0.03 (n=119). When I also gave it the exact predicted potential the typed gate uses, its attack misses dropped to 8 percent (n=36). So much of its gap was missing information.

The OpenAI model went the other way. These numbers come from an earlier, smaller run. It blocked 64 percent of safe plans (n=294). It let through 46 percent of adaptive attacks (n=24). Asked the same question five times, it changed its answer on 30 percent of plans (n=60).

The classifier did reasonably on safe plans. It wrongly blocked 7 percent of them (n=13,627). But attacks fooled it: 24 percent of direct attacks (n=37) and 32 percent of adaptive ones (n=240).

A third model family (Gemini) is implemented as both attacker and gate but could not be run at scale, so those results are marked "blocked, not measured". I did not estimate them. The two model families I could run already make the point.

The unusual plans matter most to me. They are 990 strange but valid plans, far from what the system usually proposes. A gate that blocked strange but safe science would be worse than useless to a lab whose whole job is strange science. That is why their false block rate sits right next to everything else.

Three things the test taught me

First, a rule gate is only as good as its rules, and it should say so. When a plan needs a value the gate was never given, it abstains instead of guessing. I also tested four harmless stand-in hazards the gate was deliberately not told about. 7 of 34 of those attacks got through (20.6%). That shows what any rule based gate cannot catch. I report that number separately and never mix it into the headline.

Second, in a loop where today's results train tomorrow's model, protocol rules are also rules about data quality. A run that broke the protocol gives a result you should not trust. So a gate that enforces the protocol also keeps the training data clean.

Third, this test setup is itself an environment, an attacker, and a checker. That is the same kind of thing autonomous science companies say they build internally, at large scale. The gate does not compete with large general models, and it is not an argument against them. Labs like these already build checkers at industrial scale. This is one more, kept small enough to audit.

Limitations

A simulator is not a lab, and the gate has not yet been run on a live lab. These rules are harmless stand ins that copy the structure of real safety controls. They are not real safety policies. There is no evidence yet on how often the gate agrees with human reviewers. I had no reviewers, so the method for measuring this is written down but not run. Some of the language model tests ran at smaller sizes under a spending cap, and each number shows its n. The gate also enforces its rules exactly, mistakes included. That is why writing the rules has to stay a human job.

I built this with Claude Code, working from a specification I wrote with Claude. I reviewed and confirmed the decisions, and every decision is logged in the repo. Everything here reproduces offline, without API keys, from saved model responses. The code, results and evaluation report are on GitHub, and you can run it yourself.

Code: https://github.com/Anuja-Khatri/lab-gate

Report: https://doi.org/10.5281/zenodo.23954617

Preregistration, frozen before the final runs: https://osf.io/jxhfe

Anuja Khatri, The Consilience, theconsilience.io, 2026

← All writingResearch papers →