Types
ReactorStatus
The current connection status of the Reactor instance. This is a PythonEnum.
ReactorState
Complete state information including status and errors. This is a Pythondataclass.
ReactorError
Error information when issues occur. This is a Pythondataclass.
ReactorError also supports string conversion:
Common Error Codes
| Code | Component | Recoverable | Description |
|---|---|---|---|
AUTHENTICATION_FAILED | coordinator | No | Invalid API key or JWT token |
COORDINATOR_CONNECTION_ERROR | coordinator | Yes | Failed to connect to coordinator |
GPU_CONNECTION_FAILED | gpu | Yes | Failed to connect to assigned GPU |
GPU_CONNECTION_ERROR | gpu | Yes | GPU connection error |
MESSAGE_SEND_FAILED | gpu | Yes | Failed to send message to GPU |
ReactorEvent
The event types that can be used withreactor.on() and reactor.off().
Python events use
snake_case (e.g., "status_changed") while the JavaScript SDK uses camelCase (e.g., "statusChanged").FrameCallback
Type alias for functions that receive video frames.- Shape:
(H, W, 3)— height, width, 3 color channels - Dtype:
uint8— values 0-255 - Color order: RGB
ConflictError
Exception raised when a connection conflict occurs (e.g., an existing connection was superseded by a newer request).fetch_jwt_token()
Fetches a JWT token from the coordinator using an API key. This is an async utility function.Parameters
| Parameter | Type | Description |
|---|---|---|
api_key | str | Your Reactor API key (e.g., rk_...) |
coordinator_url | str | Optional. The coordinator URL (default: https://api.reactor.inc) |
Returns
str — The JWT token.
Raises
RuntimeError if authentication fails (invalid API key, network error, etc.)
Example
In most cases, you don’t need to call this directly. Pass
api_key to the Reactor constructor and the SDK handles token exchange automatically during connect().