Agentic Lab Guide Liquid handling  ·  Di Hu

Chapter one · Hamilton STAR and STARlet

From an instrument to an instrument driven by an agent.

A step-by-step guide to putting an AI agent in the driver's seat of a real lab instrument, and getting it to perform at the scientist's bar. The path is universal. Chapter one walks it with a Hamilton STAR.

The walk

From a scientist to one who trains robots.

How do you go from being a scientist to one who trains robots to scale science at the expert's bar? The walk is the same for any instrument.

1Reverse engineer your instrumentFirst, get to where software can drive it. PyLabRobot already drives the Hamilton STAR. For an instrument with no published automation API, see plr-reverse-engineer.
2Talk to it through an agentic harnessThrough what matters to you: your own protocols, your own Claude Code, whatever you are comfortable with.
3Let it drive the instrumentWith your protocol taken into consideration.
4First passThe deck layout, the protocol, the basic steps.
5Second passGo into the deck. With the tips in place, how do you want this to go? The blowout volume, the speed and the distance from the bottom are all tunable parameters.

Steps 1 to 3 are Layer 1. The 2 passes are Layer 2.

A part of its own

Liquid handling: an expert's guide to the tunable parameters. The blowout volume, the speed and the distance from the bottom, and where to start with each.

How this guide works

2+ layers of cake.

It is universal. Whatever the instrument, the path is the same: plug it into a Raspberry Pi, or any computer that can stay with it, drive it with PyLabRobot, and make an MCP that connects your company's context to it. That is layer 1 of the cake. Layer 2 is baking in expert judgment. And there are more layers of cake than two.

Layer 1Get it goingFrom an instrument, to a Raspberry Pi, to an MCP that connects your company's context to the PyLabRobot that drives it.
Layer 2Bake in expert judgmentExpert-guided fine-tuning, to the level that is appropriate for the biological material.
Layer 3The Rhodamine QCRhodamine B transfers, a plate read, and the CV of the liquid transfer.
Layer 4Biological validationBeing written.

The guiding principle. These principles first, then the Rhodamine QC. If it looks good, it is good for biological validation.

Each chapter walks one instrument up through the layers. PyLabRobot keeps a list of the machines it supports.

Chapter 01

Hamilton STAR and STARlet

You have a Hamilton STAR or STARlet on the bench. This chapter puts an agent in front of it.

Layer 1

Get it going.

5 steps: a Raspberry Pi, your network, one cable, Claude Code, and an MCP.

What you need

Hamilton STAR or STARletThe instrument.
Raspberry PiWith its power supply and a microSD card. This is the small computer that stays with the instrument. It does not have to be a Pi: any computer that can stay with the instrument and run Python works.
USB-A to USB-B cableConnects the Pi to the Hamilton. USB-A is the flat plug and goes into the Pi. USB-B is the square plug and goes into the Hamilton.
Ethernet cable or Wi-FiPuts the Pi on your network.
A laptop with Claude CodeWhere you work with the agent.
1

Start with a Raspberry Pi

The Pi is a dedicated computer for the instrument. It sits next to the Hamilton and stays on, so the agent always has a way in and your laptop can come and go. It does not have to be a Raspberry Pi. Any computer that can stay with the instrument works too, and then you start at step 2.

Install Raspberry Pi OS on the microSD card with the Raspberry Pi Imager. In the Imager's settings, give the Pi a hostname, create a user, and turn on SSH. This guide uses the hostname star-pi.

2

Get it connected and configured on your network

Plug the Pi into your network with the Ethernet cable, or use the Wi-Fi you set in the Imager. Power it on, then reach it from your laptop:

ssh <user>@star-pi.local

Once you are in, bring it up to date:

sudo apt update
sudo apt upgrade
sudo apt install -y git python3-venv

Then, back on your laptop, let it into the Pi without a password, so Claude Code can reach the Pi on its own:

ssh-copy-id <user>@star-pi.local

If your laptop has no SSH key yet, run ssh-keygen first.

3

Cable the Hamilton to the Pi

Connect the USB-A to USB-B cable: flat plug into the Pi, square plug into the Hamilton. Power the Hamilton on.

Let users on the Pi talk to USB devices. Add these 2 lines to /etc/udev/rules.d/99-usb.rules:

SUBSYSTEM=="usb", MODE="0666"
SUBSYSTEM=="tty", MODE="0666"

Then reload the rules and check that the Pi can see the instrument:

