reactor init generates, line by line. By the end you’ll understand every building block.
The full model
Here’s whatreactor init gives you, a complete runnable model in a single file:
pipeline.py
Output tracks
Video means the field carries video frames.
You can have multiple tracks:
main_video, main_audio) become the track identifiers that clients use.
Client state
self.state.brightness inside inference().
The runtime takes care of the rest. We’ll cover how in the Interactive State page.
The model class
state: MyState tells the pipeline what is the shape of the input state. You get self.state with full IDE autocomplete.
Loading
config dict comes from config.yml. This is where you load checkpoints, allocate GPU memory, and set up your model inference configuration.
The inference generator
yield sends it to the client. The runtime manages the generator’s lifecycle, drives it between client connections, and delivers state updates between iterations.
The next page covers inference() in detail: sync vs async, batch yields, skipping frames, and how the lifecycle works.
The manifest
reactor.yaml
model: import path inmodule:ClassNameformat.name: human-readable identifier, used in logging and routing.config: path to the model config YAML.
Beyond the generator
ReactorPipeline handles the connection loop and state lifecycle for you. If your model doesn’t fit the generator pattern, or you want full control over what happens between client connections, see ReactorModel.Next
Now that you understand the pieces, let’s dive deeper into the inference generator.The Inference Generator
Sync vs async, batch yields, lifecycle, and state consistency.
Interactive State
Add richer parameters with validation and custom logic.