Agentic LC-MS, HPLC and NMR: one round in simulation
A planning agent asks for measurements through 5 MCP tools. The gateway turns each request into the vendor's own unit of work, an Agilent Sample Scheduler XML command, a SCIEX OS batch or a Bruker SpinPilot experiment, and the vendor software keeps control of the instrument.
Every instrument and every number here is simulated. No instrument or vendor software was connected. The vendor call names and XML in the gateway's adapters (src/lab_gateway/adapters) are placeholders.
The round
Purity first, then plasma stability for the hits that pass, then NMR on the most stable one. 4 things go wrong on purpose: a swapped vial, 2 lost replies from SCIEX OS, and a drifted shim. The open bar is the time the LC-MS was held while nobody knew whether the batch had started.
What the planner, the gateway and the operator said
| min | who | what |
|---|---|---|
| planner | connected; tools: list_instruments, request_measurement, get_measurement, cancel_measurement, read_ledger | |
| 0 | planner | HPLC-01: Agilent OpenLab CDS via Sample Scheduler for OpenLab, LIMS XML commands; ready=True |
| 0 | planner | LCMS-01: SCIEX OS via SCIEX OS Control API (batches), Data API (.wiff2); ready=True |
| 0 | planner | NMR-01: Bruker SpinPilot / TopSpin 5 via SpinPilot Python API (experiments), TopSpin dataset; ready=True |
| 0 | planner | purity requested for 4 top hits: submitted (accepted: XML command r1-hplc-purity.xml written to the LIMS commands folder) |
| 182 | gateway | purity run done, usable=True: QC passed: usable |
| 182 | planner | TOPHIT-03 not measured: barcode mismatch at P1-A3: expected BC-1003, read BC-1009; not injected. Asking the operator to check the vial. |
| 182 | planner | TOPHIT-04 purity 86.92 % is below 90 %: repurify before stability |
| 182 | planner | purity >= 90 %: TOPHIT-01, TOPHIT-02 |
| gateway | refused: LCMS-PLASMA-STAB@3 is draft, not approved; nothing was sent | |
| 182 | gateway | stability batch (72 wells): submitted. found B0001 in the vendor queue: monitoring resumed, nothing resubmitted |
| 410 | gateway | stability run done, usable=True: QC passed: usable |
| 410 | planner | half-life in plasma (min): TOPHIT-01 296.6, TOPHIT-02 95.6 |
| 420 | gateway | NMR TOPHIT-01 done, usable=False: DSS linewidth at half height 1.656 (limit <= 1.0 Hz) |
| 420 | planner | the spectrum finished but is not usable; asking again with a full reshim |
| 433 | gateway | NMR TOPHIT-01 usable=True: DSS 0.759 Hz, S/N 134.9; designed residue singlets at [1.44, 1.51] ppm, confirmed=True |
| operator | found another peptide's tube in P1-A3; put TOPHIT-03 (BC-1003) in P1-A5 | |
| 578 | gateway | TOPHIT-03 purity 95.37 %, usable=True |
| 578 | gateway | stability batch for TOPHIT-03: unknown. reply lost: connection to SCIEX OS dropped before the batch was acknowledged. Instrument held; searching the vendor queue |
| 588 | gateway | needs_operator: not in the vendor queue or history after the grace period; an operator must reconcile before another injection |
| 588 | planner | tried another LC-MS batch meanwhile: refused: LCMS-01 is held by r1-lcms-stability-03 (needs_operator); try again when it finishes |
| operator | checked SCIEX OS: SCIEX OS queue and acquisition history show no batch r1-lcms-stability-03; no injection happened. Decision: resubmit | |
| 741 | gateway | TOPHIT-03 stability done, usable=True: half-life 139.8 min |
| planner | next round: build on TOPHIT-01 (most stable, designed residue confirmed by NMR); queue NMR for TOPHIT-03 | |
| planner | ledger: 29 entries, chain intact=True |
Decision for the next round
build on TOPHIT-01 (most stable, designed residue confirmed by NMR); queue NMR for TOPHIT-03. Only results with usable=true are in this ranking.
| peptide | plasma half-life | purity | NMR structure check |
|---|---|---|---|
| TOPHIT-01 | 297 min | 97.60 % | confirmed |
| TOPHIT-03 | 140 min | 95.37 % | not run yet |
| TOPHIT-02 | 96 min | 96.09 % | not run yet |
Held back: TOPHIT-04, purity 86.9 % (repurify first). Not used: the first NMR spectrum, which finished but failed the linewidth check.
HPLC purity (Agilent OpenLab CDS through Sample Scheduler)
The adapter writes one XML command per request into the LIMS commands folder, with a barcode check on every sample vial. The vial in P1-A3 held another peptide's tube, so it was not injected and was reported, not hidden.
| sample | vial | purity | status | request |
|---|---|---|---|---|
| TOPHIT-01 | P1-A1 | 97.60 % | measured | r1-hplc-purity |
| TOPHIT-02 | P1-A2 | 96.09 % | measured | r1-hplc-purity |
| TOPHIT-03 | P1-A3 | barcode mismatch at P1-A3: expected BC-1003, read BC-1009; not injected | r1-hplc-purity | |
| TOPHIT-04 | P1-A4 | 86.92 % | measured | r1-hplc-purity |
| TOPHIT-03 | P1-A5 | 95.37 % | measured | r1-hplc-purity-03 |
System suitability, r1-hplc-purity
| check | value | limit | |
|---|---|---|---|
| SST injections integrated | 5 | == 5 | pass |
| SST retention time RSD | 0.034 | <= 1.0 % | pass |
| SST peak area RSD | 0.464 | <= 2.0 % | pass |
| SST USP tailing (worst) | 1.161 | <= 2.0 | pass |
| SST plate count (lowest) | 75260.544 | >= 5000 | pass |
| Bracketing standard RT drift | 0.018 | <= 2.0 % | pass |
| Largest blank peak, % of standard | 0.0 | <= 0.1 % | pass |
LC-MS plasma stability (SCIEX OS batch)
8 time points from 0 to 240 min, 3 replicates, internal standard in the quench, and a control that plasma breaks down fast: if the control survives, the plasma was not active and the run is not usable.
| peptide | kind | half-life | fit r2 | at 240 min | request |
|---|---|---|---|---|---|
| STAB-CTRL | control | 12 min | 1.000 | BLQ | r1-lcms-stability |
| TOPHIT-01 | sample | 297 min | 0.996 | 57.6 % | r1-lcms-stability |
| TOPHIT-02 | sample | 96 min | 0.999 | 18.1 % | r1-lcms-stability |
| TOPHIT-03 | sample | 140 min | 0.999 | 30.9 % | r1-lcms-stability-03 |
Acceptance checks, r1-lcms-stability
| check | value | limit | |
|---|---|---|---|
| Internal standard CV | 5.369 | <= 15.0 % | pass |
| Injections with IS outside 50-150 % of median | 0 | == 0 | pass |
| Carryover in blank after T0, % of LLOQ response | 16.642 | <= 20.0 % | pass |
| Plasma activity: control half-life | 11.9 | <= 60.0 min | pass |
NMR structure follow-up (Bruker SpinPilot on TopSpin 5)
The first spectrum finished but its reference line was too broad, so the gateway returned it as not usable. The planner asked again with a full reshim. LC-MS says the mass is right; NMR shows the designed residue's 2 methyl singlets.
| try | check | value | limit | |
|---|---|---|---|---|
| first | Lock | locked | == locked | pass |
| first | DSS linewidth at half height | 1.656 | <= 1.0 Hz | fail |
| first | Signal-to-noise, 6.5-9.0 ppm | 85.225 | >= 50.0 | pass |
| reshim | Lock | locked | == locked | pass |
| reshim | DSS linewidth at half height | 0.759 | <= 1.0 Hz | pass |
| reshim | Signal-to-noise, 6.5-9.0 ppm | 134.939 | >= 50.0 | pass |
When a reply is lost
Found. The first stability batch reached SCIEX OS and the reply did not come back. The gateway held the LC-MS, searched the SCIEX OS queue and history for the request id, found batch B0001, and kept monitoring. Nothing was submitted twice.
Not found. The TOPHIT-03 batch never reached SCIEX OS. After a 10 minute grace period the gateway stopped and asked for a person. A new LC-MS request was refused while the instrument was held. The operator checked SCIEX OS, recorded the decision under their name, and the gateway resubmitted.
Ledger
Every call that changed an instrument, written before the call is made, each entry chained to the one before.
29 entries
| # | min | actor | action | request | detail |
|---|---|---|---|---|---|
| 1 | 0 | gateway | reserve | r1-hplc-purity | {"method_version": "HPLC-PEPTIDE-PURITY@2", "samples": 4} |
| 2 | 0 | gateway | submit.sent | r1-hplc-purity | {"attempt": 1, "interface": "Sample Scheduler for OpenLab, LIMS XML commands", "method_version": "HPLC-PEPTIDE-PURITY@2", "samples": 4} |
| 3 | 0 | gateway | submit.accepted | r1-hplc-purity | {"note": "XML command r1-hplc-purity.xml written to the LIMS commands folder", "vendor_ref": "r1-hplc-purity"} |
| 4 | 182 | gateway | release | r1-hplc-purity | {"note": "QC passed: usable", "state": "done"} |
| 5 | 182 | gateway | reserve | r1-lcms-stability | {"method_version": "LCMS-PLASMA-STAB@2", "samples": 72} |
| 6 | 182 | gateway | submit.sent | r1-lcms-stability | {"attempt": 1, "interface": "SCIEX OS Control API (batches), Data API (.wiff2)", "method_version": "LCMS-PLASMA-STAB@2", "samples": 72} |
| 7 | 182 | gateway | submit.reply_lost | r1-lcms-stability | {"error": "connection dropped right after Submit; SCIEX OS may already be acquiring"} |
| 8 | 182 | gateway | reconcile.found | r1-lcms-stability | {"searched": "vendor queue and acquisition history", "vendor_ref": "B0001"} |
| 9 | 410 | gateway | release | r1-lcms-stability | {"note": "QC passed: usable", "state": "done"} |
| 10 | 410 | gateway | reserve | r1-nmr-tophit-01 | {"method_version": "NMR-1H-PEPTIDE@1", "samples": 1} |
| 11 | 410 | gateway | submit.sent | r1-nmr-tophit-01 | {"attempt": 1, "interface": "SpinPilot Python API (experiments), TopSpin dataset", "method_version": "NMR-1H-PEPTIDE@1", "samples": 1} |
| 12 | 410 | gateway | submit.accepted | r1-nmr-tophit-01 | {"note": "experiment E0001 'r1-nmr-tophit-01' for holder 12", "vendor_ref": "E0001"} |
| 13 | 420 | gateway | release | r1-nmr-tophit-01 | {"note": "completed, but 1 QC check(s) failed: not usable", "state": "done"} |
| 14 | 420 | gateway | reserve | r1-nmr-tophit-01-reshim | {"method_version": "NMR-1H-PEPTIDE@1", "samples": 1} |
| 15 | 420 | gateway | submit.sent | r1-nmr-tophit-01-reshim | {"attempt": 1, "interface": "SpinPilot Python API (experiments), TopSpin dataset", "method_version": "NMR-1H-PEPTIDE@1", "samples": 1} |
| 16 | 420 | gateway | submit.accepted | r1-nmr-tophit-01-reshim | {"note": "experiment E0002 'r1-nmr-tophit-01-reshim' for holder 12", "vendor_ref": "E0002"} |
| 17 | 433 | gateway | release | r1-nmr-tophit-01-reshim | {"note": "QC passed: usable", "state": "done"} |
| 18 | 433 | gateway | reserve | r1-hplc-purity-03 | {"method_version": "HPLC-PEPTIDE-PURITY@2", "samples": 1} |
| 19 | 433 | gateway | submit.sent | r1-hplc-purity-03 | {"attempt": 1, "interface": "Sample Scheduler for OpenLab, LIMS XML commands", "method_version": "HPLC-PEPTIDE-PURITY@2", "samples": 1} |
| 20 | 433 | gateway | submit.accepted | r1-hplc-purity-03 | {"note": "XML command r1-hplc-purity-03.xml written to the LIMS commands folder", "vendor_ref": "r1-hplc-purity-03"} |
| 21 | 578 | gateway | release | r1-hplc-purity-03 | {"note": "QC passed: usable", "state": "done"} |
| 22 | 578 | gateway | reserve | r1-lcms-stability-03 | {"method_version": "LCMS-PLASMA-STAB@2", "samples": 48} |
| 23 | 578 | gateway | submit.sent | r1-lcms-stability-03 | {"attempt": 1, "interface": "SCIEX OS Control API (batches), Data API (.wiff2)", "method_version": "LCMS-PLASMA-STAB@2", "samples": 48} |
| 24 | 578 | gateway | submit.reply_lost | r1-lcms-stability-03 | {"error": "connection to SCIEX OS dropped before the batch was acknowledged"} |
| 25 | 588 | gateway | reconcile.unresolved | r1-lcms-stability-03 | {"grace_s": 600.0, "searched": "vendor queue and acquisition history"} |
| 26 | 588 | operator:on duty (simulated) | operator.resubmit | r1-lcms-stability-03 | {"note": "SCIEX OS queue and acquisition history show no batch r1-lcms-stability-03; no injection happened", "vendor_ref": null} |
| 27 | 588 | gateway | submit.sent | r1-lcms-stability-03 | {"attempt": 2, "interface": "SCIEX OS Control API (batches), Data API (.wiff2)", "method_version": "LCMS-PLASMA-STAB@2", "samples": 48} |
| 28 | 588 | gateway | submit.accepted | r1-lcms-stability-03 | {"note": "batch r1-lcms-stability-03~2 with 51 injections", "vendor_ref": "B0002"} |
| 29 | 741 | gateway | release | r1-lcms-stability-03 | {"note": "QC passed: usable", "state": "done"} |
34 MCP tool calls
| min | tool | arguments | result |
|---|---|---|---|
| 0 | list_instruments | {} | {"sim_time_min": 0.0} |
| 0 | request_measurement | {"instrument": "HPLC-01", "method_version": "HPLC-PEPTIDE-PURITY@2", "request_id": "r1-hplc-purity", "options": null, "dry_run": false, "... | {"state": "submitted", "note": "accepted: XML command r1-hplc-purity.xml written to the LIMS commands folder", "vendor_ref": "r1-hplc-pur... |
| 1 | get_measurement | {"request_id": "r1-hplc-purity", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "r1-hplc-purity", "progress": "0/11 injections", "sim_time_min": 1.0} |
| 61 | get_measurement | {"request_id": "r1-hplc-purity", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "r1-hplc-purity", "progress": "3/11 injections", "sim_time_min": 61.0} |
| 121 | get_measurement | {"request_id": "r1-hplc-purity", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "r1-hplc-purity", "progress": "6/11 injections", "sim_time_min": 121.0} |
| 181 | get_measurement | {"request_id": "r1-hplc-purity", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "r1-hplc-purity", "progress": "10/11 injections", "sim_time_min": 181.0} |
| 182 | get_measurement | {"request_id": "r1-hplc-purity", "wait_s": 3600.0} | {"state": "done", "usable": true, "note": "QC passed: usable", "vendor_ref": "r1-hplc-purity", "progress": "11/11 injections", "findings"... |
| 182 | request_measurement | {"instrument": "LCMS-01", "method_version": "LCMS-PLASMA-STAB@3", "request_id": "r1-lcms-stability", "options": null, "dry_run": false, "... | {"state": "refused", "reasons": ["LCMS-PLASMA-STAB@3 is draft, not approved; nothing was sent"], "sim_time_min": 182.0} |
| 182 | request_measurement | {"instrument": "LCMS-01", "method_version": "LCMS-PLASMA-STAB@2", "request_id": "r1-lcms-stability", "options": null, "dry_run": false, "... | {"state": "submitted", "note": "found B0001 in the vendor queue: monitoring resumed, nothing resubmitted", "vendor_ref": "B0001", "sim_ti... |
| 182 | get_measurement | {"request_id": "r1-lcms-stability", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "B0001", "progress": "0/76 injections", "sim_time_min": 182.0} |
| 242 | get_measurement | {"request_id": "r1-lcms-stability", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "B0001", "progress": "20/76 injections", "sim_time_min": 242.0} |
| 302 | get_measurement | {"request_id": "r1-lcms-stability", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "B0001", "progress": "40/76 injections", "sim_time_min": 302.0} |
| 362 | get_measurement | {"request_id": "r1-lcms-stability", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "B0001", "progress": "60/76 injections", "sim_time_min": 362.0} |
| 410 | get_measurement | {"request_id": "r1-lcms-stability", "wait_s": 3600.0} | {"state": "done", "usable": true, "note": "QC passed: usable", "vendor_ref": "B0001", "progress": "76/76 injections", "findings": {"t_hal... |
| 410 | request_measurement | {"instrument": "NMR-01", "method_version": "NMR-1H-PEPTIDE@1", "request_id": "r1-nmr-tophit-01", "options": null, "dry_run": false, "samp... | {"state": "submitted", "note": "accepted: experiment E0001 'r1-nmr-tophit-01' for holder 12", "vendor_ref": "E0001", "sim_time_min": 410.0} |
| 410 | get_measurement | {"request_id": "r1-nmr-tophit-01", "wait_s": 3600.0} | {"state": "running", "note": "sample in", "vendor_ref": "E0001", "progress": "0/1 injections", "sim_time_min": 410.0} |
| 420 | get_measurement | {"request_id": "r1-nmr-tophit-01", "wait_s": 3600.0} | {"state": "done", "usable": false, "note": "completed, but 1 QC check(s) failed: not usable", "vendor_ref": "E0001", "progress": "1/1 inj... |
| 420 | request_measurement | {"instrument": "NMR-01", "method_version": "NMR-1H-PEPTIDE@1", "request_id": "r1-nmr-tophit-01-reshim", "options": {"reshim": true}, "dry... | {"state": "submitted", "note": "accepted: experiment E0002 'r1-nmr-tophit-01-reshim' for holder 12", "vendor_ref": "E0002", "sim_time_min... |
| 420 | get_measurement | {"request_id": "r1-nmr-tophit-01-reshim", "wait_s": 3600.0} | {"state": "running", "note": "sample in", "vendor_ref": "E0002", "progress": "0/1 injections", "sim_time_min": 420.0} |
| 433 | get_measurement | {"request_id": "r1-nmr-tophit-01-reshim", "wait_s": 3600.0} | {"state": "done", "usable": true, "note": "QC passed: usable", "vendor_ref": "E0002", "progress": "1/1 injections", "findings": {"structu... |
| 433 | request_measurement | {"instrument": "HPLC-01", "method_version": "HPLC-PEPTIDE-PURITY@2", "request_id": "r1-hplc-purity-03", "options": null, "dry_run": false... | {"state": "submitted", "note": "accepted: XML command r1-hplc-purity-03.xml written to the LIMS commands folder", "vendor_ref": "r1-hplc-... |
| 434 | get_measurement | {"request_id": "r1-hplc-purity-03", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "r1-hplc-purity-03", "progress": "0/8 injections", "sim_time_min": 434.0} |
| 494 | get_measurement | {"request_id": "r1-hplc-purity-03", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "r1-hplc-purity-03", "progress": "3/8 injections", "sim_time_min": 494.0} |
| 554 | get_measurement | {"request_id": "r1-hplc-purity-03", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "r1-hplc-purity-03", "progress": "6/8 injections", "sim_time_min": 554.0} |
| 578 | get_measurement | {"request_id": "r1-hplc-purity-03", "wait_s": 3600.0} | {"state": "done", "usable": true, "note": "QC passed: usable", "vendor_ref": "r1-hplc-purity-03", "progress": "8/8 injections", "findings... |
| 578 | request_measurement | {"instrument": "LCMS-01", "method_version": "LCMS-PLASMA-STAB@2", "request_id": "r1-lcms-stability-03", "options": null, "dry_run": false... | {"state": "unknown", "note": "reply lost: connection to SCIEX OS dropped before the batch was acknowledged. Instrument held; searching th... |
| 588 | get_measurement | {"request_id": "r1-lcms-stability-03", "wait_s": 3600.0} | {"state": "needs_operator", "note": "not in the vendor queue or history after the grace period; an operator must reconcile before another... |
| 588 | request_measurement | {"instrument": "LCMS-01", "method_version": "LCMS-PLASMA-STAB@2", "request_id": "r1-lcms-other", "options": null, "dry_run": false, "samp... | {"state": "refused", "reasons": ["LCMS-01 is held by r1-lcms-stability-03 (needs_operator); try again when it finishes"], "sim_time_min":... |
| 588 | get_measurement | {"request_id": "r1-lcms-stability-03", "wait_s": 3600.0} | {"state": "submitted", "note": "accepted: batch r1-lcms-stability-03~2 with 51 injections", "vendor_ref": "B0002", "sim_time_min": 588.0} |
| 588 | get_measurement | {"request_id": "r1-lcms-stability-03", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "B0002", "progress": "0/51 injections", "sim_time_min": 588.0} |
| 648 | get_measurement | {"request_id": "r1-lcms-stability-03", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "B0002", "progress": "20/51 injections", "sim_time_min": 648.0} |
| 708 | get_measurement | {"request_id": "r1-lcms-stability-03", "wait_s": 3600.0} | {"state": "running", "note": "acquiring", "vendor_ref": "B0002", "progress": "40/51 injections", "sim_time_min": 708.0} |
| 741 | get_measurement | {"request_id": "r1-lcms-stability-03", "wait_s": 3600.0} | {"state": "done", "usable": true, "note": "QC passed: usable", "vendor_ref": "B0002", "progress": "51/51 injections", "findings": {"t_hal... |
| 741 | read_ledger | {"request_id": null, "limit": 200} | {} |
Built from lab-demo --out runs/demo by python -m lab_gateway.report.
Simulated data; method names, timings and peptides are illustrative.