sudo udevadm control --reload-rules && sudo udevadm trigger
lsusb

These rules open every USB device on the Pi to its users, which is fine for a Pi you control. They come from the PyLabRobot Raspberry Pi guide.

4

Have Claude install PyLabRobot and write the driving approach

PyLabRobot is the open-source Python library that talks to the Hamilton. From here on you can ask Claude Code instead of typing, and Claude Code works on the Pi over SSH. Each ask is followed by the code it comes down to, so you can check the agent's work or run it yourself.

First, the install.

Say to Claude Code

You can reach a Raspberry Pi with ssh <user>@star-pi.local. It is connected by USB to a Hamilton STAR. On the Pi, clone the Agentic Lab Guide, make a Python virtual environment in its code folder, and install the requirements. Tell me which versions you installed.

on the Pi
git clone https://github.com/di-omics/agentic-lab-guide.git
cd agentic-lab-guide/code
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
code/requirements.txt
pylabrobot[usb]==0.2.2
mcp==2.3.0

These are the versions this guide was tested with.

Then the driving approach: a short plan for how the agent will drive this instrument, written before it drives anything.

Say to Claude Code

Read the PyLabRobot source you just installed, not your memory of it. Then write a one-page driving approach for this Hamilton STAR: how you will connect, how you will initialize, what you will run first, what you will never run without asking me, and how a run is stopped. Do not move the instrument yet.

Then first contact: connect, initialize, stop. The script runs in simulation unless you ask for the real instrument.

code/first_contact.py
"""First contact: connect to the Hamilton, initialize it, and stop.

Simulation first. Nothing moves:

    python first_contact.py

Then the real instrument, with someone standing at it:

    python first_contact.py --real

Add --starlet if the instrument is a STARlet.
"""
import argparse
import asyncio

from pylabrobot.liquid_handling import LiquidHandler
from pylabrobot.liquid_handling.backends import (
    LiquidHandlerChatterboxBackend,
    STARBackend,
)
from pylabrobot.resources.hamilton import STARDeck, STARLetDeck


async def main(real: bool, starlet: bool) -> None:
    backend = STARBackend() if real else LiquidHandlerChatterboxBackend()
    deck = STARLetDeck() if starlet else STARDeck()
    lh = LiquidHandler(backend=backend, deck=deck)

    # On the real instrument, setup initializes it. It moves.
    await lh.setup()
    print("Connected and initialized." + ("" if real else " (simulated)"))

    await lh.stop()
    print("Stopped.")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--real", action="store_true",
                        help="drive the real instrument")
    parser.add_argument("--starlet", action="store_true",
                        help="the instrument is a STARlet")
    args = parser.parse_args()
    asyncio.run(main(args.real, args.starlet))
Say to Claude Code

Run first_contact.py in simulation and show me the output. Then run it with --real. I am standing at the instrument.

on the Pi
python first_contact.py          # simulation, nothing moves
python first_contact.py --real   # the real instrument, it moves
5

Make an MCP that connects your company's context to the instrument

So far the instrument answers to one person at one terminal. An MCP changes that. MCP, the Model Context Protocol, is an open standard for connecting AI applications to outside systems. An MCP server on the Pi offers the instrument as a set of tools, and each tool is something PyLabRobot can do.

Claude Code is where your company's context already lives. This adds the instrument to it, so the same agent can reach the PyLabRobot that drives the instrument.

code/instrument_mcp.py
"""An MCP server that offers one instrument to Claude Code.

It runs on the Raspberry Pi. Claude Code starts it over SSH and calls
its tools. It simulates unless STAR_REAL=1 is set. Set
STAR_MODEL=STARlet for a STARlet.
"""
import contextlib
import os
import sys

from mcp.server.mcpserver import MCPServer
from pylabrobot.liquid_handling import LiquidHandler
from pylabrobot.liquid_handling.backends import (
    LiquidHandlerChatterboxBackend,
    STARBackend,
)
from pylabrobot.resources.hamilton import STARDeck, STARLetDeck

REAL = os.environ.get("STAR_REAL") == "1"
STARLET = os.environ.get("STAR_MODEL", "STAR").lower() == "starlet"

server = MCPServer("hamilton-star")
lh: LiquidHandler | None = None


@server.tool()
async def status() -> str:
    """Say whether the instrument is connected, and if this is real."""
    state = "connected" if lh is not None else "not connected"
    mode = "real instrument" if REAL else "simulation"
    return f"{state} ({mode})"


@server.tool()
async def connect_and_initialize(someone_is_watching: bool) -> str:
    """Connect and initialize. On the real instrument this moves it."""
    global lh
    if lh is not None:
        return "Already connected."
    if REAL and not someone_is_watching:
        return "Refused. Someone has to be standing at the instrument."
    backend = STARBackend() if REAL else LiquidHandlerChatterboxBackend()
    deck = STARLetDeck() if STARLET else STARDeck()
    handler = LiquidHandler(backend=backend, deck=deck)
    with contextlib.redirect_stdout(sys.stderr):  # stdout belongs to MCP
        await handler.setup()
    lh = handler
    return "Connected and initialized."


@server.tool()
async def stop() -> str:
    """Stop and disconnect from the instrument."""
    global lh
    if lh is None:
        return "Not connected."
    with contextlib.redirect_stdout(sys.stderr):
        await lh.stop()
    lh = None
    return "Stopped."


if __name__ == "__main__":
    server.run()  # stdio: Claude Code talks to it over stdin and stdout

Connect it to Claude Code. Run this on your laptop:

on your laptop
claude mcp add --transport stdio hamilton-star -- \
  ssh <user>@star-pi.local \
  "cd agentic-lab-guide/code && env/bin/python instrument_mcp.py"

That is the simulation. Claude Code starts the server on the Pi over SSH whenever it needs it.

Say to Claude Code

Use the hamilton-star tools. Check the status, connect and initialize, check the status again, then stop.

When the simulation does what you expect, switch to the real instrument:

on your laptop
claude mcp remove hamilton-star
claude mcp add --transport stdio hamilton-star -- \
  ssh <user>@star-pi.local \
  "cd agentic-lab-guide/code && STAR_REAL=1 env/bin/python instrument_mcp.py"

On the real instrument, connect_and_initialize refuses unless someone is standing at it.

For a fuller example of PyLabRobot behind MCP tools, see plr-mcp.

Layer 1 is done when

Claude Code, with your company's context, can connect to the instrument through the MCP, initialize it, and stop it, while you watch.

Stay at the instrument. A liquid handler has moving parts. Someone watches the deck for every run and knows how to stop it. PyLabRobot drives the STAR through its firmware, and its authors are plain that you use the driver at your own risk and that warranty is between you and your vendor.

Layer 2

Bake in expert judgment.

Getting the instrument to move is layer 1 of the cake. Layer 2 is baking in expert judgment. There is tacit knowledge to bake in.

You do not always need an optimizer. Instead of fine-tuning with Bayesian optimization, use an expert-guided approach, and fine-tune to the level that is appropriate for the biological material.

It takes 2 passes. The first pass gets the deck layout, the protocol and the basic steps. In the second pass you go into the deck and think about how you want each step to go, with the tips in place.

First pass · the deck layout, the protocol, the basic steps

1

Take a picture of the deck

Take a picture of the deck, so the agent knows where the tip carriers and the plate carriers are. Claude Code reads the photo and codes the deck in. Take it from the front, with the whole deck in the frame.

Say to Claude Code

Here is a photo of the deck. Find the tip carriers and the plate carriers. Tell me which rail each one sits on and what is in each position. Then write the deck in code and print it back, so I can compare it with the photo.

code/deck.py
"""The deck, in code. Yours comes from a photo of your own deck.

This example deck has one tip carrier and one plate carrier. Print it
and compare it with the photo:

    python deck.py
"""
import asyncio

from pylabrobot.liquid_handling import LiquidHandler
from pylabrobot.liquid_handling.backends import (
    LiquidHandlerChatterboxBackend,
    STARBackend,
)
from pylabrobot.resources import (
    PLT_CAR_L5AC_A00,
    TIP_CAR_480_A00,
    cor_96_wellplate_360uL_Fb,
    hamilton_96_tiprack_300uL_filter,
    nest_12_troughplate_15000uL_Vb,
    set_tip_tracking,
    set_volume_tracking,
)
from pylabrobot.resources.hamilton import STARDeck, STARLetDeck

# Where the carriers sit. Read these off the photo of your deck.
TIP_CARRIER_RAIL = 3
PLATE_CARRIER_RAIL = 15


def build_deck(lh: LiquidHandler):
    """Put the carriers and labware on the deck, as in the photo."""
    tip_carrier = TIP_CAR_480_A00(name="tip carrier")
    tip_carrier[0] = tips = hamilton_96_tiprack_300uL_filter(name="tips")

    plate_carrier = PLT_CAR_L5AC_A00(name="plate carrier")
    plate_carrier[0] = reservoir = nest_12_troughplate_15000uL_Vb(
        name="reservoir")
    plate_carrier[1] = plate = cor_96_wellplate_360uL_Fb(name="plate")

    lh.deck.assign_child_resource(tip_carrier, rails=TIP_CARRIER_RAIL)
    lh.deck.assign_child_resource(plate_carrier, rails=PLATE_CARRIER_RAIL)
    return tips, reservoir, plate


async def connect(real: bool = False, starlet: bool = False):
    """Connect, initialize, and build the deck. Simulation unless real."""
    set_tip_tracking(True)      # no picking up a tip that is not there
    set_volume_tracking(True)   # no aspirating liquid that is not there
    backend = STARBackend() if real else LiquidHandlerChatterboxBackend()
    deck = STARLetDeck() if starlet else STARDeck()
    lh = LiquidHandler(backend=backend, deck=deck)
    await lh.setup()
    tips, reservoir, plate = build_deck(lh)
    return lh, tips, reservoir, plate


async def main() -> None:
    lh, *_ = await connect()
    lh.summary()
    await lh.stop()


if __name__ == "__main__":
    asyncio.run(main())
on the Pi
python deck.py

It prints the deck, rail by rail. If the printout and the photo disagree, the photo wins.

2

Set up a liquid transfer from the deck

Have a source and a destination 96-well plate, and move liquid between them. 2 transfers to start: a simple transfer, 100 uL from a 12-well reservoir into every well of the plate, and a serial dilution.

code/transfer.py
"""Layer 2 transfers: a simple transfer and a serial dilution.

Both go from a 12-column reservoir into a 96-well plate, with all
eight channels at once. Simulation unless you pass --real.

    python transfer.py simple      # 100 uL of dye into every well
    python transfer.py dilution    # a two-fold serial dilution
    python transfer.py simple --corrections corrections.json
    python transfer.py simple --material cells

The agent says what the material is. The rulebook in principles.py
sets the speed, the heights and the blowout. A real simple transfer
needs your top speed and your heights set there first.

Reservoir column 1 holds the Rhodamine B, column 2 the water, and
column 12 takes waste.
"""
import argparse
import asyncio
import json
import sys

from pylabrobot.resources import Coordinate

from deck import connect
from principles import (aspirate_args, describe, dispense_args,
                        handling, not_set)

VOLUME = 100        # uL in every well at the end
MIX_CYCLES = 3      # times to draw up and push out when mixing
DILUTION_COLUMNS = 6    # columns 1 to 6 hold the series
BLANK_COLUMN = 12       # diluent only, for the reader's background

# Eight channels in one reservoir column: 9 mm apart, like rows A to H.
IN_RESERVOIR = [Coordinate(0, (3.5 - i) * 9, 0) for i in range(8)]


def column(plate, number):
    return plate[f"A{number}:H{number}"]


async def from_reservoir(lh, reservoir, number, vols, **how):
    well = reservoir[f"A{number}"][0]
    await lh.aspirate([well] * 8, vols=vols,
                      offsets=IN_RESERVOIR, spread="custom", **how)


async def to_reservoir(lh, reservoir, number, vols):
    well = reservoir[f"A{number}"][0]
    await lh.dispense([well] * 8, vols=vols,
                      offsets=IN_RESERVOIR, spread="custom")


async def simple(lh, tips, reservoir, plate, corrections=None,
                 material="regular", volume=VOLUME):
    """The same volume from reservoir column 1 into every well."""
    reservoir["A1"][0].tracker.set_volume(12000)  # what you loaded, in uL

    # The expert's principles set how the liquid is handled.
    how = handling(material)
    print(describe(material, volume))
    if not_set(material):
        print(not_set(material))
        print("Until then, they are left to PyLabRobot.")

    # One volume per channel, rows A to H. Corrections come from a read.
    factors = corrections or {}
    vols = [round(volume * factors.get(row, 1), 1) for row in "ABCDEFGH"]
    print("asking each channel for, in uL:", vols)

    await lh.pick_up_tips(column(tips, 1))
    for number in range(1, 13):
        await from_reservoir(lh, reservoir, 1, vols,
                             **aspirate_args(how, vols))
        await lh.dispense(column(plate, number), vols=vols,
                          **dispense_args(how, vols))
    await lh.discard_tips()


async def dilution(lh, tips, reservoir, plate):
    """Two-fold dilution across columns 1 to 6. Column 12 is the blank."""
    reservoir["A1"][0].tracker.set_volume(5000)   # dye
    reservoir["A2"][0].tracker.set_volume(10000)  # diluent
    tip_column = iter(range(1, 13))

    # Diluent first: every column after the first, and the blank.
    await lh.pick_up_tips(column(tips, next(tip_column)))
    for number in [*range(2, DILUTION_COLUMNS + 1), BLANK_COLUMN]:
        await from_reservoir(lh, reservoir, 2, [VOLUME] * 8)
        await lh.dispense(column(plate, number), vols=[VOLUME] * 8)
    await lh.discard_tips()

    # Dye into column 1, twice the final volume.
    await lh.pick_up_tips(column(tips, next(tip_column)))
    await from_reservoir(lh, reservoir, 1, [2 * VOLUME] * 8)
    await lh.dispense(column(plate, 1), vols=[2 * VOLUME] * 8)

    # Carry half into the next column, mix, change tips, repeat.
    for number in range(1, DILUTION_COLUMNS):
        here, there = column(plate, number), column(plate, number + 1)
        await lh.aspirate(here, vols=[VOLUME] * 8)
        await lh.dispense(there, vols=[VOLUME] * 8)
        for _ in range(MIX_CYCLES):
            await lh.aspirate(there, vols=[VOLUME] * 8)
            await lh.dispense(there, vols=[VOLUME] * 8)
        if number < DILUTION_COLUMNS - 1:
            await lh.discard_tips()
            await lh.pick_up_tips(column(tips, next(tip_column)))

    # Take the extra out of the last column so every well reads alike.
    await lh.aspirate(column(plate, DILUTION_COLUMNS), vols=[VOLUME] * 8)
    await to_reservoir(lh, reservoir, 12, [VOLUME] * 8)
    await lh.discard_tips()


def report(plate):
    """Print what the plate should now hold, column by column."""
    for number in range(1, 13):
        volumes = {round(well.tracker.get_used_volume(), 1)
                   for well in column(plate, number)}
        print(f"column {number:2}: {sorted(volumes)} uL")


async def main(args) -> None:
    if args.real and args.task == "simple" and not_set(args.material):
        sys.exit("A real run needs your numbers.\n"
                 + not_set(args.material))
    lh, tips, reservoir, plate = await connect(args.real, args.starlet)
    if args.task == "simple":
        corrections = None
        if args.corrections:
            with open(args.corrections) as handle:
                corrections = json.load(handle)
        await simple(lh, tips, reservoir, plate, corrections,
                     args.material, args.volume)
    else:
        await dilution(lh, tips, reservoir, plate)
    report(plate)
    await lh.stop()


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("task", choices=["simple", "dilution"])
    parser.add_argument("--real", action="store_true",
                        help="drive the real instrument")
    parser.add_argument("--starlet", action="store_true",
                        help="the instrument is a STARlet")
    parser.add_argument("--corrections", metavar="FILE",
                        help="per-channel corrections from read_check.py")
    parser.add_argument("--material", default="regular",
                        help="regular, cells or lysis")
    parser.add_argument("--volume", type=float, default=VOLUME,
                        help="uL per well, for the simple transfer")
    asyncio.run(main(parser.parse_args()))
Say to Claude Code

Run both transfers in simulation and show me what ends up in each column of the plate.

on the Pi
python transfer.py simple      # 100 uL into every well
python transfer.py dilution    # a two-fold serial dilution

In simulation, PyLabRobot keeps count of every tip and every microliter. Plant a mistake to see it: in simple, change 12000 to 5000 and run it again. The plate needs 9,600 uL, so the run stops with Not enough liquid in container.

The dilution runs across 6 columns, with column 12 as the blank. That is a starting point. The dye design in Layer 3 decides how far the series can go.

These 2 transfers are the basic steps. Your own protocol goes in the same way: the agent takes the protocol into consideration and writes its steps as transfers on this deck.

Say to Claude Code

Here is my protocol. Write its basic steps as transfers on this deck: what moves, from where, to where, and how much. Run it in simulation and show me what ends up in each well.

Second pass · go into the deck

3

Fine-tune with the expert's principles

