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.3.tar.gz (198.9 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.3-py3-none-any.whl (249.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reactor_runtime-3.2.3.tar.gz
  • Upload date:
  • Size: 198.9 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.3.tar.gz
Algorithm Hash digest
SHA256 edc9ed9cf41c54e02645e3c39b39560486b8d40ee08d0a21a5173048506773a6
MD5 8bf8a504a5b4fd89da788f68f3a868e8
BLAKE2b-256 be66b43b543cbef391f6432b7ea3b0ee5c720149ab9f67b298e4ddb4dd1c5b09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: reactor_runtime-3.2.3-py3-none-any.whl
  • Upload date:
  • Size: 249.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3ddaff815139c7a83f36a3590a8f166bd2875a4c82904786488838c49db5c3e2
MD5 f1587b024c8fe0bc5a8d8db1cf4ae617
BLAKE2b-256 f4dbf6ac7adceca642328d4be7510273741031b938330422cdbbe4c797232977

See more details on using hashes here.

Release history Release notifications | RSS feed

3.2.5

2 files

3.2.4

2 files

This release

3.2.3 This release

2 files

3.2.2

2 files

3.2.1

2 files

3.2.0

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