Lab World / in vitro lab in the loop / Di Hu

In vitro lab in the loop

An agent runs a small simulated cell lab over MCP, the protocol AI agents use to call tools. A liquid handler touches no cells until it has passed a Rhodamine B dye check, and the results count only if it passes again afterwards.

Everything is simulated. No instrument, dye or cell was used. The compounds, their strengths, the cell assay, and every fault, limit and noise level are made up. The drivers are published PyLabRobot code, except for 2 unverified classes written in this repository: the plate reader's, whose commands are placeholders, and the track's. They all talk to simulated instruments.

The agent here is a fixed script. No language model made these results, but you can put one in its place.

The lab

Find the strongest compound

The made-up library has 768 compounds: 8 cores, each with 96 side groups. A core is the part that a family of compounds shares. 1 round makes 10 side groups on all 8 cores. The EL406 dispenses cells into a 384-well plate. After 16 hours in the LiCONiC incubator, the STARlet (STAR in the tables) adds the 80 compounds at 1 dose, 100 nM, with 4 wells each. 1 hour later, the reader measures how strongly the cells answer.

Each plate also has 2 controls: the vehicle, which is the liquid without a compound, and a reference compound that gives the full effect. A small statistical model, not a language model, works out how much each core and side group adds to a compound's strength. Then it picks the next 10 side groups. After 3 rounds that count, the agent nominates 1 compound.

Strength is given as pEC50. 1 unit more is 10 times stronger, and 0.18 more is about 1.5 times.

Why check

Without the dye check, the loop learns the pipette

Each core sits in 1 row of the source plate, so 1 pipetting channel serves every compound on it. When that channel gives 40% too little, the 4 replicates agree, because they share the channel. The controls look fine too: the reference is strong enough to give its full effect anyway, and the vehicle has no effect at any volume. The model decides that the core is weak, and each round makes it more certain. Its noise is fixed, so its certainty depends on how many results it has, not on what they say.

