Python SDK for Reactor - Real-time AI video streaming
Project description
Reactor Python SDK
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 manager —
async 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)— Disconnectawait reactor.reconnect()— Reconnect to an existing sessionawait reactor.send_command(command, data)— Send a commandawait reactor.publish_track(name, track)— Publish a named media trackawait reactor.unpublish_track(name)— Unpublish a named trackreactor.get_status()— CurrentReactorStatusreactor.get_state()—ReactorState(status, last_error)reactor.get_session_id()— Session IDreactor.get_remote_tracks()— Dict of received tracks by namereactor.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 controlsrtmp_app/— Stream Reactor video to RTMP servers (Twitch, YouTube, etc.)
License
MIT License — Copyright (c) 2026 Reactor Technologies, Inc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reactor_sdk-0.4.0.tar.gz.
File metadata
- Download URL: reactor_sdk-0.4.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.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3050a3406721827354081b9f3ec5c6d786a034924a9bb5cfd8c9e35a5216ca26
|
|
| MD5 |
eb6c2a0e93b1cf1f759e78fe174bdc3d
|
|
| BLAKE2b-256 |
7d2664731fe249d8e5d283c7442e1ee38568c8fd87758be9180189bdb7ce3e11
|
Provenance
The following attestation bundles were made for reactor_sdk-0.4.0.tar.gz:
Publisher:
publish.yml on reactor-team/py-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reactor_sdk-0.4.0.tar.gz -
Subject digest:
3050a3406721827354081b9f3ec5c6d786a034924a9bb5cfd8c9e35a5216ca26 - Sigstore transparency entry: 1182046019
- Sigstore integration time:
-
Permalink:
reactor-team/py-sdk@5b19cc2c3196faf619cd43b3440dae2c160ec232 -
Branch / Tag:
refs/tags/v.0.4.0 - Owner: https://github.com/reactor-team
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b19cc2c3196faf619cd43b3440dae2c160ec232 -
Trigger Event:
release
-
Statement type:
File details
Details for the file reactor_sdk-0.4.0-py3-none-any.whl.
File metadata
- Download URL: reactor_sdk-0.4.0-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c9b5513b76b4be285b81231f1e38ba38fc44bf2bd5e5a3be99a8d36450c895f
|
|
| MD5 |
cce91709cecb78ac9b014033c42f3cc4
|
|
| BLAKE2b-256 |
ce61ccebf2685e7cc0317738997d76a8a290aefc25737c74fc47faa784c11e90
|
Provenance
The following attestation bundles were made for reactor_sdk-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on reactor-team/py-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reactor_sdk-0.4.0-py3-none-any.whl -
Subject digest:
2c9b5513b76b4be285b81231f1e38ba38fc44bf2bd5e5a3be99a8d36450c895f - Sigstore transparency entry: 1182046049
- Sigstore integration time:
-
Permalink:
reactor-team/py-sdk@5b19cc2c3196faf619cd43b3440dae2c160ec232 -
Branch / Tag:
refs/tags/v.0.4.0 - Owner: https://github.com/reactor-team
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b19cc2c3196faf619cd43b3440dae2c160ec232 -
Trigger Event:
release
-
Statement type: