Cookbook · background run

Monitor an incubator overnight

Log temperature and CO₂ every minute for twelve hours, alert if either leaves its band, and hand over a CSV in the morning. The agent starts it and leaves; the run continues on its own.

Instruments

RoleSimulated twinReal
Anything with readable signalsthermocycler-01 (bundled), reading block_temperaturean incubator via PyLabRobot (Cytomat) or OPC UA, a chamber via a PLC, a hotplate via serial, a freezer via a serial thermometer

What you say

"Watch the incubator overnight. Log temperature and CO₂ every minute and tell me if temperature leaves 36.5 to 37.5 or CO₂ leaves 4.8 to 5.2."

What the agent does

  1. Finds the recipe periodic-readings and the incubator by mhp_find.
  2. Starts it in the background:
    mhp_run recipe="periodic-readings" background=true
            params={"device": "incubator-02", "signals": ["temperature", "co2"], "every_s": 60, "hours": 12,
                    "alert": {"temperature": [36.5, 37.5], "co2": [4.8, 5.2]}}
  3. Tells you the run id and stops. Nothing else is in the agent's context all night.

In the morning

"What happened with the incubator?"

The agent calls mhp_data op="runs", sees the run finished, reads stdout.txt:

ALERT t=14220s co2=4.7 outside 4.8..5.2
720 rows in readings.csv; 1 alert(s)

Then mhp_data op="read" path="readings.csv" for the numbers around the alert, and reports: "CO₂ dipped to 4.7% for about two minutes at 03:57 and recovered; temperature stayed within 36.9 to 37.2 all night. The full log is readings.csv in run 20260910-2201-9f3c."

While it runs

Anything notable also lands in the lab's run log, and if your harness accepts MCP logging messages the events arrive as they happen. mhp_lab op="events" since=0 returns them on demand. You can stop the run early with mhp_job op="cancel" on its job, or pause it to open the door.

Variations