Now go into the deck and think it through. When you do this experiment, with the tips in place, how do you want this to go? The blowout volume, the speed and the distance from the bottom are all tunable parameters.

The expert's principles have a part of their own: Liquid handling. It holds the tunable parameters, where to start with each, and the rulebook, code/principles.py. Here they are applied on this deck. The agent says what the material is. The rulebook sets the speed, the heights and the blowout.

Say to Claude Code

Run the simple transfer for cells in simulation. Show me the speed, the heights and the blowout it used, and why.

on the Pi
python transfer.py simple --material cells
the lines to look for
cells, 100 uL
  aspirate at top speed, height not set
  dispense at 60 percent of top speed, height not set
  blowout  20 uL
...
Dispensing:
pip#  vol(ul)  resource             offset           flow rate  blowout    lld_z
  p0: 100.0    plate_well_A1        0,0,0            None       20.0       None
  p1: 100.0    plate_well_B1        0,0,0            None       20.0       None
...

The blowout is already in the transfer. The flow rate and the height read None until you set your top speed and your heights in the rulebook. Then the dispense into cells runs at 60 percent of your top speed, at your height over cells.

The transfer has no speed to argue with, only a material. A material without a principle is refused:

on the Pi
python transfer.py simple --material blood
what it prints
ValueError: No principle for 'blood'. Ask the expert.

A real simple transfer does not start until you set your top speed and your heights in the rulebook.

Layer 3

The Rhodamine QC.

Principles first, then the Rhodamine QC. Before the instrument does real work, it has to show that it moves liquid the way it says it does. 4 steps: Rhodamine B transfers, a plate read, a look at the numbers, and the CV of the liquid transfer, readjusted until it passes.

1

Set up Rhodamine B transfers

Simulation checks the logic. It cannot tell you whether the liquid really arrived. So make the liquid something a plate reader can see: Rhodamine B, at the right concentration. Where more of it arrives, the well reads higher.

Claude will design this for you.

Say to Claude Code

My plate reader is a <model>. Design the Rhodamine B for these 2 transfers: the wavelength, the concentration so that 100 uL in a 96-well plate reads in the middle of the reader's linear range, how to make it up from my stock, and what goes in which reservoir column.

code/dye_design.py
"""Design the Rhodamine B for the QC transfers.

This is a starting point worked out from public numbers. Read the dye
once on your own plate reader and adjust before you trust it.

    python dye_design.py
    python dye_design.py --target 0.8 --stock 100 --make 20
"""
import argparse

MOLAR_MASS = 479.01    # g/mol, Rhodamine B
EXTINCTION = 110000    # per M per cm near 554 nm. The supplier's range
                       # is 104,500 to 115,800, measured in methanol.
PATH_LENGTH = 0.3      # cm, about how deep 100 uL sits in a 96-well plate
DILUTION_COLUMNS = 6

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--target", type=float, default=0.8,
                        help="absorbance wanted from 100 uL")
    parser.add_argument("--stock", type=float, default=100,
                        help="your stock, in ug/mL")
    parser.add_argument("--make", type=float, default=20,
                        help="mL of working dye to make")
    args = parser.parse_args()

    molar = args.target / (EXTINCTION * PATH_LENGTH)
    ug_per_ml = molar * MOLAR_MASS * 1000
    stock_ml = args.make * ug_per_ml / args.stock

    print("Read absorbance near 554 nm, 100 uL per well.")
    print(f"Working dye: {molar * 1e6:.0f} uM, which is"
          f" {ug_per_ml:.1f} ug/mL.")
    print(f"To make {args.make:.0f} mL: {stock_ml:.2f} mL of"
          f" {args.stock:.0f} ug/mL stock,"
          f" topped up to {args.make:.0f} mL with water.")
    print("Reservoir: dye in column 1, water in column 2,"
          " column 12 empty for waste.")
    print("Simple transfer: every well should read about"
          f" {args.target:.2f} above the blank.")
    series = [args.target * 0.5 ** n for n in range(DILUTION_COLUMNS)]
    print("Serial dilution, columns 1 to 6: "
          + ", ".join(f"{value:.3f}" for value in series))
    print("The last columns sit near a reader's floor."
          " Check yours can read them.")
