Skip to main content

III

The main WebSocket client for communication with the III Engine.

Constructor

str
required
WebSocket URL of the III Engine (e.g., ws://localhost:49134)
InitOptions
Configuration options for the client

Methods

connect

Connect to the WebSocket server and initialize OpenTelemetry.

shutdown

Gracefully disconnect from the server and shut down OpenTelemetry.

get_connection_state

Get the current connection state.
IIIConnectionState
One of: "connected", "connecting", "reconnecting", "disconnected", "failed"

on_connection_state_change

Register a callback for connection state changes.
Callable[[IIIConnectionState], None]
required
Function called whenever connection state changes
Callable[[], None]
Function to remove the callback

list_functions

List all registered functions from the engine.
list[FunctionInfo]
List of function metadata objects

list_workers

List all connected workers from the engine.
list[WorkerInfo]
List of worker metadata objects

on_functions_available

Subscribe to function availability events.
Callable[[list[FunctionInfo]], None]
required
Function called when functions become available
Callable[[], None]
Function to remove the callback and clean up the trigger

Properties

worker_id

The worker ID assigned by the engine.
str | None
The worker ID, or None if not yet registered

InitOptions

Configuration options for the III client.
str
Custom name for this worker. Defaults to {hostname}:{pid}
bool
default:true
Enable worker metrics reporting to the engine
int
default:30000
Default timeout for function invocations in milliseconds
ReconnectionConfig
WebSocket reconnection behavior configuration
dict[str, Any]
OpenTelemetry configuration dictionary (deprecated - use init_otel() instead)
TelemetryOptions
Telemetry metadata to be reported to the engine

ReconnectionConfig

Configures automatic WebSocket reconnection behavior.
int
default:1000
Starting delay in milliseconds before first retry
int
default:30000
Maximum delay cap in milliseconds
float
Exponential backoff multiplier for each retry
float
Random jitter factor (0-1) to prevent thundering herd
int
Maximum retry attempts. Set to -1 for infinite retries

FunctionRef

Reference to a registered function, returned by register_function().
str
The function ID
Callable[[], None]
Function to unregister this function from the engine

Types

IIIConnectionState

Connection state literal type:

ConnectionStateCallback

Callback type for connection state changes:

FunctionInfo

Metadata about a registered function:

WorkerInfo

Metadata about a connected worker:

Example: Full Configuration