How wrong the model is about that core, in pEC50 (0 is the truth; bands are 3 of the model's own standard deviations, sd; average of 100 simulated runs)
The same numbers as a table

The dye check

The plate, then the reader, then the handler

A well that gets less dye absorbs less light. Each check takes 1 plate with 384 wells. A person pipettes 48 of them, in columns 1, 12 and 24, and the handler fills the rest at 3 volumes. The EL406 also adds the same amount of diluent to every well, on both handlers' plates. So it has to pass first: if a tube is nearly blocked, its rows read low, and a good STARlet channel would get the blame. The reader reads the plate, then reads it again after half a turn. The check asks 3 questions and stops at the first that fails:

  1. Can this plate be read at all? The 2 reads have to agree, and so do the hand-pipetted blanks (wells without dye), standards (known amounts of dye) and dye stocks.
  2. Is it the reader? A handler's error turns with the plate, and a reader's stays where it is. Some reader errors look the same after half a turn. So the check also looks for 2 patterns that the dye from 1 bad channel or tube cannot make: 1 across the hand-pipetted wells, where the handler put no dye, and a column where at least 6 of the 8 are off together. Then the plate is made again.
  3. Is it the handler? The check looks at every channel or tube, at every volume.

A check ends in 1 of 4 verdicts. Pass: the handler may be used. Needs correction: the error is steady, so the harness can ask for a different volume. Needs a person: something has to be serviced. Repeat the plate: the plate cannot be trusted. After a correction or a service, the handler has to pass a new check.

1 recorded run

2 faults to find

This run went through every layer: scripted agent, MCP, harness, MCP, 6 instrument servers, drivers, simulated instruments. The harness is the program between the agent and the instruments, and it holds the rules. The agent was not told what was wrong. Pick a request, or use the arrow keys.

    What the harness sent

      Which check blames the right thing

      How often the call is right

      The call is right when the handler is blamed if it is at fault, and not blamed if it is not. Where the handler is fine, a right call does not mean that the fault was found. The last column shows what this check said. Each number is out of 200 simulated plates, and calls that are wrong more often than right are in bold.

      All 3 checks use the same limits, but the first 2 use only the first read, and only the volume the assay uses: 2 uL for the STAR and 30 uL for the EL406. CV and median looks at the spread of all wells (CV), and compares each channel or tube with the middle one. 1 volume compares each channel or tube with hand-pipetted wells of the same dye.

      HandlerWhat is wrongCV and median1 volumeThis checkWhat this check said
      STARnothing200196195pass 194, correction 5, new plate 1
      STAR1 channel 20% low200200199correction 199, new plate 1
      STAR1 channel 15% high200200199correction 199, new plate 1
      STARall 8 channels 12% low1200199correction 199, new plate 1
      STARall 8 channels 0.4 uL short at every volume2200199correction 198, service 1, new plate 1
      STAR1 channel draws only half, 3 times in 10183199199service 199, new plate 1
      STARall 8 channels deliver nothing200200199service 199, new plate 1
      STARevery dye stock 12% weak, STAR fine200196195pass 194, correction 5, new plate 1
      STARreader 10% low on 1 row pair, STAR fine2595200service the reader 200
      STARreader 10% low on 2 mirrored row pairs, STAR fine779200new plate 200
      STARreader 6% low on 2 mirrored rows, STAR fine200181200new plate 200
      STARreader 6% low on 2 mirrored columns, STAR fine200196200new plate 200
      STARreader 4% low in its outermost wells, STAR fine200109200new plate 200
      STARreader 10% low in 1 block (rows C to H, columns 2 to 11), STAR fine171178200service the reader 200
      EL406nothing200200200pass 199, new plate 1
      EL4061 tube 20% low200200199service 199, new plate 1
      EL406all 8 tubes 10% low0200199correction 199, new plate 1
      EL4061 tube with a CV of about 14%129200199service 199, new plate 1
      EL406all 8 tubes deliver nothing, as if the pump did not turn200200199service 199, new plate 1
      EL406dye bottle 12% weak, EL406 fine200200200pass 199, new plate 1
      EL406reader 10% low on 1 row pair, EL406 fine00200service the reader 200
      EL406reader 10% low on 2 mirrored row pairs, EL406 fine00200new plate 200
      EL406reader 6% low on 2 mirrored rows, EL406 fine192181200new plate 200
      EL406reader 6% low on 2 mirrored columns, EL406 fine200196200new plate 200
      EL406reader 4% low in its outermost wells, EL406 fine200170200new plate 200
      EL406reader 10% low in 1 block (rows C to H, columns 2 to 11), EL406 fine1380200service the reader 200

      The 1-volume check finds the handler's faults about as well. The dye check adds 2 things: it does not blame the handler for these reader faults, and its 3 volumes show which volumes to ask for instead.

      The check has blind spots too. It reads dye, so it cannot see a reader that is wrong only when it reads cells. A real reader can use different optics for the 2. The hand-pipetted wells set the scale. If the hand pipette is 2% off or more, good handlers can get corrected, and a bad one that is off by about as much can pass. Check the pipette by weight. A dye stock that was diluted wrongly, or a source plate that does not hold the same dye, makes good channels look bad. A reader error that looks the same after half a turn can also be missed or blamed on the handler: a small one, above all in the middle of the plate, and between the hand-pipetted columns even a large one, if it covers only a part of each column. 1 bubble is enough to send a good channel for service. And dye in a watery diluent says nothing about DMSO (the usual solvent for compounds), or about cells that settle. The longer list

      What it changes

      Runs that misjudged at least 1 core

      Each cell shows how many simulated runs misjudged a core, out of those that gave an answer. The number in brackets is the largest error of a core in pEC50, averaged over those runs. Misjudged means more than 3 of the model's own sd from the truth. There are 100 runs per cell. "No answer" means that every run used up its 6 assay plates.

      Every run keeps only plates with a Z-prime of at least 0.5. Z-prime says how well a plate separates the full effect from none. Controls also compares the control wells of each row pair with the middle row pair's. Dye check is all the rules.

      What is wrongZ-primeControlsDye checkPlates with the check: dye + assay
      nothing6 of 100 (0.03)6 of 100 (0.03)7 of 100 (0.03)4.2 + 3.1
      1 EL406 tube 20% low100 of 100 (0.23)no answer8 of 100 (0.03)5.2 + 3.1
      1 EL406 tube 10% low99 of 100 (0.12)26 of 27 (0.10)8 of 100 (0.03)5.2 + 3.1
      1 STAR channel 20% low95 of 100 (0.08)95 of 100 (0.08)8 of 100 (0.03)5.1 + 3.0
      1 STAR channel 40% low100 of 100 (0.18)100 of 100 (0.18)6 of 100 (0.03)5.1 + 3.0
      1 STAR channel draws only half, 3 times in 1090 of 100 (0.08)90 of 100 (0.08)6 of 100 (0.03)5.1 + 3.0
      reader 10% low on 2 rows, in every read100 of 100 (0.15)17 of 17 (0.14)7 of 100 (0.03)5.2 + 3.1
      reader 6% low on 2 rows, but only when it reads cells98 of 100 (0.09)97 of 99 (0.09)96 of 98 (0.09)5.0 + 3.5
      1 EL406 tube 20% low, starting after the first assay plate100 of 100 (0.17)no answer8 of 99 (0.03)7.1 + 5.0

      The dye check does not help if the reader is wrong only when it reads cells. No dye plate can show that. If the error is too small for the controls, it gets through.

      Even when nothing is wrong, some runs misjudge a core. With 8 cores and 3 sd, chance alone gives at most about 2 in 100. The rest is mostly that healthy channels and tubes differ a little, and the model does not know that.

      Size matters. A channel that is 20% low moves its core by about 0.08, or 1.2 times. A dispenser tube that is 20% low moves it by about 0.23, or 1.7 times. The controls catch that tube, but the run uses up its plates without saying why. These 2 controls cannot catch a weak channel. A third one near its EC50, the dose with half the full effect, could catch a large loss. This plate does not have one.

      The pick

      On average, the pEC50 of the nominated compound is a little below that of the strongest of all 768: 0.08 to 0.10 below with Z-prime only, 0.08 to 0.09 with the controls, and 0.08 to 0.09 with the dye check. So on average, the pick is about as strong with the dye check or without it. But when the fault sits on the core of the strongest compound, the pick often leaves that core without the dye check. The table covers only those runs. It shows how many still picked from that core, out of those that gave an answer. The first row shows the same seeds without a fault:

      What is wrongZ-primeControlsDye check
      nothing13 of 1513 of 1513 of 15
      1 EL406 tube 20% low0 of 15no answer14 of 15
      1 EL406 tube 10% low2 of 150 of 614 of 15
      1 STAR channel 20% low8 of 158 of 1514 of 15
      1 STAR channel 40% low1 of 151 of 1514 of 15
      1 STAR channel draws only half, 3 times in 109 of 159 of 1514 of 15
      reader 10% low on 2 rows, in every read1 of 150 of 213 of 15
      reader 6% low on 2 rows, but only when it reads cells4 of 154 of 154 of 15
      1 EL406 tube 20% low, starting after the first assay plate0 of 15no answer13 of 15

      With one of these faults and no dye check, what the lab believes about its chemistry is usually wrong, even when the pick is good. So is everything it builds on that.

      How it is wired

      agent               the scripted agent, Claude Code, or any MCP client
        |                 MCP, 8 tools
      harness             the rules, the run record, the holds
        |                 MCP, 1 server per instrument
      mover  EL406  LiCONiC  STARlet  reader  person
        |                 drivers
      simulated instruments, which check what the drivers send
        |
      1 simulated bench   what is really in each well; the harness cannot see it

      The reader stands in for a BMG LABTECH PHERAstar FSX. Its commands have not been decoded, so each one is a placeholder, written TODO_n. The person does what software cannot, such as connecting a bottle: no command on the wire names a liquid. Each step goes into a run record before it is sent and again when it is answered. The lines form a hash chain, so a change in the middle shows.

      Code, rules and limits / How each instrument is reached / Each instrument, step by step