what it prints
Read absorbance near 554 nm, 100 uL per well.
Working dye: 24 uM, which is 11.6 ug/mL.
To make 20 mL: 2.32 mL of 100 ug/mL stock, topped up to 20 mL with water.
Reservoir: dye in column 1, water in column 2, column 12 empty for waste.
Simple transfer: every well should read about 0.80 above the blank.
Serial dilution, columns 1 to 6: 0.800, 0.400, 0.200, 0.100, 0.050, 0.025
The last columns sit near a reader's floor. Check yours can read them.

This is a starting point from public numbers: the supplier's extinction coefficient, measured in methanol, and a path of about 0.3 cm for 100 uL. Read the dye once on your own reader and adjust.

Load the reservoir, run the transfer once with water, then run it with the dye. The transfers carry the principles from Layer 2. Set your top speed and your heights in the rulebook first: a real simple transfer does not start without them. Someone stays at the instrument.

on the Pi
python transfer.py simple --real
python transfer.py dilution --real

Rhodamine B is a hazardous chemical. Read its safety data sheet, and wear gloves and eye protection.

2

Plate read

Take the plate to the plate reader and read it. If PyLabRobot supports your plate reader, Claude Code can drive the reader too. If not, export the read and hand it over.

Say to Claude Code

Here is the export from my plate reader. Turn it into a CSV of 8 rows and 12 columns, rows A to H and columns 1 to 12, exactly as the plate looks from above.

3

See what is up

Now the numbers. Every well of the simple transfer got the same volume, so every well should read alike. Each column of the serial dilution should read half of the one before it.

code/read_check.py
"""Check a plate read against what the transfer should have made.

The read is a CSV of 8 rows and 12 columns of numbers: rows A to H,
columns 1 to 12, exactly as the plate looks from above.

    python read_check.py simple reads.csv
    python read_check.py dilution reads.csv

Options, all for the expert to set:
    --blank 0.045        what a well of water reads, taken off first
    --max-cv 5           fail if the CV is over this many percent
    --max-off 5          fail if a channel or a step is further off
    --readjust FILE      write per-channel volume corrections to FILE
"""
import argparse
import csv
import json
import statistics
import sys

ROWS = "ABCDEFGH"
DILUTION_COLUMNS = 6
BLANK_COLUMN = 12
MAX_READJUST = 20   # percent. Further off than this needs a person.


def load(path, blank):
    with open(path, newline="") as handle:
        rows = [row for row in csv.reader(handle) if row]
    grid = [[float(x) - blank for x in row] for row in rows]
    if len(grid) != 8 or any(len(row) != 12 for row in grid):
        sys.exit("Expected 8 rows of 12 numbers.")
    return grid


def percent_off(value, target):
    return 100 * (value - target) / target


def simple(grid, args):
    """Every well got the same volume, so every well should read alike."""
    wells = [x for row in grid for x in row]
    mean = statistics.mean(wells)
    cv = 100 * statistics.stdev(wells) / mean
    print(f"plate mean {mean:.3f}   CV {cv:.1f}%")

    channels = [statistics.mean(row) for row in grid]
    middle = statistics.median(channels)
    offs = [percent_off(channel, middle) for channel in channels]
    for letter, off in zip(ROWS, offs):
        print(f"  channel {letter}: {off:+5.1f}% from the median channel")
    worst = max(abs(off) for off in offs)

    if args.readjust:
        if worst > MAX_READJUST:
            sys.exit(f"A channel is {worst:.1f}% off. That needs a person"
                     " at the instrument, not a correction.")
        factors = {letter: round(middle / channel, 3)
                   for letter, channel in zip(ROWS, channels)}
        with open(args.readjust, "w") as handle:
            json.dump(factors, handle, indent=2)
        print(f"readjust: wrote {args.readjust}")

    failed = []
    if args.max_cv is not None and cv > args.max_cv:
        failed.append(f"CV {cv:.1f}% is over {args.max_cv:g}%")
    if args.max_off is not None and worst > args.max_off:
        failed.append(f"a channel is {worst:.1f}% off,"
                      f" over {args.max_off:g}%")
    return failed


