Lab hosts: letting coding agents use the hardware on your bench without handing them the bench
Some tests cannot run in a cloud machine. A bootloader has to be flashed onto a board. A driver has to talk to a debug probe. A signing flow needs a hardware security key plugged into something. Teams that build firmware
Some tests cannot run in a cloud machine. A bootloader has to be flashed onto a board. A driver has to talk to a debug probe. A signing flow needs a hardware security key plugged into something. Teams that build firmware, embedded software or anything with a device in the loop keep a bench of such hardware, and the bench is usually attached to a PC under a desk.
Then a coding agent arrives and the question changes. Letting an agent write firmware is easy. Letting it run on the board, without handing it the whole bench, is the hard part. This post covers how Sandscale lab hosts address that, what a team has to set up, and what remains physical. The details come from the lab hosts docs and the lab hosts page.
What a lab host is
A lab host is one of your own machines, enrolled in your organization. Per the docs, it reports the devices attached to it, such as security keys, debug probes and development boards. A run claims what it needs, uses it, and releases it when the run ends. Lab hosts connect Linux and macOS machines. Windows is not supported yet. Lab hosts come with Team and Enterprise.
The machine stays yours: the bench PC, the Mac, the box under a desk stays where it is. Sandscale does not move the hardware to the cloud. It gives an agent's run a way to reach it, under rules.
Why not just give the agent SSH to the bench PC?
You can, and many teams start there. The problems show up quickly:
- Two runs, one board. Nothing stops two agents flashing the same board at once. The failure looks like flaky hardware.
- Everything the PC can reach. An SSH login to the bench PC gives the agent that PC's network, files and every device on it, not one board.
- No sign-off. Flashing a bootloader is not something a team wants to happen unasked, and a shared login has no approval step.
- No record. When a board is bricked, "who flashed it" should have an answer.
Lab hosts replace those with four properties, all from the docs and the lab hosts page:
- Exclusive claims. When a run claims a device, nothing else can use it until the run ends.
- Approval when policy says so. Claims can require an approval from a named person. Nobody approves their own request.
- Release at the end. When the run ends, the device goes back to the pool.
- A record. Every claim and release is in the audit log.
What a team sets up
Administrators do the setup in the console. Per the docs, they enrol lab hosts, issue enrolment tokens, and set who may claim which devices. The decisions are the part that takes thought:
One policy per project, written as three lists, the same shape as any agent policy:
- Can claim without asking: the cheap, recoverable devices. A spare ESP32 dev board that can be re-flashed from scratch in a minute.
- Needs approval: anything where a mistake costs time or money. An ARM board with a bootloader you flash, for example. Name the approver, usually the firmware lead.
- Not allowed: anything the project has no business touching. A security key that belongs to a different project, or a TPM holding something real.
Anything not allowed is refused. That is the right default: a new device plugged into the bench should not become claimable by accident.
Keep real secrets off the bench. A board used for agent test runs should not hold production signing keys or customer data. If a test needs a key, make a test key.
Decide what an agent's "done" looks like on hardware. The run ends and the claim is released, so a board is never left held. But a board may be left in a state: flashed with a test image, in a bootloader mode, with a changed fuse. Put a reset step at the start of each test run, not only at the end, so the state a run begins in does not depend on how the last one ended.
What the agent does
The agent does not need to know much about the bench. The run claims the device it needs, and the run's commands use it. The CLI (1.4.1) has a build group for build hosts; run sandscale help build to see whether your version also lists lab hosts. The local MCP server, sandscale mcp, has a tool to list lab hosts (build_lab_hosts_list), so an agent can see which hosts and devices exist before a task.
What the agent should do on hardware, in AGENTS.md:
## Hardware tests
- Hardware tests run only on a lab host device claimed for the run. Never SSH to a bench machine directly.
- Claim the device you need and nothing else. If the claim waits for approval, say so in your summary and stop.
- Start every hardware test by resetting the board to a known state.
- Never flash a board outside the test target named in the task.
- When the run finishes, release the device. Report any board you left in a non-default state.
As with every instruction file, this is a request. The claim policy and the approval are what enforce it.
What stays physical
Lab hosts do not solve everything, and it is better to say so:
- Someone has to be able to walk to the bench. A board that hangs after a bad flash may need a power cycle or a hand on a button. Decide who that is, and tell the approver which devices are likely to need it.
- Power and cabling are your problem. A loose USB cable looks like a software failure. Label ports.
- Hardware has limits software does not. Flash memory wears out. A test loop that rewrites the same sectors a few hundred times a day is a real cost, and an agent will happily do it. Put a limit on flash cycles in the task, not just in the policy.
- Bench traffic. If the bench PC is on the same network as other things, ask your network team what it can reach. A lab host does not change the network around it.
Who it suits, and a first step
Lab hosts are on Team and Enterprise, so they suit teams with several people on the same hardware: firmware groups, device and driver teams, hardware security labs. For a single developer with one board, a direct cable and a local agent is simpler.
A first step that costs little: pick one project and the two or three devices it uses; write the three lists; enrol one host; and run one task through the full claim, approval and release path, then read the audit log entries it produced. If the log tells the story you would want to read during an incident, widen it.
For agents on cloud machines in general, see workspaces, and for the full test suite on a larger machine, leasing a build host.
Originally published on the Sandscale blog.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.