A universal interface for lab automation
Let the rat run the maze.
Control oscilloscopes, signal generators, VNAs, spectrum analysers, power supplies, cameras and more through one API.
Quick start · Install · API · MCP · Drivers · Contributing
Quick start
pipx install git+https://github.com/reinhardjvv/labrat.git
labrat demo # start a demo lab with simulated instruments
In a second terminal, with the token the demo prints:
export LABRAT_URL=http://127.0.0.1:8780 LABRAT_TOKEN=<token>
labrat describe psu
labrat shell # an interactive prompt with tab completion
Connect Claude, or any MCP client, to the same lab:
claude mcp add labrat -e LABRAT_URL=$LABRAT_URL -e LABRAT_TOKEN=$LABRAT_TOKEN -- labrat mcp
Every client sends the same message, so curl works too:
curl -s $LABRAT_URL/api/v1/message -H "Authorization: Bearer $LABRAT_TOKEN" \
-d '{"op": "set", "device": "psu", "name": "VoltageLevel", "channel": "1", "value": 5}'
Ask your agent
With LABRAT connected over MCP, Claude or another agent works the bench the way a person would:
Start an experiment called filter-check. Sweep the generator from 1 to 20 MHz in 1 MHz steps, take a scope
trace at each step, and tell me where the response is 3 dB down.
The agent finds the instruments, locks them, opens an experiment in your folder, runs the sweep and reads its own data back. The lab's limits, locks and approvals apply to every request, and every command is logged under the agent's token. Give it as much freedom as you want (MCP).
The nest and the rats
A lab has one nest and any number of rats. The nest is the server everyone talks to. It holds the tokens, the limits, the locks and the audit log. The rats sit at the benches next to the equipment, and each one serves whatever is plugged into it. A rat can be any Linux computer, from a single-board computer to the PC already beside an instrument, or a microcontroller that speaks the rat protocol. A small lab can run the nest alone, with its devices plugged straight in.
flowchart TB
clients["<b>clients</b><br/>Python · MATLAB · curl"] -- HTTP --> nest
agents["<b>AI agents</b><br/>Claude and others"] -- MCP --> nest
nest["<b>nest</b><br/>central server"]
nest --> rat1["<b>rat</b> · bench PC<br/>scopes · supplies"]
nest --> rat2["<b>rat</b> · Raspberry Pi<br/>cameras · SLMs"]
nest --> rat3["<b>rat</b> · ESP32<br/>relays · sensors"]
nest --> store[("<b>storage</b><br/>NAS or disk")]
What it works with
| Equipment | Connected by |
|---|---|
| Oscilloscopes, signal and function generators, VNAs, spectrum analysers, power supplies, multimeters, source meters and other bench instruments | Ethernet, USB or RS-232, through their standard SCPI commands |
| Cameras: USB webcams, PoE and network cameras, machine-vision cameras such as Allied Vision, Basler and FLIR | USB, RTSP, MJPEG, GigE Vision or USB3 Vision |
| Spatial light modulators, DMDs and projectors | HDMI |
| Relays, shutters, interlocks, switches and sensors | GPIO pins on a rat |
| Sensors, ADCs, DACs and port expanders | I2C on a rat |
| Pumps, stages, controllers and Arduino boards with their own commands | serial, or a serial server on the network |
| Smart lights and plugs, ESP32 boards and anything on a broker or a web API | MQTT or HTTP |
| Uninterruptible power supplies | Network UPS Tools |
| Modbus meters and controllers, and devices with their own binary frames | serial or TCP |
| Anything else with a programming interface | a profile worked out with labrat probe, or a driver of a few dozen lines of Python |
A bench instrument needs no code. Its commands go in a few lines of configuration (drivers), and simulated devices let you try everything without hardware.
Use it from
| Python | Client().set("bench-rat/psu", "VoltageLevel", 3.3, channel="1") (clients) |
| MATLAB | webwrite with a bearer token, or examples/matlab/labrat.m (clients) |
| AI agents | claude mcp add labrat -- labrat mcp (MCP) |
| Anything else | one HTTP endpoint and JSON (message API) |
Set up a lab
| Step | Where | Command |
|---|---|---|
| 1 | the server | sudo ./packaging/install.sh nest (install) |
| 2 | each bench computer | sudo ./packaging/install.sh rat (install) |
| 3 | anywhere | labrat find lists the rats on the network |
| 4 | anywhere | labrat adopt <rat> adds one to the nest, with the key the rat shows |
Any 64-bit Linux runs a nest or a rat. Good defaults are Ubuntu Server LTS or Debian for the nest, and Raspberry Pi OS Lite (64-bit), DietPi or Armbian for rats on single-board computers (which computer and which OS).
Questions
Does it replace PyVISA, LabVIEW or my scripts? No. LABRAT sits between them and the equipment, so every script, notebook and agent sees the same instruments through the same limits and locks. LabVIEW and MATLAB talk to it over HTTP.
Do I need a Raspberry Pi? No. A small lab runs the nest alone on one computer, with its instruments on the network or plugged in. Rats are for equipment that is spread over benches or needs local USB, GPIO or I2C.
What about a device nobody supports? Plug it in and run labrat probe, or ask your agent to work it
out. LABRAT asks it safe questions, records what its vendor software says to it, and turns that into a
profile, a short file that makes it a normal device. The next lab with the same model gets it from the
catalog (catalog).
Is it safe to let an agent drive real equipment? The guardrails are yours to set: limits on every setting, locks, requests that wait for a person, and one stop that puts the whole lab in its safe state. A rat that loses the nest does the same by itself.
Is there a web dashboard? Not yet. The terminal, the Python client and MCP cover everything today, and a dashboard will use the same API.
Can two people use the same instrument? Not at the same time, if they lock it. labrat lock makes a
device yours until you let go, labrat who shows who holds what, and require_lock makes a lock necessary
before any change. People are added with labrat user add, with no restart.
Where does my data go? Wherever you point it: a local disk or a NAS, in a folder per person and experiment (experiments).
Documentation
| Architecture | the nest, rats, messages and how they find each other |
| Install | hardware, operating systems, the nest and the rats |
| Configuration | nest.toml, rat.toml, devices, limits and tokens |
| Message API | every operation, error code and route |
| Rat protocol | what firmware must do to be a rat, for ESP32 and other boards |
| Clients | Python, MATLAB, curl, JavaScript and LabVIEW |
| MCP | AI agents through the Model Context Protocol |
| Drivers | the built-in drivers and how to write one |
| Recordings | readings, waveforms and streams written to storage on a schedule |
| Catalog and reverse engineering | device profiles, scanning, probing and capturing unknown devices |
| Experiments | each person's work in their own folder, with its commands, settings, notes and recordings |
| Names and selectors | ids, identities, the standard kinds, and finding devices by type, maker or serial |
| Safety and security | limits, safe states, the watchdog, tokens and the network |
| Roadmap | what comes next |
Contributing
Drivers, client libraries, documentation and bug reports are all welcome. CONTRIBUTING.md explains the workflow and the house rules. A maintainer reviews every pull request, with an automated review as advice on branches of this repository. Report security issues privately, as SECURITY.md describes.
Licence
LABRAT is released under the Apache License 2.0.
Metadata
Release files for labrat-lab 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| labrat_lab-0.2.0.tar.gz | 139.3 kB | With provenance | Details for labrat_lab-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| labrat_lab-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for labrat_lab-0.2.0-py3-none-any.whl |
Total release size: 273.7 kB
Release files / labrat_lab-0.2.0.tar.gz
| Download URL | labrat_lab-0.2.0.tar.gz |
|---|---|
| Size | 139.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96f726414b98b762773c562d0bba3fd354ce3bb7c01023dbe59bd896786af40e
|
|
BLAKE2b-256 checksum How to use checksums |
402f8ae8bd99d580e31b1eb36543ddf861d3582d843b85185143882b3fd594b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / labrat_lab-0.2.0-py3-none-any.whl
| Download URL | labrat_lab-0.2.0-py3-none-any.whl |
|---|---|
| Size | 134.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ee88b19266c3883ec9525cd4e11a55053e0490cda5fe34533d1a48adcc25902
|
|
BLAKE2b-256 checksum How to use checksums |
85f7071a4a37d1f57f73bbce21601740da74d051f735c885174f9b107c918659
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for labrat-lab 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for labrat_lab-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.