Cookbook · example 1
Run a PCR with a plate transfer
A plate arm moves a 96-well plate onto a thermocycler, the thermocycler runs a cycling program and holds at 4 °C, and the arm puts the plate back. You say one sentence. Every step below is what actually happens, in order.
You need: the setup from the cookbook front page (install plus the two simulated instruments). About ten minutes.
Ask for the experiment
In your agent, type:
Run a 3-cycle PCR at 95/58/72 on the plate in deck slot A1, hold it at 4 °C afterwards, and put the plate back in A2.
Three cycles keeps the simulated run short. On a real instrument you would say 30.
The agent looks for a recipe
Behind the scenes it calls
mhp_lab op="recipes"with your sentence and gets backpcr-with-plate-transfer, which needs a robot arm and a thermocycler. You may see it say something like "There is a tested recipe for this. I'll use it."The agent finds the instruments and reads their notes
It calls
mhp_findfor an idle thermocycler and an idle arm, thenmhp_describeon each. The thermocycler's notes say the lid must be closed and the lid heater should be on before loading. The arm's notes say to use 30% speed near open plates. The agent will follow both without being told.The agent rehearses and shows you the plan
It runs the recipe in plan mode. Nothing moves. You see a plan like this:
Plan for pcr-with-plate-transfer (cycles=3, plate_slot=deck_A1, return_slot=deck_A2) 1 arm-01 set speed = 30 ok 2 arm-01 read homed → false 3 arm-01 home ok 4 thermocycler-01 read lid_closed → true 5 arm-01 pick_plate from deck_A1 ok 6 arm-01 place_plate at thermocycler ok 7 thermocycler-01 set lid_heater = true ok 8 thermocycler-01 run_protocol (3 steps × 3 cycles) ok long-running 9 thermocycler-01 set target_temperature = 4 ok 10 arm-01 pick_plate from thermocycler ok 11 arm-01 place_plate at deck_A2 ok Verdict: ok; no human confirmation needed. Shall I run it?Every step passed the instrument's safety checks. If you had asked for a 110 °C step, step 8 would show REFUSED: step temp 110 outside block limits and the agent would stop here and ask you what to do.
Say go
Yes, run it.
The agent runs the same recipe for real. With three cycles on the simulator this takes about ten seconds. On a real thermocycler with 30 cycles it would start the run in the background and tell you the run id.
Read the result
The agent reports what the instruments actually did, from the recipe's output:
pcr done on thermocycler-01: {'cycles_completed': 3, 'final_block_temperature': 72}; plate at deck_A2; block 4.0 CNotice it reports the block temperature it read (4.0 °C), not the one it set. Ask "where is the plate now?" and it reads the arm's
holding_plateand position to answer.Try a step that needs a human
Now open the thermocycler lid.
The thermocycler's owner marked
open_lidas "a person must confirm", because the lid may be hot. In Claude Code you get a confirmation prompt from the server itself; in a harness without that feature, the agent asks you in the chat and only proceeds after you say yes. Either way the answer is written to the run log.See the record
Show me what happened in that run.
The agent reads the run log and the run's output file (
mhp_data) and lists every write, action and reading with timestamps. This is the record you would paste into a notebook.
Doing it on real instruments
- Onboard your thermocycler (say "onboard my thermocycler"; serial or hand-operated needs no code) or add a community package. Keep the action name
run_protocolwithstepsandcycles, and the recipe works unchanged. - Add your plate mover the same way. If you do not have one, onboard a "manual" arm: the agent will ask the operator to move the plate at steps 5, 6, 10 and 11 and wait.
- Use "30 cycles" and let the agent run it in the background. Ask for the result when it is done, or ask it to notify you.
The recipe file
You do not need to read it, but it is openmhp/recipes/pcr_with_plate_transfer.py in the repository. The parameters the agent fills from your sentence:
PARAMS = {"arm": None, "thermocycler": None, # None = pick an idle one by search
"plate_slot": "deck_A1", "return_slot": "deck_A2",
"steps": [{"temp": 95, "hold_s": 30}, {"temp": 58, "hold_s": 30}, {"temp": 72, "hold_s": 45}],
"cycles": 30, "hold_c": 4}