← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / scientific-agent-skills / skills / opentrons-integration / references / validation_and_operations.md

Validation and Operations

Use layered validation. A protocol is not ready for live samples merely because it compiles or simulates.

Reproducible Local Environment

The skill pins separate compatibility environments:

One-shot simulation:

# Flex
uv run --with "opentrons==9.1.1" opentrons_simulate protocol.py

# OT-2
uv run --with "opentrons==9.0.0" opentrons_simulate protocol.py

Dedicated Flex environment:

uv venv --python 3.10
uv pip install --python .venv/bin/python -r skills/opentrons-integration/requirements-flex.txt
.venv/bin/opentrons_simulate protocol.py

Use requirements-ot2.txt instead for the OT-2 compatibility environment. opentrons==9.1.1 intentionally rejects OT-2 protocols after the release-line split; the current OT-2 App remains the authoritative OT-2 analyzer.

Check the package and maximum API implemented by the local library:

uv run --with "opentrons==9.1.1" python -c \
  "import opentrons; from opentrons import protocol_api; print(opentrons.__version__, protocol_api.MAX_SUPPORTED_VERSION)"

The local package does not update robot software. A protocol can simulate locally and still request an API level unavailable on the target robot.

Validation Ladder

1. Syntax and import

python -m py_compile protocol.py

This catches Python syntax errors only. It does not instantiate Protocol API objects or validate deck geometry.

2. Local simulation

# Flex
uv run --with "opentrons==9.1.1" opentrons_simulate protocol.py

# OT-2
uv run --with "opentrons==9.0.0" opentrons_simulate protocol.py

Review:

Useful simulator options:

# More diagnostic logs
opentrons_simulate -l info protocol.py

# Custom labware directory; repeat -L as needed
opentrons_simulate -L custom_labware protocol.py

# Add only named data files; repeat -d as needed
opentrons_simulate -d plate_map.csv protocol.py

# Experimental estimate
opentrons_simulate -e protocol.py

Prefer -d over -D for data because -D loads every file in a directory into memory. Never point -D at a directory containing credentials, unrelated data, or large files.

The current directory is searched for custom labware implicitly, but explicit -L paths make validation more reproducible.

3. Resource audit

Independently calculate:

Simulation does not prove that the liquid budget is sufficient.

4. Opentrons App analysis

Use the App appropriate for the target robot. At API 2.29 and newer, Flex and OT-2 use separate software and App release lines.

  1. Connect to the intended robot.
  2. Import the Python protocol and required custom labware or data.
  3. Require successful protocol analysis.
  4. Review analysis warnings and errors; do not bypass them.
  5. Check the starting deck and module setup.
  6. Set runtime parameters and inspect the resulting protocol.
  7. Review protocol visualization and run preview.
  8. Verify labware offsets or Labware Position Check results.
  9. Confirm installed pipettes, mounts, modules, and firmware.

App analysis is closer to the target robot than local simulation, but it still does not verify actual liquids, tips, caps, seals, or calibration.

5. Operator review

Use a second-person check for:

6. Dry run

For a new or materially changed method:

A tip-only dry run is appropriate for new partial-nozzle layouts.

7. Controlled release

Keep:

What Simulation Does Not Validate

Runtime Parameter Testing

The default value should always produce a meaningful local simulation.

For each parameter:

The command-line simulator primarily analyzes defaults. Use App analysis or dedicated test variants to exercise alternate runtime values.

Custom Labware

Before live use:

  1. Validate the JSON schema with current Opentrons tooling.
  2. Confirm dimensions against manufacturer drawings and physical measurement.
  3. Check well depth, diameter or dimensions, and total capacity.
  4. Check corner offset and well ordering.
  5. Add stacking offsets for custom labware used on adapters.
  6. Import the exact definition into the App.
  7. Perform Labware Position Check.
  8. Dry-run the highest-risk wells and edge positions.

Do not silently replace a missing custom definition with standard labware.

Failure Triage

Unsupported API version

Symptoms:

Actions:

  1. Check the maximum in robot settings.
  2. Update robot software and the appropriate App if approved.
  3. Otherwise lower the API level and remove or replace unsupported features.

Do not edit the version string alone; audit every method and behavior gate.

Invalid pipette or labware load name

Actions:

Deck conflict

Check:

Out of tips

Count:

Add racks or redesign the validated tip policy. Do not reset tracking unless the operator has physically replaced or correctly refilled racks.

Insufficient source volume

Include distribution disposal volume, dead volume, pre-wet, mixing, carryover, and reserve. Liquid setup visualization does not prevent a physical source from running dry.

Module not ready

Check:

Plate-reader calculation fails only in simulation

The reader returns zeros during simulation. Skip or substitute analysis-only calculations under protocol.is_simulating() when a zero denominator is possible. Keep the physical-run path unchanged.

Physical pickup or positioning issue

Stop the run if collision or pickup failure is possible. Check calibration, labware definition, offsets, tip compatibility, adapter use, nozzle layout, and deck placement. Do not compensate with arbitrary offsets until the underlying geometry is understood.

Release Checklist