Synopsis
Description
crucihil agent starts a persistent daemon on the bench machine. The agent:
- Loads the rig TOML and connects all configured backends
- Establishes a WebSocket connection to the cloud control plane
- Listens for
run_suitecommands pushed from the cloud - Executes tests and syncs results back to the cloud via the WebSocket
- Caches results locally in SQLite when the cloud is unreachable, syncing on reconnect
systemd service.
Options
Path to the rig TOML config. The file must exist. Short form:
-r.Path to the local SQLite result cache. Created if it does not exist. Results are written here first, then synced to the cloud on connection.
Enable debug logging including WebSocket frames and backend I/O. Short form:
-v.Cloud connection
The agent connects to the cloud when[rig.cloud] is present in the rig TOML:
registration_token, the agent:
- Calls
POST /api/v1/rigs/registerwith the token - Receives a permanent API key
- Saves the key to
~/.crucihil/credentials.toml - Connects the WebSocket using the new key
[rig.cloud] section, the agent runs in local-only mode: tests can be triggered via crucihil run but the cloud dashboard and MCP tools will not see this rig.
WebSocket protocol
The agent maintains a single persistent WebSocket connection to/ws/agent on the control plane. The protocol uses JSON messages:
| Direction | Message type | Description |
|---|---|---|
| Agent → Cloud | agent_hello | Sent on connect — rig name, version, hardware summary |
| Cloud → Agent | run_suite | Trigger a test run — suite path, tags, suite type |
| Agent → Cloud | run_started | Notifies cloud that a run has begun — run ID |
| Agent → Cloud | result | Per-test result — status, duration, errors, signals |
| Agent → Cloud | run_finished | Run complete — final summary |
| Cloud → Agent | cancel_run | Cancel the currently running suite |
Local result cache
Results are written to the SQLite cache before being synced to the cloud. This ensures no results are lost even if the cloud is unreachable during a test run. The sync happens automatically when the WebSocket reconnects. The cache path defaults to~/.crucihil/results.db. Override with --cache.
Production deployment with systemd
CruciHiL ships asystemd template unit for running the agent as a service.
Install the service
systemd/crucihil-agent@.service to /etc/systemd/system/.
Enable for a rig
@bench_01 suffix maps to rigs/bench_01.toml — the unit file looks for the TOML at /opt/crucihil/rigs/<instance_name>.toml.
Service unit
Check status
Environment variables
The agent respects these environment variables for cloud connectivity:| Variable | Description |
|---|---|
CRUCIHIL_BASE_URL | Cloud control plane URL (overrides [rig.cloud].url) |
CRUCIHIL_API_KEY | API key (overrides saved credentials) |
Example startup output
Exit codes
| Code | Meaning |
|---|---|
0 | Clean shutdown (Ctrl-C) |
2 | Fatal error (bad TOML, backend failure, missing credentials) |
See also
crucihil discover— generate the rig TOML that the agent uses- MCP Tools — register_rig — register a new rig and get an API key via AI
- Rig Configuration — cloud section