def dilution(grid, args):
    """Each column should read half of the one before it."""
    blank = statistics.mean(row[BLANK_COLUMN - 1] for row in grid)
    means = [statistics.mean(row[c] for row in grid) - blank
             for c in range(DILUTION_COLUMNS)]

    worst = 0.0
    for c in range(1, DILUTION_COLUMNS):
        ratio = means[c] / means[c - 1]
        off = percent_off(ratio, 0.5)
        worst = max(worst, abs(off))
        print(f"  column {c} to {c + 1}: x{ratio:.3f}"
              f"   ({off:+5.1f}% from a clean half)")

    failed = []
    if args.max_off is not None and worst > args.max_off:
        failed.append(f"a step is {worst:.1f}% off,"
                      f" over {args.max_off:g}%")
    return failed


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("task", choices=["simple", "dilution"])
    parser.add_argument("reads", help="CSV, 8 rows of 12 numbers")
    parser.add_argument("--blank", type=float, default=0.0)
    parser.add_argument("--max-cv", type=float)
    parser.add_argument("--max-off", type=float)
    parser.add_argument("--readjust", metavar="FILE")
    args = parser.parse_args()

    check = {"simple": simple, "dilution": dilution}[args.task]
    failed = check(load(args.reads, args.blank), args)
    if failed:
        sys.exit("FAIL: " + "; ".join(failed))
    if args.max_cv is not None or args.max_off is not None:
        print("PASS")

The repository has example reads to try it on. They are synthetic numbers, not measurements, from a made-up instrument with one planted fault: channel F delivers 15 percent low.

on the Pi
python read_check.py simple example_reads/simple_low_channel.csv --blank 0.045
what it prints
plate mean 0.787   CV 5.2%
  channel A:  +0.2% from the median channel
  channel B:  +0.4% from the median channel
  channel C:  -0.0% from the median channel
  channel D:  +0.2% from the median channel
  channel E:  -0.1% from the median channel
  channel F: -15.1% from the median channel
  channel G:  -0.2% from the median channel
  channel H:  +0.0% from the median channel

7 channels agree. One does not. That is what is up.

4

Liquid transfer CV, and readjust

The number for the gate is the CV of the liquid transfer: how much the wells differ, as a percent of their mean. If it is over the pass mark, readjust and go again.

on the Pi
python read_check.py simple example_reads/simple_low_channel.csv \
  --blank 0.045 --max-cv 5 --readjust corrections.json
what it prints
plate mean 0.787   CV 5.2%
  channel A:  +0.2% from the median channel
  channel B:  +0.4% from the median channel
  channel C:  -0.0% from the median channel
  channel D:  +0.2% from the median channel
  channel E:  -0.1% from the median channel
  channel F: -15.1% from the median channel
  channel G:  -0.2% from the median channel
  channel H:  +0.0% from the median channel
readjust: wrote corrections.json
FAIL: CV 5.2% is over 5%

The read fails the gate, and the check writes a correction for each channel: ask the low channel for more, so that it delivers what the others do. Run the transfer again with the corrections. It now asks channel F for 117.7 uL. Then read it again.

on the Pi
python transfer.py simple --corrections corrections.json
python read_check.py simple example_reads/simple_readjusted.csv \
  --blank 0.045 --max-cv 5
what it prints
plate mean 0.799   CV 0.9%
  channel A:  -0.3% from the median channel
  channel B:  -0.3% from the median channel
  channel C:  +0.5% from the median channel
  channel D:  -0.5% from the median channel
  channel E:  +0.3% from the median channel
  channel F:  -0.0% from the median channel
  channel G:  +0.6% from the median channel
  channel H:  +0.0% from the median channel
PASS

Transfer, read, CV, readjust, until it passes. Then the gate opens.

The 5 is a placeholder. The pass mark is the expert's call. A channel more than 20 percent off is not corrected at all: that needs a person at the instrument. The 20 is a placeholder too.

Asking a channel for more volume is the simplest readjustment. The principles from Layer 2 are the others: the blowout, the heights and the speed. Change one, run the plate, read it again.

Layer 3 is done when

The Rhodamine QC looks good. Then it is good for biological validation.

Layer 4

Biological validation.

If the Rhodamine QC looks good, it is good for biological validation.

Being written. Stay tuned.

Beyond this guide

How this bakes into the rest.

This guide is one piece. The same walk runs through the other repositories.

Step 1plr-reverse-engineerCapture, decode and guarded replay for instruments with no automation API.
Steps 2 and 3plr-mcpLab instruments as MCP tools an agent can call. Simulation by default, with hardware permission enforced in code.
The QC gateautonomous-labExpert QC gates, provenance and permission, across a whole workcell.
The judgmentdrugdev-gymThe same move, one level up. Bench knowledge written down as plain-word rules, and simulated environments where a model can train on them. Simulation only.
The armsrobot-lab-handlingRobot arms on everyday lab handling, in simulation.