Providers
What a Provider Is
A provider is an external process that:
- Talks to specific hardware.
- Exposes devices via ADPP.
- Communicates with runtime over framed stdio.
The runtime remains hardware-agnostic; hardware specifics live in providers.
Protocol Boundary (ADPP)
Transport:
stdin/stdoutuint32_lelength-prefixed protobuf messages
Baseline operations expected by runtime integration:
HelloListDevicesDescribeDeviceReadSignalsCall
Recommended operations:
GetHealthWaitReady
Schema source: external/anolis-protocol/proto/anolis/deviceprovider/v1/envelope.proto.
Runtime/Provider Contract
- Provider owns hardware IO and protocol state.
- Runtime owns shared machine state (
StateCache) and call validation (CallRouter). - External layers (HTTP/UI/automation) must go through runtime APIs, never directly to provider processes.
Practical consequences:
- Provider crashes isolate to that provider.
- Runtime can keep operating other providers.
- Recovery behavior is driven by restart policy and supervision state.
Provider Supervision
Configure per provider:
yaml
providers:
- id: hardware0
command: ./my-provider
restart_policy:
enabled: true
max_attempts: 3
backoff_ms: [200, 500, 1000]
timeout_ms: 30000Behavior:
- Crash/unresponsive provider is marked unavailable.
- Runtime applies backoff then attempts restart.
- Device inventory is rediscovered after restart.
- Circuit opens after
max_attemptsconsecutive failures.
Operational observability:
- Use
GET /v0/providers/healthfor lifecycle/supervision detail. GET /v0/runtime/statusis intentionally coarse (AVAILABLE/UNAVAILABLEonly).
Key supervision fields:
lifecycle_statelast_seen_ago_msuptime_secondssupervision.attempt_countsupervision.circuit_opensupervision.next_restart_in_ms
Building a Provider
Minimal implementation steps:
- Implement framed stdio transport.
- Implement required ADPP operations.
- Implement device capability descriptions with accurate arg constraints.
- Map hardware errors to meaningful status/quality outputs.
Recommended quality bar:
- Deterministic startup behavior.
- Clear error propagation (no silent failure).
- Bounded operation timeouts.
- Predictable behavior under reconnect/restart.
Testing a Provider
Use runtime with a provider entry in runtime YAML:
yaml
providers:
- id: my_provider
command: /path/to/my-provider
args: []Then validate:
- Discovery (
/v0/devices, capabilities endpoint). - State quality/staleness (
/v0/state,/v0/providers/health). - Call validation and control flow (
POST /v0/call). - Restart/circuit behavior via forced provider failure.
Safe Initialization Contract
Providers must initialize hardware to safe defaults on process start.
Required startup guarantees:
- No unintended actuation.
- No heat/power outputs enabled by default.
- Motion channels initialized to inactive state.
- Hardware state is queried and normalized to safe outputs.
Typical safe defaults:
- Relays: de-energized.
- Motors: duty/setpoint zero, disabled where supported.
- Thermal outputs: disabled.
- Pressure/vacuum/high-voltage outputs: disabled or safe vent state per hardware policy.
This contract is mandatory for hardware deployments.
