Skip to main content

Python SDK for Reactor - Real-time AI video streaming

Project description

Reactor Python SDK

PyPI version PyPI downloads build license

Python SDK for Reactor — real-time AI video streaming platform.

For full documentation, see the Python SDK Guide.

Installation

pip install reactor-sdk

Quick Start

import asyncio
from reactor_sdk import Reactor, ReactorStatus, video

async def main():
    reactor = Reactor(
        model_name="my-model",
        api_key="REACTOR_API_KEY",
        receive=[video("main_video")],
    )

    @reactor.on_frame
    def handle_frame(frame):
        print(f"Received frame: {frame.shape}")

    @reactor.on_status(ReactorStatus.READY)
    def handle_ready(status):
        print("Connected and ready!")

    await reactor.connect()
    await reactor.send_command("setParameter", {"value": 0.5})

    try:
        while reactor.get_status() == ReactorStatus.READY:
            await asyncio.sleep(0.1)
    finally:
        await reactor.disconnect()

if __name__ == "__main__":
    asyncio.run(main())

Features

  • WebRTC video streaming via aiortc
  • Multi-track support — named video and audio tracks with video() / audio() helpers
  • Event-driven API matching the JavaScript SDK
  • Frame callbacks for single-frame access (numpy arrays)
  • Video input support for sending video to models
  • Local development mode for testing without auth
  • Full type hints for IDE support
  • Async context managerasync with Reactor(...) as r:

API Overview

Constructor

from reactor_sdk import Reactor, video, audio

reactor = Reactor(
    model_name="my-model",
    api_key="REACTOR_API_KEY",
    receive=[video("main_video")],
    send=[video("webcam")],
)

For local development, pass local=True instead of api_key.

Key Methods

  • await reactor.connect() — Connect to the model (auto-fetches JWT from API key)
  • await reactor.disconnect(recoverable=False) — Disconnect
  • await reactor.reconnect() — Reconnect to an existing session
  • await reactor.send_command(command, data) — Send a command
  • await reactor.publish_track(name, track) — Publish a named media track
  • await reactor.unpublish_track(name) — Unpublish a named track
  • reactor.get_status() — Current ReactorStatus
  • reactor.get_state()ReactorState(status, last_error)
  • reactor.get_session_id() — Session ID
  • reactor.get_remote_tracks() — Dict of received tracks by name
  • reactor.set_frame_callback(callback) — Set frame callback

Decorators

@reactor.on_frame
def handle_frame(frame): ...

@reactor.on_track("main_video")
def handle_video(track): ...

@reactor.on_message
def handle_message(message): ...

@reactor.on_status(ReactorStatus.READY)
def handle_ready(status): ...

@reactor.on_error
def handle_error(error): ...

See the full documentation for the complete API reference, event list, and usage patterns.

Examples

See the examples/ directory for complete examples:

  • pygame_app/ — Pygame application with dynamic UI controls
  • rtmp_app/ — Stream Reactor video to RTMP servers (Twitch, YouTube, etc.)

License

MIT License — Copyright (c) 2026 Reactor Technologies, Inc.

Project details


Download files

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

Source Distribution

reactor_sdk-0.6.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

reactor_sdk-0.6.0-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file reactor_sdk-0.6.0.tar.gz.

File metadata

  • Download URL: reactor_sdk-0.6.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for reactor_sdk-0.6.0.tar.gz
Algorithm Hash digest
SHA256 e00992f7a2fcec8411ed09be90107606f371cbdc7d5eda475bca8624b4d0f2c7
MD5 d5d5a963d8d8f165654115ad02f05dc3
BLAKE2b-256 99568a808093a0a3ad4f73738c24acbd464edb8f039e204bda92f889720903ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for reactor_sdk-0.6.0.tar.gz:

Publisher: publish.yml on reactor-team/py-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reactor_sdk-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: reactor_sdk-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for reactor_sdk-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d6cbf584f8457d375e898a18d0fd589fa6cd13112f4e3e5f05ee195348246ee
MD5 c26c038665e83f40e25eee97933bcaa9
BLAKE2b-256 eb6dbc056c8ed6ab05b454b25bd61f70e1112dc91b86c459cb54251d8802c3c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for reactor_sdk-0.6.0-py3-none-any.whl:

Publisher: publish.yml on reactor-team/py-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page