Skip to main content
Reactor Runtime

Build real-time AI models in Python.

📖 Documentation · 🚀 Quickstart · 🌐 Reactor


Reactor Runtime turns an inference pipeline into a real-time, interactive media and data stream. You write load() and run(); the runtime handles the session lifecycle, the WebRTC media transport, and the wire protocol that connects clients to your model. Viewers watch frames as they are generated and change what the model is doing mid-stream, with no restart and no re-queue.

Highlights

  • 📡 Real-time streaming. Frames reach clients over WebRTC as your model produces them, not after a whole video is done. emit() paces your loop to the rate clients play at, so a model needs no rate limiter of its own.
  • 🎮 Live interaction. Clients send commands mid-generation: change a prompt, move a camera, adjust a parameter. The next frame reflects it.
  • 🔌 No transport code. You never import a WebRTC library, manage a WebSocket, or encode video. The runtime ships its own media engine as a wheel, so a plain Python container is all a model needs.
  • Typed, validated commands. Declare the commands your model accepts with standard Python types and constraints. The runtime validates every payload before your handler runs and compiles the surface into an OpenAPI schema that drives typed client SDKs.
  • 📦 One container, anywhere. The reactor CLI scaffolds a workspace, builds a small image, and runs it locally. The same image deploys to Reactor's GPU cloud unchanged.

How it works

A model is a ReactorModel subclass in model.py. Declare the media it sends, load your weights once, and write the loop that receives or produces frames, data, and more:

from pathlib import Path

from reactor_runtime import InputField, Output, ReactorModel, Video, event


class MyOutput(Output):
    main_video: Video


class MyModel(ReactorModel):
    fps = 24

    def load(self, config_path: Path | None) -> None:
        self.pipe = load_my_pipeline()
        self.prompt = "a sunny meadow"

    @event(name="set_prompt", description="Scene the model renders")
    async def set_prompt(
        self, prompt: str = InputField(default="a sunny meadow", moderate=True)
    ) -> None:
        self.prompt = prompt

    async def run(self) -> None:
        while True:
            await self.connected.wait()
            while self.connected.is_set():
                frame = self.pipe.forward(prompt=self.prompt)
                await self.emit(MyOutput(main_video=frame))

That is a complete model. run() produces frames for as long as someone is watching, and any client can send set_prompt at any time to change what the next frame renders.

Scaffold, build, and run it with the CLI:

reactor init my-model
cd my-model
reactor run

reactor run builds a container with the runtime inside and serves WebRTC signaling on port 8080. Point a browser at it with the JS SDK, or connect from the Reactor Sandbox and watch frames stream immediately.

Install

Everything runs through the reactor CLI. There is nothing to install on your host but the CLI and Docker; the runtime ships inside the image the CLI builds for your workspace.

brew install reactor-team/tools/reactor-cli

Not on macOS, or pinning a release in CI? See Install the CLI.

Learn more

Development

This repository holds the runtime package itself: the authoring interface, the session runner, the media transport, and the wire protocol. To work on it, use mise, which pins the toolchain and forwards every task through a thin make shim:

mise run install      # install deps, generate wire bindings, and git hooks
mise run lint         # ruff check, ruff format --check, and mise.lock drift
mise run format       # apply ruff formatting
mise run typecheck    # ty (strict)
mise run test         # unit tests on the floor Python
mise run test-matrix  # unit tests on every supported Python

License

Licensed under the Apache License, Version 2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reactor_runtime-3.2.0.tar.gz (196.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reactor_runtime-3.2.0-py3-none-any.whl (246.5 kB view details)

Uploaded Python 3

File details

Details for the file reactor_runtime-3.2.0.tar.gz.

File metadata

  • Download URL: reactor_runtime-3.2.0.tar.gz
  • Upload date:
  • Size: 196.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for reactor_runtime-3.2.0.tar.gz
Algorithm Hash digest
SHA256 3ff86aa19784746c7bcc3ff923a6ef26914a7c3fb85198e47218039ae34b9b04
MD5 aca915c1d13d1182d9358ded2f904fa2
BLAKE2b-256 d61bc34fd388f8c62fa199b4c952c63fa7e0ec71cd3300ac7648d9ed4d2dfd29

See more details on using hashes here.

File details

Details for the file reactor_runtime-3.2.0-py3-none-any.whl.

File metadata

  • Download URL: reactor_runtime-3.2.0-py3-none-any.whl
  • Upload date:
  • Size: 246.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for reactor_runtime-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7b472931be053f4c2c0e7a8e04d7ede13e0c8a949cf2e6c754c36ab7d5e0c9d
MD5 c081dda3e7ab8c51c55cdb8ce97f8247
BLAKE2b-256 15d7038e353a32dbc287cad76c53cadf25c8ebcec1fe8ac3b69e9b7316011f3b

See more details on using hashes here.

Release history Release notifications | RSS feed

3.2.5

2 files

3.2.4

2 files

3.2.3

2 files

3.2.2

2 files

3.2.1

2 files

This release

3.2.0 This release

2 files

3.1.2

2 files

3.1.1

2 files

3.1.0

2 files

3.0.2

2 files

3.0.1

2 files

2.10.1

2 files

2.10.0

2 files

2.9.4

2 files

2.9.3

2 files

2.9.2

2 files

2.9.1

2 files

2.9.0

2 files

2.8.1

2 files

2.8.0

2 files

2.7.10

2 files

2.7.9

2 files

2.7.8

2 files

2.7.7

2 files

2.7.6

2 files

2.7.5

2 files

2.7.4

2 files

2.7.3

2 files

2.7.2

2 files

2.7.1

2 files

2.7.0

2 files

2.6.0

2 files

2.5.0

2 files

2.4.0

2 files

2.3.2

2 files

2.3.1

2 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.7.5

2 files

1.7.4

2 files

1.6.3

2 files

1.6.1

2 files

1.4.3

2 files

1.2.1

2 files

1.1.0

2 files

1.0.0

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page