Skip to main content
The Lager Python SDK provides a powerful, object-oriented interface for controlling hardware and automating tests on your Device Under Test (DUT). It enables programmatic control of power supplies, sensors, debug probes, and more.

Import

Core Classes

Net Types

The SDK supports various net types for different hardware:

Quick Start

List Available Nets

Control a Power Supply

Read an ADC

Control GPIO

Control Debug Probe

Control USB Hub

Complete Example

API Reference

Prefer to write your tests in Rust? The same nets are reachable from the Rust SDK, which runs against the box from cargo test rather than on the box. Every net type documented below has a Rust counterpart except scope and logic, which are not on the box’s HTTP API yet.

Core Classes

Power & Simulation

Measurement

I/O & Communication

Utilities

Run Records

Two functions connect a script to its run record. Both are top-level exports.
A key is 1-128 letters, digits and . _ : / -, and starts with a letter or digit. A value is a string of up to 4096 characters, a number, a boolean or None. A run records at most 256 keys, and the last value for a key wins. A value that the record cannot hold raises ValueError. lager python --download brings back the files in output_dir() and the run record. See lager python.

Legacy Net Types

NetType.Rotation and NetType.Actuate have no lager nets add role. They work only for a net that a saved record or LAGER_MUXES defines by hand.

Error Handling

Notes

  • Always call disable() when finished with power-related nets
  • Simple nets (GPIO, ADC, DAC) don’t require enable()/disable() calls
  • Complex nets (PowerSupply, Battery, Analog) require enable() before use
  • Net names must match those configured in the Lager system
  • Use try/except blocks for robust error handling

Demo Script

The demo script is a more comprehensive example. It combines robot arm control, USB hub power cycling, debug probe flashing, power supply management, and ADC measurement in a single automated workflow.