# Reactor > Reactor is the developer platform for real-time world models: stream live, steerable AI video over WebRTC from JavaScript, React, Python, C++, Swift, Java, or Android. Multiple hosted models, one wire protocol — the full catalog is at /model-api-reference/overview. > ## Agent Instructions > To build and serve your own model, start at /deploy/development/quickstart and /deploy/development/overview. Deploying is the default path: reactor init scaffolds a workspace, reactor auth login authenticates, and reactor model deploy registers the model, publishes the release with the weights/ folder, and activates it on Reactor's GPUs, in one command from that workspace. Docker must be running, because the publish step builds the image locally. Bump model.version in reactor.yaml before redeploying a change, because a release that already has an image is reactivated as it is. Deployment access is granted per account, so contact team@reactor.inc if a deploy is refused. Every key in reactor.yaml is documented at /deploy/platform/reactor-yaml. Model code imports reactor_runtime; Python client code imports reactor_sdk. The runtime overview explains the model interface. Running the model on your own machine with reactor run is optional and needs a GPU you attach with --gpus; /deploy/development/local-testing covers that loop and pairs a complete brightness model with a Python client test in a separate brightness-test workspace. > Reactor hosts multiple models, each with its own connect slug (modelName) and command/event schema. The video model catalog — slug, typed SDK package, and links to its schema — is at /model-api-reference/overview. Robotics policy documentation starts at /robotics/overview; The launch policies are Cosmos Nano DROID (/robotics/cosmos/nano-policy-droid/), DreamZero DROID (/robotics/dreamzero/droid/), and FLUX Action DROID (/robotics/flux-action/droid/), organized by model family and embodiment. Some models expose one slug per experience (e.g. HappyOyster); always take the slug from the model's own pages, never guess it. > Fastest path to a working app: `npx create-reactor-app my-app --model=` scaffolds a complete app with secure auth wired up. Typed TypeScript SDKs are published as @reactor-models/; Python uses the base reactor-sdk package. > Auth: exchange an API key (rk_...) for a JWT via POST https://api.reactor.inc/tokens from your server. Never put the API key in client-side code. > Append .md to any docs URL for clean Markdown. Search these docs via the MCP server at https://docs.reactor.inc/mcp. # Authentication Source: https://docs.reactor.inc/authentication How authentication works in Reactor Reactor uses API keys to authenticate requests. JavaScript apps exchange the key for a short-lived token on their server; Python apps pass the key directly and the SDK does the exchange for them. Java apps exchange it explicitly with `Reactor.fetchJwt`, or use a token supplied by their backend. Use the full `owner/name` in both session connections and token model scopes, such as `reactor/helios` or `xmax/x2`. Replace `your-org/your-model` below with your deployment's full name. ## Get your API key **1. Create an account** Sign up at [reactor.inc](https://reactor.inc). **2. Create an API key** Open the **[Dashboard](https://reactor.inc/dashboard)**, click your user icon, then navigate to **API Keys** to create a new key. If you want a key for a team, switch to the team first: a key is bound to the account it was created in. See [API keys and billing](/teams/keys-and-billing). **3. Copy your key** Your key starts with `rk_`. Store it securely and never commit it to source control. > [tab] JavaScript > > ## JavaScript > > ### How it works > > Your server exchanges the API key for a short-lived token, which the browser uses to connect. Always > mint **session-scoped** tokens: pass `authorization_details` naming the models the token may start > sessions for. A scoped token can only create and operate its own sessions — it cannot touch other > sessions, other models, or any account API. If it leaks, the blast radius is a handful of sessions > on the models you listed, for at most the token's lifetime (1 hour by default). > > ![Server exchanges API key for a token, passes token to browser, browser connects to Reactor](https://mintcdn.com/reactortechnologiesinc/di-lNvbv-_WwgH1P/diagrams/auth-browser.svg?fit=max\&auto=format\&n=di-lNvbv-_WwgH1P\&q=85\&s=a6f63e88dd29fc985828416c43e57f91) > > ### Generate a session-scoped token > > Exchange your API key for a short-lived token by making a `POST` request to the `/tokens` endpoint > with your API key in the `Reactor-API-Key` header. **Always scope the token** with > `authorization_details`, naming the models it may start sessions for: > > ```typescript Session-scoped (1-hour expiry) theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > const result = await fetch("https://api.reactor.inc/tokens", { > method: "POST", > headers: { > "Reactor-API-Key": process.env.REACTOR_API_KEY, > "Content-Type": "application/json", > }, > body: JSON.stringify({ > authorization_details: [ > { > type: "session", > resources: { models: { match: ["your-org/your-model"] } }, > constraints: { max_sessions: 5, max_session_duration_seconds: 3600 }, > }, > ], > }), > }); > const { jwt, expires_at } = await result.json(); > ``` > > ```typescript Custom expiry theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > const result = await fetch("https://api.reactor.inc/tokens", { > method: "POST", > headers: { > "Reactor-API-Key": process.env.REACTOR_API_KEY, > "Content-Type": "application/json", > }, > body: JSON.stringify({ > expires_after: Number(process.env.TOKEN_LIFETIME_SECONDS), > authorization_details: [ > { > type: "session", > resources: { models: { match: ["your-org/your-model"] } }, > constraints: { max_sessions: 5 }, > }, > ], > }), > }); > const { jwt, expires_at } = await result.json(); > ``` > > The `authorization_details` entry has these parts: > > * **`type: "session"`** (required) — the only supported type today. The token can create sessions > and do everything those sessions need (transport negotiation, uploads, clips, session logs), and > nothing else. > * **`resources.models.match`** (required) — a non-empty list of models the token may start sessions > for. Every listed model must be visible to your API key. There is no wildcard; list each model > explicitly. > * **`constraints.max_sessions`** (optional) — how many sessions the token may create in total, from > 1 to 500. Defaults to 5. This counts sessions ever created by the token, not concurrent ones: > closing a session does not restore capacity. > * **`constraints.max_session_duration_seconds`** (optional) — cap every session the token creates > at this many seconds, from 1 to 86 400 (24 hours). Omit for no limit; if the account also has a > maximum, the lower value wins. See > [Rate limits](/resources/rate-limits#session-max-duration). > * **`resources.sessions.bind`** (optional) — a non-empty list of IDs of open sessions that the token > did not create itself. Required when the token must act on such a session. See > [Acting on a session another token created](#acting-on-a-session-another-token-created). > > Session-scoped tokens live for **1 hour** by default. Pass `expires_after` (in seconds) to shorten > or extend the lifetime, up to the server ceiling of 6 hours; values at or above the ceiling are > silently clamped. The server still returns 200, so always check `expires_at` (a Unix epoch > timestamp) on the response to confirm the actual expiry. > > > [!WARNING] > > > > Omitting `authorization_details` mints an **unscoped** token that can call every API your key's > > roles allow — sessions on any model, account data, key management. Never hand an unscoped token to > > a browser. Reserve unscoped tokens for trusted server-to-server calls (for example the [Platform > > API](/resources/platform-api-overview)), and don't store your API key in client-side code either: > > use your server as a proxy to mint scoped tokens, as shown below. > > ### Server-side proxy > > Set up an API route on your server that mints a session-scoped token and returns it to your > frontend: > > ```typescript Next.js theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > import { NextResponse } from "next/server"; > > export async function POST() { > const result = await fetch("https://api.reactor.inc/tokens", { > method: "POST", > headers: { > "Reactor-API-Key": process.env.REACTOR_API_KEY!, > "Content-Type": "application/json", > }, > body: JSON.stringify({ > authorization_details: [ > { > type: "session", > resources: { models: { match: ["your-org/your-model"] } }, > }, > ], > }), > }); > const { jwt } = await result.json(); > > return NextResponse.json({ jwt }); > } > ``` > > ```typescript Express theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > app.post("/api/token", async (_req, res) => { > const result = await fetch("https://api.reactor.inc/tokens", { > method: "POST", > headers: { > "Reactor-API-Key": process.env.REACTOR_API_KEY!, > "Content-Type": "application/json", > }, > body: JSON.stringify({ > authorization_details: [ > { > type: "session", > resources: { models: { match: ["your-org/your-model"] } }, > }, > ], > }), > }); > const { jwt } = await result.json(); > > res.json({ jwt }); > }); > ``` > > Then fetch the token from your frontend and pass it to the SDK: > > ```tsx app/page.tsx theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > "use client"; > > import { use } from "react"; > import { ReactorProvider, ReactorView } from "@reactor-team/js-sdk"; > > async function getToken() { > const result = await fetch("/api/token", { method: "POST" }); > const { jwt } = await result.json(); > return jwt; > } > > const tokenPromise = getToken(); > > export default function App() { > const token = use(tokenPromise); > return ( > > > > ); > } > ``` > > ### Acting on a session another token created > > A session-scoped token can act on the sessions in its bound set: the sessions it created, plus any > named in `resources.sessions.bind` when it was minted. Requests on a session outside that set return > `403`, including `DELETE /sessions/{id}`. To act on a session that a different token created, mint a > token with `bind` naming that session, then use it: > > ```typescript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > async function mintBoundToken(sessionId: string) { > const result = await fetch("https://api.reactor.inc/tokens", { > method: "POST", > headers: { > "Reactor-API-Key": process.env.REACTOR_API_KEY!, > "Content-Type": "application/json", > }, > body: JSON.stringify({ > authorization_details: [ > { > type: "session", > resources: { > models: { match: ["your-org/your-model"] }, > sessions: { bind: [sessionId] }, > }, > }, > ], > }), > }); > const { jwt } = await result.json(); > return jwt; > } > > // The DELETE succeeds only because the token was minted with this session in `bind`. > async function endSession(sessionId: string) { > const boundJwt = await mintBoundToken(sessionId); > const result = await fetch(`https://api.reactor.inc/sessions/${sessionId}`, { > method: "DELETE", > headers: { Authorization: `Bearer ${boundJwt}` }, > }); > if (!result.ok) throw new Error(`Could not end session ${sessionId}: ${result.status}`); > } > ``` > > The response from `/tokens` echoes `authorization_details` with the bound set and the resolved > `max_sessions`. Bound IDs are stored on the server and do not appear in the JWT claims. > > Rules for `bind`: > > * Every ID in `bind` must name a session that is still open and that your account owns. A closed, > foreign, or unknown ID returns the same `403`, so the endpoint cannot be used to find session IDs. > * The model of each bound session must appear in `models.match`. If it does not, the request returns > `403`. > * `max_sessions` defaults to the number of bound sessions, so the token has no room left to create: > it can operate the sessions it was given, but `POST /sessions` returns `403`. Pass a larger > `max_sessions` when the token also has to create sessions. > > ### Ending a session you did not create > > The JavaScript SDK deletes a session only from the client that created it (see > [Who owns the session](/concepts/sessions#who-owns-the-session)). To end it from any other client or > server, send `DELETE /sessions/{id}` with a token bound to that session as the bearer, as > `endSession` above does. The JSON body with a `reason` is optional. > > A server process that holds the API key does not need a token. It can send the key itself as the > bearer on `DELETE /sessions/{id}` and end any session under your account. Never do this from a front > end. The API key must stay on your server. > > ### Keeping the token fresh for a whole session > > `jwtToken` also accepts a resolver — a function returning a string or a `Promise` — instead > of a static value. Pass one whenever a session might outlive a single connect: the SDK calls the > resolver again for every later request that session makes (uploads, clip manifests, ICE refreshes, > SDP renegotiation), not just the initial connect. > > A resolver that mints a fresh token on every call breaks the session the moment it runs: a > session-scoped token can only act on the sessions **it** created, so a newly-minted token has none > of them bound yet, and the next upload or clip request 403s. Cache the token yourself, and only mint > again once it's close to expiring: > > ```typescript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > const TOKEN_REFRESH_SKEW_MS = 60_000; > let cachedToken: { jwt: string; expiresAtMs: number } | null = null; > let inflightToken: Promise | null = null; > > async function getToken(): Promise { > if (cachedToken && Date.now() < cachedToken.expiresAtMs - TOKEN_REFRESH_SKEW_MS) { > return cachedToken.jwt; > } > if (inflightToken) return inflightToken; // coalesce parallel hops > inflightToken = (async () => { > try { > const result = await fetch("/api/token", { method: "POST", cache: "no-store" }); > const { jwt, expires_at } = await result.json(); > cachedToken = { jwt, expiresAtMs: expires_at * 1000 }; > return jwt; > } finally { > inflightToken = null; > } > })(); > return inflightToken; > } > ``` > > Cache the token in your own code, not in the browser's HTTP cache: fetch with `{ cache: "no-store" }` > rather than relying on a `Cache-Control` header to do the memoizing for you. The browser cache is > outside your control — DevTools' "Disable cache", an eviction, or a shared proxy can all miss it > silently, and the resolver falls back to minting a token with no sessions bound, 403ing every call > the session makes from then on. > > > [!NOTE] > > > > **Edge case**: a session created moments before the cached token expires is orphaned at the next > > refresh, because the freshly minted token is not bound to it. Re-mint with > > `resources.sessions.bind` naming that session, as shown in [Acting on a session another token > > created](#acting-on-a-session-another-token-created). > > ### Tokens for a queue or admission-control server > > If you run an admission-control layer in front of a fixed pool of sessions — a waiting room gating > limited GPU capacity, for example — mint a separate token per admitted slot instead of one shared > token for the whole pool. Scope each token to `max_sessions: 1` so it can create exactly the one > session it is being admitted into: > > ```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > curl -X POST https://api.reactor.inc/tokens \ > -H "Reactor-API-Key: $REACTOR_API_KEY" \ > -H "Content-Type: application/json" \ > -d '{ > "expires_after": 900, > "authorization_details": [ > { > "type": "session", > "resources": { "models": { "match": ["reactor/helios"] } }, > "constraints": { "max_sessions": 1 } > } > ] > }' > ``` > > ```typescript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > async function mintSlotToken(model: string, slotLifetimeSeconds: number) { > const result = await fetch("https://api.reactor.inc/tokens", { > method: "POST", > headers: { > "Reactor-API-Key": process.env.REACTOR_API_KEY!, > "Content-Type": "application/json", > }, > body: JSON.stringify({ > expires_after: slotLifetimeSeconds, > authorization_details: [ > { > type: "session", > resources: { models: { match: [model] } }, > constraints: { max_sessions: 1 }, > }, > ], > }), > }); > const { jwt, expires_at } = await result.json(); > return { jwt, expires_at }; > } > ``` > > Size `slotLifetimeSeconds` to the slot's whole lifetime: the time an admitted user might take to > connect, plus the full session duration. Omitting it defaults to 1 hour, and 6 hours is the > [ceiling](#generate-a-session-scoped-token); a session-scoped token can't be topped up mid-session, > so undersizing this strands the session it created. Hand the resulting `jwt` to the admitted client > the same way as the [server-side proxy](#server-side-proxy) above; its `connect()` call creates the > session and binds it to this token's grant. > > > [!NOTE] > > > > If your API key is compromised, rotate it immediately from the > > **[Dashboard](https://reactor.inc/dashboard)**. Rotating does not affect active sessions. Need > > help? Email us at [support@reactor.inc](mailto:support@reactor.inc). > > > [!NOTE] > > > > **Adopting an existing session.** If your backend creates a session and hands the `sessionId` to a > > client, that client must connect with a token bound to the session. See [Acting on a session > > another token created](#acting-on-a-session-another-token-created) and > > [Sessions](/concepts/sessions#multiple-connections-per-session). > [tab] Python > > ## Python > > ### How it works > > **Python** runs server-side, so you pass your API key straight to the `Reactor` constructor. On > `connect()`, the SDK exchanges it for a short-lived, **session-scoped** token — scoped to the model > you built the `Reactor` with — and authenticates every request with that token, never the raw key. > If that token leaks, the blast radius is a handful of sessions on that one model, not your whole > account. Scoping is automatic; there is nothing extra to configure. > > ![Your app sends the API key directly to Reactor](https://mintcdn.com/reactortechnologiesinc/di-lNvbv-_WwgH1P/diagrams/auth-python.svg?fit=max\&auto=format\&n=di-lNvbv-_WwgH1P\&q=85\&s=f8b3692d6aea2460493dd4e2c7db734a) > > Pass your API key directly to the `Reactor` constructor: > > ```python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > import os > from reactor_sdk import Reactor > > reactor = Reactor( > model_name="your-org/your-model", > api_key=os.environ["REACTOR_API_KEY"], > ) > > # Mints a token scoped to "your-org/your-model", then connects with it. > await reactor.connect() > ``` > > > [!TIP] > > > > Never hardcode `rk_...` values in your code or commit them to source control. Use environment > > variables. > > ### Minting a token yourself > > Need a token for something other than a `Reactor` connection — a JWT broker that hands tokens to > browser clients, for instance? Call `fetch_jwt` and scope it with `models`: > > ```python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > import asyncio > import os > from reactor_sdk import DEFAULT_API_URL, fetch_jwt > > # fetch_jwt is synchronous — run it in a thread from async code so it doesn't > # block the event loop. > jwt = await asyncio.to_thread( > fetch_jwt, > api_key=os.environ["REACTOR_API_KEY"], > api_url=DEFAULT_API_URL, > models=["your-org/your-model"], # session-scoped to these models > ) > ``` > > Pass `max_sessions` to cap how many sessions the token may create (1–500, default 5), and > `expires_after` (in seconds) to shorten its lifetime below the 6-hour ceiling. Omitting `models` > mints an **unscoped** token that can call every API your key's roles allow — reserve that for > trusted server-to-server calls such as the [Platform API](/resources/platform-api-overview), and > never hand one to a client. > > > [!NOTE] > > > > **Adopting a session someone else created.** `connect(session_id=...)` attaches to a session that > > already exists rather than creating one. Because a session-scoped token can only act on the > > sessions it created itself, the SDK mints an unscoped token for this path, and `fetch_jwt` has no > > `bind` argument. A Python process holds the API key, so it can send `DELETE /sessions/{id}` with > > the key as the bearer to end any session. See [Acting on a session another token > > created](/authentication#acting-on-a-session-another-token-created) under the JavaScript tab, and > > [Sessions](/concepts/sessions#multiple-connections-per-session). > > > [!NOTE] > > > > Need help? Email us at [support@reactor.inc](mailto:support@reactor.inc). > [tab] C++ > > ## C++ > > ### How it works > > **C++** runs natively — a desktop client, an engine, a capture pipeline — so you pass your API key > straight to the `Reactor` constructor for a trusted environment, or a JWT minted elsewhere for > anything else. With an `ApiKey`, `connect()` exchanges it for a short-lived, **session-scoped** > token — scoped to the model you built the client with — and authenticates every request with that > token, never the raw key. If that token leaks, the blast radius is a handful of sessions on that one > model, not your whole account. Scoping is automatic; there is nothing extra to configure. > > Pass your API key directly to the `Reactor` constructor: > > ```cpp theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > #include > > reactor::Reactor client{"your-org/your-model", reactor::ApiKey{std::getenv("REACTOR_API_KEY")}}; > > // Mints a token scoped to "your-org/your-model", then connects with it. > client.connect().get(); > ``` > > > [!TIP] > > > > Never hardcode `rk_...` values in your code or commit them to source control. Use environment > > variables. > > ### Using a token minted elsewhere > > For a client that should never hold the raw API key — a game client, a desktop app distributed to > end users — construct with a `Jwt` instead, minted by your server the same way the [server-side > proxy](#server-side-proxy) above does for the browser SDK: > > ```cpp theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > reactor::Reactor client{"your-org/your-model", reactor::Jwt{token_from_your_backend}}; > client.connect().get(); > ``` > > > [!NOTE] > > > > **Adopting a session someone else created.** [`connect()`](/sdk-reference/cpp/reactor#connect) > > takes a `ConnectOptions` with a `session_id`, to attach to a session that already exists rather > > than creating one. The token you connect with must be bound to the session. See [Acting on a > > session another token created](/authentication#acting-on-a-session-another-token-created) under > > the JavaScript tab, and [Sessions](/concepts/sessions#multiple-connections-per-session). > > > [!NOTE] > > > > Need help? Email us at [support@reactor.inc](mailto:support@reactor.inc). > [tab] Swift > > ## Swift > > ### How it works > > **Swift** runs natively — a macOS or iOS app — so you pass your API key straight to the `Reactor` > initializer for a trusted environment, or a JWT minted elsewhere for anything else. With an API key, > the async initializer exchanges it for a short-lived, **session-scoped** token — scoped to the model > you built the client with — and authenticates every request with that token, never the raw key. If > that token leaks, the blast radius is a handful of sessions on that one model, not your whole > account. Scoping is automatic; there is nothing extra to configure. > > Pass your API key directly to the `Reactor` initializer: > > ```swift theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > import Reactor > > let reactor = try await Reactor(model: "your-org/your-model", apiKey: apiKey) > // Mints a token scoped to "your-org/your-model", then creates the client with it. > ``` > > > [!TIP] > > > > Never hardcode `rk_...` values in your code or commit them to source control. Use environment > > variables, or an Xcode scheme's environment for local development. > > ### Using a token minted elsewhere > > For a client that should never hold the raw API key — an iOS app distributed to end users — > construct with `jwt:` instead, minted by your server the same way the [server-side > proxy](#server-side-proxy) above does for the browser SDK: > > ```swift theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > let reactor = try Reactor(model: "your-org/your-model", jwt: tokenFromYourBackend) > try await reactor.connect() > ``` > > > [!NOTE] > > > > **Adopting a session someone else created.** > > [`connect(sessionID:connectionID:)`](/sdk-reference/swift/reactor#connect-sessionidconnectionid) > > takes a `sessionID` to attach to a session that already exists rather than creating one. The token > > you connect with must be bound to the session. See [Acting on a session another token > > created](/authentication#acting-on-a-session-another-token-created) under the JavaScript tab, and > > [Sessions](/concepts/sessions#multiple-connections-per-session). > > > [!NOTE] > > > > Need help? Email us at [support@reactor.inc](mailto:support@reactor.inc). > [tab] Java > > ## Java > > ### On a trusted server > > The Java SDK accepts a JWT through `ReactorOptions`. Use `Reactor.fetchJwt` to exchange an API key > before creating the client. Scope the token to the model your application uses: > > ```java theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > import inc.reactor.sdk.*; > > String apiUrl = "https://api.reactor.inc"; > JsonValue scope = JsonValue.parse(""" > { > "models": ["reactor/helios"], > "max_sessions": 1, > "max_session_duration_seconds": 3600, > "expires_after": 3600 > } > """); > String jwt = Reactor.fetchJwt(apiUrl, System.getenv("REACTOR_API_KEY"), scope, false).join(); > > try (Reactor reactor = Reactor.open(ReactorOptions > .builder(apiUrl, "reactor/helios").jwt(jwt).build())) { > try { > reactor.connect().join(); > // Send commands and receive frames here. > } finally { > reactor.disconnect().join(); > } > } > ``` > > The `models` option makes the token session-scoped. The other options limit how many sessions it can > create, each session's duration, and the token's lifetime. The final `false` keeps local-development > mode disabled. > > > [!WARNING] > > > > `Reactor.fetchJwt(apiUrl, apiKey)` without scoping options returns a token with the API key's > > permissions. It does not automatically restrict the token to a model. Do not hand an unscoped > > token or the API key to a distributed app. > > ### In a distributed application > > Mint a session-scoped JWT on your backend, then pass that token to the Java client: > > ```java theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > ReactorOptions options = ReactorOptions.builder("https://api.reactor.inc", "reactor/helios") > .jwt(tokenFromYourBackend) > .build(); > > try (Reactor reactor = Reactor.open(options)) { > try { > reactor.connect().join(); > // Send commands and receive frames here. > } finally { > reactor.disconnect().join(); > } > } > ``` > > Keep the API key on your backend. When attaching to an existing session with > `connect(sessionId, connectionId)`, use a token authorized for that session. > > See [Java installation](/sdk-reference/java/installation) for the JDK and native-access requirements, > and [Reactor](/sdk-reference/java/reactor) for connection and cleanup methods. *** # Release Notes Source: https://docs.reactor.inc/changelog/overview What's new in the Reactor SDKs and platform. ![Rolling red sand dunes at dusk](https://mintcdn.com/reactortechnologiesinc/3wrpLd7R1K3eK0X3/images/rea-061.webp?fit=max\&auto=format\&n=3wrpLd7R1K3eK0X3\&q=85\&s=1d04fd001f9a8dbd85c9f334e0ff6a5f) New releases, breaking changes, and notable improvements across the Reactor platform: JavaScript SDK, Python SDK, C++ SDK, Swift SDK, Android SDK, and API. Each model keeps its own release notes beside its reference pages, linked as Changelog under that model in [Model APIs](/model-api-reference/overview). **November 5, 2026** C++ SDK 2.7.0 · js-sdk 3.4.0 · Java SDK 1.4.0 ### New * **A step can carry its own input frames.** `client.step(state, commands, media)` takes a `reactor::StepMedia`, which maps an input track name to the frames for that step. A frame is a `RawVideoFrame`, a `RawAudioFrame`, or an `EncodedFrame`. The SDK pushes them after the frames already buffered on that track, and only once the state, the commands, and every frame pass their checks. A bad track or frame anywhere in `media` fails the step before the SDK pushes any of it. See [`step()`](/sdk-reference/cpp/reactor#options). * **A stepped session takes video that is already encoded.** An `EncodedFrame` holds one H.264 access unit as it is, with the width and height it decodes to. [`push_encoded_frame()`](/sdk-reference/cpp/track#push_frame) buffers one for the next step. The runtime decodes a track's frames before the step runs, so the model reads RGB frames as it does for a raw push. Reach for it on an input you already hold encoded, because the bytes are far smaller than raw pixels. Give one step's frames in decode order and start with a keyframe. A step whose frames do not decode fails with `StepRefusedError`. * **[`push_frame()`](/sdk-reference/cpp/track#push_frame) takes RGB pixels.** Pass `reactor::PixelFormat::Rgb` with `width * height * 3` bytes of R, G and B, which is how most decoders and image libraries hand a frame over. The SDK converts them to opaque BGRA before the push. * **[`Options::max_message_size`](/sdk-reference/cpp/reactor#options) sets the largest data-channel message the client declares and accepts**, from 256 KiB to 1 GiB. The constructor throws `BadRequestError` for a value outside that range. * **A JavaScript step can carry its own input frames.** [`reactor.step({ media })`](/sdk-reference/reactor-class#step) maps an input track name to the frames for that step. A frame is what `pushFrame()` takes, or an [`EncodedFrame`](/sdk-reference/types#encodedframe). The SDK pushes them after the frames already buffered on that track, and only once the state, the commands, and every frame pass their checks. A bad track or frame anywhere in `media` fails the step before the SDK pushes any of it. * **A stepped JavaScript session takes video that is already encoded.** [`reactor.pushEncodedFrame(track, frame)`](/sdk-reference/reactor-class#step), and `pushEncodedFrame()` on the handle `publishTrack()` resolves with, buffer one H.264 access unit for the next step. `data` is a `Uint8Array`, an `ArrayBuffer`, or a WebCodecs `EncodedVideoChunk`. The runtime decodes a track's frames before the step runs, so the model reads RGB frames as it does for a raw push. Reach for it on an input you already hold encoded, because the bytes are far smaller than raw pixels. Give one step's frames in decode order and start with a keyframe. A step whose frames do not decode fails with `StepRefusedError`. * **[`maxMessageSize`](/sdk-reference/reactor-class#new-reactor) sets the largest data-channel message the JavaScript client declares and accepts**, from 256 KiB to 1 GiB. The default stays 64 MiB. Raise it for a model that raises its own limit (`runtime.webrtc.max_message_size` in its `reactor.yaml`) and returns steps larger than that. The tab holds a whole message in memory while it arrives. * **A Java step can carry its own input frames.** [`reactor.step(state, commands, media)`](/sdk-reference/java/reactor#commands-and-schema) maps an input track name to the frames for that step. A frame is an `EncodedFrame`, or a raw frame from `StepInput.video()` or `StepInput.audio()`. The SDK pushes them after the frames already buffered on that track, and only once the state, the commands, and every frame pass their checks. A bad track or frame anywhere in `media` fails the step before the SDK pushes any of it. * **A stepped Java session takes video that is already encoded.** [`track.pushEncodedFrame(data, width, height)`](/sdk-reference/java/track#send-frames) buffers one H.264 access unit for the next step, with the size it decodes to. The runtime decodes a track's frames before the step runs, so the model reads RGB frames as it does for a raw push. Reach for it on an input you already hold encoded, because the bytes are far smaller than raw pixels. Give one step's frames in decode order and start with a keyframe. A step whose frames do not decode fails with `StepRefusedException`. * **[`pushFrame()`](/sdk-reference/java/track#send-frames) takes RGB pixels in Java.** Pass `PixelFormat.RGB` with `width * height * 3` bytes of R, G and B. The SDK converts them to opaque BGRA before the push. * **[`maxMessageSize(bytes)`](/sdk-reference/java/reactor#create-a-client) sets the largest data-channel message the Java client declares and accepts**, from 256 KiB to 1 GiB. `build()` throws `IllegalArgumentException` for a value outside that range. * **A Java connection reading carries more per-track measurements.** [`getStats()`](/sdk-reference/java/reactor#connection-statistics) reports `concealed_samples` and `total_samples_received` for a received audio track, and `frames_encoded` for a sent video track. A sent track also carries `jitter_ms`, the jitter the far end reports once its first receiver report arrives. ### Changed * **The C++ and Java clients declare and accept messages of up to 256 MiB, up from 64 MiB.** A stepped session returns each step's result in one message, so a model that raises its own limit (`runtime.webrtc.max_message_size`) can return steps larger than 64 MiB. A connection carries the smaller of the two sides' limits, so nothing changes against a runtime that keeps 64 MiB. The memory for a message is only taken as it arrives. ### Fixed * **A session that closed before it was ready now says why.** In the C++, Java and JavaScript SDKs, `connect()` failed with only "session entered terminal state Closed". The message now also names the reason the platform recorded, for example a stepped connect to a model that cannot step. The code is still `SESSION_TERMINAL`. * **`reconnect()` no longer times out on a high-latency link.** In the C++, Java and JavaScript SDKs, a reconnect on the same session could fail after 30 seconds with "transport readiness did not complete". Its candidates went out one round trip at a time, ahead of the connection's own readiness events. They now flush in the background. **October 28, 2026** Android SDK 1.1.0 ### New * **The messages a model sends arrive on `reactor.messages`.** The flow carries them in order, each one a `{"type", "data"}` JSON object, including the ones no call returns, such as state updates. In 1.0.0 an Android app saw only a command's own reply, returned by `sendCommand`. Start collecting before `connect()` to receive every message. A collector that falls more than 64 messages behind loses the oldest. See [Events](/sdk-reference/android/reactor#events). * **`reactor.runtimeMessages` carries what the platform says about the session.** Recording lifecycle notices arrive there, as JSON objects, separate from the model's own messages. **October 27, 2026** Android SDK 1.0.0 ### New * **The Android SDK.** `inc.reactor:reactor-sdk-android` connects Android apps to Reactor models from Kotlin, with `suspend` calls and `StateFlow` state. It covers sessions, commands, receiving and publishing video and audio tracks, file uploads (including `content://` URIs), recordings, and stepped generation. It supports Android 8.0 (API 26) and later on `arm64-v8a` and `x86_64`, including 16 KB page devices. See [Installation](/sdk-reference/android/installation). * **Camera, microphone, speaker, and rendering helpers.** The optional `inc.reactor:reactor-sdk-android-media` module captures from the camera and microphone, plays audio, and draws received video, so an app can stream to a model without its own capture code. **October 23, 2026** C++ SDK 2.6.0 · Swift SDK 1.6.0 · Java SDK 1.3.0 · js-sdk 3.3.0 ### New * **A session can generate one step at a time.** Set [`Options::generation`](/sdk-reference/cpp/reactor#options) to `Generation::Stepped`, then call `client.step(state, commands)`. Each step applies the state you give it, then its commands, then every input frame pushed since the previous step. It runs the model once and resolves with a `StepResult`. The result carries the frames each output track produced and their rate, the seconds the step took, and the files the model kept with it. Reach for it when you drive the model step by step rather than stream from it. `connect()` throws `GenerationModeMismatchError` when the runtime does not start the session that way, and `Options::step_timeout_seconds` bounds one step. * **[`push_frame()`](/sdk-reference/cpp/track#push_frame) buffers in a stepped session.** The next `step()` carries every frame pushed since the one before it, and `clear_step_inputs()` drops what is buffered now. The buffer holds one data-channel message's worth of bytes. When you push faster than steps run, the SDK drops the oldest frames. * **A failed step names the part at fault.** [`ReactorError`](/sdk-reference/cpp/types#reactorerror) gains `entry()`, the request entry the runtime refused, and `command_code()`, the code a failing handler raised. `StepRefusedError`, `StepNotReadyError`, `StepCommandFailedError`, `StepSessionEndedError` and `StepResultTooLargeError` are new. A step that ran and that the model reported failing resolves instead, with `StepResult::error` set. * **A Swift session can generate one step at a time.** Create the client with [`generation: .stepped`](/sdk-reference/swift/reactor#creating-a-client), then call `step(state:commands:)`. Each step applies the state you give it, then its commands, then every input frame pushed since the previous step. It answers with a `StepResult`: per output track its rate and the frames it produced, how long the step took, and the files the model kept with it. Reach for it when you drive the model step by step rather than stream from it. `connect()` throws `ReactorError.generationModeMismatch` when the runtime does not start the session that way, and `stepTimeout:` bounds one step. A `FileRef` goes into a step's state as `JSONValue(ref)`, or into a `StepCommand`'s arguments the way it goes into any other command. * **A Java session can generate one step at a time.** Build the client with [`.generation(Generation.STEPPED)`](/sdk-reference/java/reactor#create-a-client), then call `reactor.step(state, commands)`. Each step applies the state you give it, then its commands, then every input frame pushed since the previous step. Its future completes with a `StepResult`. The result holds each output track's rate and frames, the seconds the step took, and the files the model kept with it. Reach for it when you drive the model step by step rather than stream from it. `connect()` fails with `GenerationModeMismatchException` when the runtime does not start the session that way, and `.stepTimeoutSeconds(...)` bounds one step. * **[`pushFrame`](/sdk-reference/swift/track#pushframe-_) buffers in a stepped Swift session.** The next `step()` carries every frame pushed since the one before it, and `clearStepInputs()` drops what is buffered now. The buffer holds one data-channel message's worth of bytes. When you push faster than steps run, the SDK drops the oldest frames. * **A failed Swift step names the part at fault.** [`ReactorError`](/sdk-reference/swift/types#reactorerror) gains `entry`, the request entry the runtime refused, and `commandCode`, the code a failing handler raised. `.stepRefused`, `.stepNotReady`, `.stepCommandFailed`, `.stepSessionEnded` and `.stepResultTooLarge` match the way every other code does. A step that ran and that the model reported failing returns instead, with `StepResult.error` set. * **[`pushFrame`](/sdk-reference/java/track#send-frames) buffers in a stepped Java session.** The next `step()` carries every frame pushed since the one before it, and `clearStepInputs()` drops what is buffered now. The buffer holds one data-channel message's worth of bytes. When you push faster than steps run, the SDK drops the oldest frames. A frame handler on a stepped session's track is refused, because nothing streams there. * **A failed Java step names the part at fault.** [`ReactorException`](/sdk-reference/java/types#errors) gains `entry()`, the request entry the runtime refused, and `commandCode()`, the code a failing handler raised. `StepRefusedException`, `StepNotReadyException`, `StepCommandFailedException`, `StepSessionEndedException` and `StepResultTooLargeException` are new. A step that ran and that the model reported failing completes instead, with `StepResult.error()` set. * **A JavaScript session can generate one step at a time.** Create the client with [`generation: "stepped"`](/sdk-reference/reactor-class#new-reactor), then call [`step()`](/sdk-reference/reactor-class#step). Each step applies the state you give it, then its commands, then every input frame pushed since the previous step. It runs the model once and resolves with a [`StepResult`](/sdk-reference/types#stepresult). The result carries the frames each output track produced and their rate, the seconds the step took, and the files the model kept with it. `stepFrameToImageData()` turns a video frame into an `ImageData` a canvas draws. Reach for it when you drive the model step by step rather than stream from it. `connect()` fails with `GenerationModeMismatchError` when the runtime does not start the session that way. * **A stepped JavaScript session takes its input frames through `pushFrame()`.** [`publishTrack()`](/sdk-reference/reactor-class#publishtrack) now resolves with a [`PublishedTrack`](/sdk-reference/types#publishedtrack), whose `pushFrame()` buffers a `VideoFrame`, an `ImageData`, raw pixels or `Int16Array` PCM for the next step. A stepped session sends no RTP, so the `MediaStreamTrack` argument is optional there and ignored. The buffer holds one data-channel message's worth of frames. When you push faster than steps run, the SDK drops the oldest frames. `clearStepInputs()` drops what is buffered now. * **A failed JavaScript step names the part at fault.** [`ReactorError`](/sdk-reference/types#reactorerror) gains `entry`, the request entry the runtime refused, and `command_code`, the code a failing handler raised. `StepRefusedError`, `StepNotReadyError`, `StepCommandFailedError`, `StepSessionEndedError`, `StepResultTooLargeError` and `UnsupportedFrameEncodingError` are new. A step that ran and that the model reported failing resolves instead, with `StepResult.error` set. ### Changed * **Commands leave sooner.** The WebRTC engine moves to reactor-webrtc 0.24.2, which does less work per packet and sends a chunked data-channel message in one trip to the network thread. Nothing in the API changes. **October 24, 2026** reactor-sdk 1.13.0 (Python) ### New * **A session can generate one step at a time.** Create the client with [`generation="stepped"`](/sdk-reference/python/reactor#constructor), then call `step()`. Each step applies the state you give it, then its commands, then every input frame pushed since the previous step, and returns what the model produced on each output track as a [`StepResult`](/sdk-reference/python/types#stepresult). Reach for it when you drive the model step by step rather than streaming. `connect()` raises `GenerationModeMismatchError` when the runtime does not start the session that way, and `step_timeout` bounds one step. * **[`push_frame()`](/sdk-reference/python/track#push_frame) buffers in a stepped session.** The next `step()` carries every frame pushed since the one before, and `clear_step_inputs()` drops them. For video already encoded as H.264, [`EncodedFrame`](/sdk-reference/python/types#encodedframe) and `push_encoded_frame()` send the bytes as they are. Give the frames of one step in decode order, starting at a keyframe. * **A failed step names the part at fault.** [`ReactorError`](/sdk-reference/python/types#reactorerror) gains `entry`, the request entry the runtime refused, and `command_code`, the code a failing handler raised. `StepRefusedError`, `StepNotReadyError`, `StepCommandFailedError`, `StepSessionEndedError` and `StepResultTooLargeError` are new. **October 24, 2026** reactor-sdk 1.13.0 (Python) ### New * **A session can generate one step at a time.** Create the client with [`generation="stepped"`](/sdk-reference/python/reactor#constructor), then call `step()`. Each step applies the state you give it, then its commands, then every input frame pushed since the previous step, and returns what the model produced on each output track as a [`StepResult`](/sdk-reference/python/types#stepresult). Reach for it when you drive the model step by step rather than streaming. `connect()` raises `GenerationModeMismatchError` when the runtime does not start the session that way, and `step_timeout` bounds one step. * **[`push_frame()`](/sdk-reference/python/track#push_frame) buffers in a stepped session.** The next `step()` carries every frame pushed since the one before, and `clear_step_inputs()` drops them. For video already encoded as H.264, [`EncodedFrame`](/sdk-reference/python/types#encodedframe) and `push_encoded_frame()` send the bytes as they are. Give the frames of one step in decode order, starting at a keyframe. * **A failed step names the part at fault.** [`ReactorError`](/sdk-reference/python/types#reactorerror) gains `entry`, the request entry the runtime refused, and `command_code`, the code a failing handler raised. `StepRefusedError`, `StepNotReadyError`, `StepCommandFailedError`, `StepSessionEndedError` and `StepResultTooLargeError` are new. **October 14, 2026** js-sdk 3.2.0 ### New * **A `jwt` resolver now learns which session each token is for.** The SDK calls it with a [`JwtRequestContext`](/sdk-reference/types#jwtrequestcontext), `{ sessionId }`: the session the request targets, or nothing when the SDK creates one. A scoped token only reaches the sessions it created. A resolver that mints a replacement mid-session binds it to that session with `resources.sessions.bind`. That is the only way a fresh token reaches a session it did not create. See [Authentication](/authentication#keeping-the-token-fresh-for-a-whole-session). A resolver that ignores the argument works as before. * **The recording APIs accept a resolver in place of a token.** [`downloadClipAsFile()`](/sdk-reference/reactor-class#downloadclipasfile), [``](/sdk-reference/react-components#clipplayer), [``](/sdk-reference/react-components#clipdownloadbutton) and [`useClipDownload()`](/sdk-reference/react-hooks#useclipdownload) call it before every poll of the clip's metadata. Each call names the clip's session. A clip that takes a long time to finish now downloads across a token refresh. An abort ends the wait on the resolver too. * **[`ReactorError`](/sdk-reference/types#reactorerror) keeps the error it wraps as `cause`.** When a thrown JavaScript error caused the failure, `error.cause` holds it, with its stack. ### Changed * **`` and `useClipDownload()` read `getJwt` on every poll.** They resolved the token once, before the wait started. A rerender that passes a new `getJwt` during the wait now reaches the next poll. ### Fixed * **The SDK loads in Vite apps, in the dev server and in production builds.** `connect()` failed with "reactor-wasm failed to load", because Vite moved the SDK's code away from the WebAssembly binding it loads. The binding now ships inside its own JavaScript module, so it needs no bundler configuration. The SDK still fetches it on the first `connect()`. * **A binding that fails to load gives the reason.** The message names the cause, for example a Content Security Policy whose `script-src` omits `'wasm-unsafe-eval'`. Before, it always asked for a rebuild. **October 13, 2026** C++ SDK 2.5.0 · reactor-sdk 1.10.0 (Python) · Swift SDK 1.5.0 · Java SDK 1.2.1 ### New * **[`FetchJwtOptions`](/sdk-reference/cpp/reactor#constructors) takes a `sessions` field.** It binds the token to sessions that already exist, by id. Leave `models` and `max_sessions` unset, and the holder acts only on those sessions and cannot create new ones. The field comes last in the struct, so an aggregate initializer you wrote before keeps its meaning. * **[`fetch_jwt()`](/sdk-reference/python/types#fetch_jwt) in the Python SDK takes a `sessions` argument.** It binds the token to sessions that already exist, by id. Leave `models` and `max_sessions` out, and the holder acts only on those sessions and cannot create new ones. * **[`TokenOptions`](/sdk-reference/swift/types#tokenoptions) in the Swift SDK takes a `sessions` field.** It binds the token to sessions that already exist, by id. Leave `models` and `maxSessions` unset, and the holder acts only on those sessions and cannot create new ones. Mint a token this way for a client that adopts a session it did not create. * **The options of [`Reactor.fetchJwt`](/sdk-reference/java/reactor#authentication) in the Java SDK take a `sessions` array.** It binds the token to sessions that already exist, by id. Leave `models` and `max_sessions` out, and the holder acts only on those sessions and cannot create new ones. ### Fixed * **A client built with an `ApiKey` can now adopt a session.** [`connect()`](/sdk-reference/cpp/reactor#connect) with `ConnectOptions::session_id` failed with 403, because the token the client minted could not reach that session. The client now binds the token to the session it adopts. * **A Python client built with `api_key` can now adopt a session too.** [`connect(session_id=...)`](/sdk-reference/python/reactor#connect) failed with 403 for the same reason. The client now binds the token to the session it adopts. * **Command replies no longer stall every five minutes.** A reply waited 100 to 600 ms while the client posted a new network candidate. The client now gathers candidates once, the way a browser does. * **The Python SDK gets the same fix.** A reply to [`send_command()`](/sdk-reference/python/reactor#send_command) no longer waits while the client posts a candidate. * **The Swift SDK gets the same fix.** A reply to [`sendCommand`](/sdk-reference/swift/reactor#sendcommand-__uploads) no longer waits while the client posts a candidate. * **A Java client built with `.apiKey(...)` can now adopt a session as well.** [`connect(sessionId, connectionId)`](/sdk-reference/java/reactor#session-lifecycle) failed with 403 for the same reason. The client now binds the token to the session it adopts. * **The Java SDK gets the reply fix too.** A reply to [`sendCommand()`](/sdk-reference/java/reactor#commands-and-schema) no longer waits while the client posts a candidate. **October 8, 2026** Swift SDK 1.4.0 · reactor-sdk 1.9.0 (Python) · C++ SDK 2.4.0 · Java SDK 1.2.0 Rolls up Swift SDK 1.3.0 and 1.4.0. ### New * **[`stats()`](/sdk-reference/swift/reactor#stats) gives you a snapshot of the live connection.** It returns a `ConnectionStats` value with round-trip time, jitter, packet loss, and the measured and estimated bitrates. It also reports the candidate pair that carries the media, plus the engine's per-stream counters. A field the engine did not measure yet reads `nil` rather than zero. The call needs a `.ready` session. * **The Swift SDK reports connection quality to the runtime every 5 seconds.** It sends one reading per track you send or receive, with bitrate, packet loss, jitter and frame rate. It also sends connection-wide readings such as the bandwidth estimate and the round-trip time. The reports need no configuration, and they do not change what [`stats()`](/sdk-reference/swift/reactor#stats) gives you. A runtime that does not read them ignores them. * **The [initializer](/sdk-reference/swift/reactor#creating-a-client) takes `autoResumeTracks`.** It chooses whether the client subscribes to every recvonly track on connect and on reconnect. It defaults to `true`, which is what the SDK always did, so your code does not change. Set it to `false` to start unsubscribed, then [`resume()`](/sdk-reference/swift/track#resume) the tracks you want. A client keeps the choice for its whole life. * **The Python [constructor](/sdk-reference/python/reactor#constructor) takes `auto_resume_tracks` too.** It works the same way: it defaults to `True`, so your code does not change. Pass `False` to start with every recvonly track paused, then [`Track.resume()`](/sdk-reference/python/track#resume) the ones you want. * **The C++ [`Options`](/sdk-reference/cpp/reactor#options) struct takes `auto_resume_tracks` too.** It works the same way: it defaults to `true`, so your code does not change. Set it to `false` to start with every recvonly track paused, then [`Track::resume()`](/sdk-reference/cpp/track#resume) the ones you want. The field comes after `executor`, so an aggregate initializer you wrote before still picks the executor. * **The Java [`ReactorOptions`](/sdk-reference/java/reactor#create-a-client) builder takes `.autoResumeTracks(...)` too.** It works the same way: it defaults to `true`, so your code does not change. Pass `false` to start with every recvonly track paused, then [`resume()`](/sdk-reference/java/track#pause-and-bitrate) the ones you want. ### Fixed * **A session that negotiates data-channel chunking no longer loses what it sends.** A data channel could decide it was not chunked while the runtime's end of it was. From then on, nothing the client sent arrived, and neither side reported an error. Both ends now agree. * **The Python SDK gets the same chunking fix.** A command that a chunked session dropped without an error now reaches the model, and [`send_command()`](/sdk-reference/python/reactor#send_command) gets its reply. * **The C++ SDK gets the chunking fix as well.** A command or message that a chunked session dropped without an error now reaches the model. * **The Java SDK gets it too.** A chunked session no longer drops what [`sendCommand()`](/sdk-reference/java/reactor#commands-and-schema) sends, so the command reaches the model and its reply comes back. * **Each frame arrives with its own metadata.** The `frameID` and `userData` on [`VideoFrame`](/sdk-reference/swift/track#videoframe) come from the decoded frame itself. Before, a dropped frame shifted the tags, and every later frame carried the metadata of the frame before it. **October 6, 2026** reactor-sdk 1.8.0 (Python) · Java SDK 1.1.1 · C++ SDK 2.3.0 Rolls up reactor-sdk 1.7.0 and 1.8.0 (Python), plus Java SDK 1.1.0 and 1.1.1. ### New * **The Python SDK reports connection quality to the runtime every 5 seconds.** It sends one reading per track you send or receive, with bitrate, packet loss, jitter and frame rate. It also sends connection-wide readings such as the bandwidth estimate and the round-trip time. The reports need no configuration, and they do not change what [`get_stats()`](/sdk-reference/python/reactor#get_stats) gives you. A runtime that does not read them ignores them. * **The Java SDK reports connection quality to the runtime every 5 seconds too.** It sends the same per-track and connection-wide readings. They need no configuration, and they do not change what [`getStats()`](/sdk-reference/java/reactor#connection-statistics) gives you. * **The Java SDK takes an API key in [`ReactorOptions`](/sdk-reference/java/reactor#create-a-client).** Set `.apiKey(key)` and the client exchanges the key for a token itself on each `connect()`. The token only works with the model you named in the options. Keep the key on a machine you control. A token you set with `.jwt(token)` takes priority, and the SDK never replaces it. * **The C++ SDK reports connection quality to the runtime every 5 seconds too.** It sends the same per-track and connection-wide readings. They need no configuration, and they do not change what [`get_stats()`](/sdk-reference/cpp/reactor#get_stats) gives you. ### Changed * **[`send_command()`](/sdk-reference/python/reactor#send_command) sends a payload larger than 256 KiB, up to 64 MiB.** The SDK asks for data-channel chunking when it connects. When the runtime accepts, a large payload goes through instead of failing with [`MESSAGE_TOO_LARGE`](/sdk-reference/python/types#error-codes). A runtime that does not answer keeps the 256 KiB limit, so a session with one works as it did before. Commands of every size also reach the model in fewer round trips. Your code does not change. * **[`sendCommand()`](/sdk-reference/java/reactor#commands-and-schema) in the Java SDK sends a payload larger than 256 KiB, up to 64 MiB.** It asks for the same data-channel chunking, and a runtime that does not answer keeps the 256 KiB limit. Your code does not change. ### Fixed * **Each frame arrives with its own metadata.** The `user_data` argument that [`on_frame()`](/sdk-reference/python/track#on_frame) and [`on_raw_frame()`](/sdk-reference/python/track#on_raw_frame) pass comes from the decoded frame itself. Before, a dropped frame shifted the tags, and every later frame carried the metadata of the frame before it. The SDK drops a frame after a decode error, while it waits for a keyframe, or when the frame arrives late. * **Each frame arrives with its own metadata in the Java SDK too.** [`VideoFrame.userData()`](/sdk-reference/java/track#receive-frames) comes from the decoded frame, not from the frame before it. * **Each frame arrives with its own metadata in the C++ SDK too.** The `user_data` and `frame_id` on [`VideoFrame`](/sdk-reference/cpp/track#videoframe) come from the decoded frame, not from the frame before it. **October 5, 2026** js-sdk 3.1.0 · C++ SDK 2.2.0 · Swift SDK 1.2.0 Rolls up js-sdk 3.1.0, C++ SDK 2.2.0, and Swift SDK 1.2.0. ### New * **The SDK reports connection quality to the runtime every 5 seconds.** It sends one reading per track you send or receive, with bitrate, packet loss, jitter and frame rate, plus connection-wide readings such as the bandwidth estimate and the round-trip time. The reports need no configuration, and they do not change what [`getStats()`](/sdk-reference/reactor-class#getstats) and [`statsUpdate`](/sdk-reference/events#statsupdate) give you, or how often. A runtime that does not read them ignores them. ### Changed * **[`sendCommand()`](/sdk-reference/reactor-class#sendcommand) sends a payload larger than 256 KiB, up to 64 MiB.** The SDK asks for data-channel chunking when it connects. When the runtime accepts, a large payload goes through instead of reporting [`MESSAGE_TOO_LARGE`](/sdk-reference/types#error-codes). A runtime that does not answer keeps the 256 KiB limit, so a session with one works as it did before. Your code does not change. * **[`send_command()`](/sdk-reference/cpp/reactor#send_command) sends a payload larger than 256 KiB, up to 64 MiB.** The SDK asks for data-channel chunking when it connects. When the runtime accepts, a large payload goes through instead of failing with [`MESSAGE_TOO_LARGE`](/sdk-reference/cpp/types#error-codes). A runtime that does not answer keeps the 256 KiB limit, so a session with one works as it did before. Commands of every size also reach the model in fewer round trips. Your code does not change. * **[`sendCommand(_:_:uploads:)`](/sdk-reference/swift/reactor#sendcommand-) sends a payload larger than 256 KiB, up to 64 MiB.** The SDK asks for data-channel chunking when it connects. When the runtime accepts, a large payload goes through instead of failing with [`MESSAGE_TOO_LARGE`](/sdk-reference/swift/types#error-codes). A runtime that does not answer keeps the 256 KiB limit, so a session with one works as it did before. Commands of every size also reach the model in fewer round trips. Your code does not change. ### Fixed * **[`getStats()`](/sdk-reference/reactor-class#getstats) and [`statsUpdate`](/sdk-reference/events#statsupdate) describe the network path the session really uses.** The round-trip time, the bandwidth estimates and the bitrates now come from the candidate pair that carries the media. When the browser nominated more than one pair, which is common on a machine with several network interfaces, those values could come from an idle pair: no bandwidth estimate appeared, and the bitrates sat near zero. **September 16, 2026** reactor-sdk 1.6.0 (Python) · Swift SDK 1.1.0 · C++ SDK 2.1.0 Rolls up reactor-sdk 1.6.0 (Python), Swift SDK 1.1.0, and C++ SDK 2.1.0. ### New * **[`connect()`](/sdk-reference/python/reactor#connect) asks for two WebRTC setup extensions, SNAP and SPED.** Together they take up to three round trips off the time to the first frame. Your code does not change. A server that does not answer them negotiates the ordinary handshake, so a session with that server works as it did before. * **[`connect()`](/sdk-reference/cpp/reactor#connect) asks for two WebRTC setup extensions, SNAP and SPED.** Together they take up to three round trips off the time to the first frame. Your code does not change. A server that does not answer them negotiates the ordinary handshake, so a session with one works as it did before. ### Changed * **The Swift SDK does not log a debug line for each frame on a track with no handler.** Before, a client that reads one track of several got one line per frame, in the `media` category of the `inc.reactor.sdk` log. The SDK now logs only a frame that arrives with no track name, which means the transport could not match it to a declared track. Frame delivery itself did not change. ### Fixed * **[`connect()`](/sdk-reference/python/reactor#connect) and [`reconnect()`](/sdk-reference/python/reactor#reconnect) report the real reason when the transport fails while they run.** Both raise [`DisconnectedError`](/sdk-reference/python/types#error-codes) now, and its message names the transport state that ended the connection. `recoverable` is `True`, so a retry can succeed. Before, that race raised a generic error about a transport that was not prepared. * **[`connect()`](/sdk-reference/swift/reactor#connect-sessionidconnectionid) and [`reconnect()`](/sdk-reference/swift/reactor#reconnect) report the real reason when the transport fails while they run.** Both throw [`ReactorError.disconnected`](/sdk-reference/swift/types#error-codes) now, and its message names the transport state that ended the connection. `recoverable` is `true`, so the call can succeed on a retry. Before, that race threw a generic error about a transport that was not prepared. * **A [`Subscription`](/sdk-reference/cpp/types#subscription) that goes out of scope waits for a delivery already in flight.** `remove()` and the destructor now block until a call to that handler on another thread returns. Whatever the handler captured is then safe to destroy. Before, a caller could destroy those captures while that call was still in progress. A handler that removes its own subscription does not wait for itself. **September 11, 2026** reactor-sdk 1.5.1 (Python) · C++ SDK 2.0.2 · Swift SDK 1.0.1 Rolls up reactor-sdk 1.5.1 (Python), C++ SDK 2.0.2, and Swift SDK 1.0.1. ### New * **[`pushFrame()`](/sdk-reference/swift/track#pushframe-_) on an audio track takes any common capture rate, in mono or stereo.** Pass 8000, 16000, 24000, 32000, 44100 or 48000 Hz and 1 or 2 channels, and the SDK resamples locally to what the session carries. Before, you had to resample to 48 kHz mono yourself. A rate or channel count outside those sets now throws [`ReactorError.badRequest`](/sdk-reference/swift/types#error-codes), which names what is allowed. ### Changed * **An audio format the SDK cannot send raises `ValueError`.** [`push_frame()`](/sdk-reference/python/track#push_frame) refuses a `sample_rate` outside the six rates above, and a `num_channels` other than 1 or 2. It also refuses PCM whose length is not exactly `samples_per_channel * num_channels * 2` bytes. Raw BGRA video bytes already had that check against their dimensions. `Microphone` checks its capture rate and channel count too, before it opens the device. Before, the SDK took a format it could not carry and sent noise. ### Fixed * **[`push_frame()`](/sdk-reference/python/track#push_frame) keeps an audio frame's sample rate and channel count.** Before, every buffer went on the wire as 48 kHz mono, so PCM captured at another format arrived at the wrong pitch and length. 8000, 16000, 24000, 32000, 44100, and 48000 Hz all work now, in mono or stereo. WebRTC resamples locally to the format the connection negotiated. Push at your capture rate: the SDK buffers a chunk of any size into 10 ms blocks, and a format change or a disconnect drops the partial block. * **[`push_frame()`](/sdk-reference/cpp/track#push_frame) keeps the sample rate and channel count you give it.** An audio track takes 8, 16, 24, 32, 44.1 or 48 kHz PCM, in mono or stereo, and WebRTC resamples it locally. Before, the SDK sent every buffer as 48 kHz mono, so PCM captured at any other rate reached the model distorted. Pace your pushes at the capture rate. * **A rate or a channel count the SDK cannot take now throws [`BadRequestError`](/sdk-reference/cpp/types#error-codes).** Before, the call returned as though it worked, and the audio never arrived. **September 9, 2026** reactor-sdk 1.5.0 (Python) · js-sdk 3.0.2 · C++ SDK 2.0.1 Rolls up reactor-sdk 1.5.0 (Python), js-sdk 3.0.2, and the C++ SDK's 2.0.0 and 2.0.1 releases. ### Breaking * **Audio tracks use [`on_frame()`](/sdk-reference/cpp/track#on_frame) and [`push_frame()`](/sdk-reference/cpp/track#push_frame), as video already did.** `on_audio()` and `push_audio()` are gone. Take an `AudioFrame` in the handler you pass to `on_frame()`, and push interleaved 16-bit PCM with `push_frame(Samples{...})`. The overload has to match the track's [`kind()`](/sdk-reference/cpp/track#kind), so a video handler on an audio track throws `InvalidStateError`. Rename the two calls. Nothing else about them changed. * **[`pause()`](/sdk-reference/cpp/track#pause) and [`resume()`](/sdk-reference/cpp/track#resume) throw on a sendonly track.** Both control what the client receives, and a sendonly audio track now refuses them exactly as a video one already did. Code that paused a track it publishes did nothing before, and throws now. * **`Options::local` skips the API-key exchange and selects localhost.** With `api_url` left at its default, a local connection goes to `reactor::LOCAL_API_URL` (`http://localhost:8080`) rather than to production. A key you passed is no longer exchanged for a token. A custom `api_url` is kept as it is, and so is a JWT you supplied. This matches the Python SDK. ### New * **Wheels for Alpine Linux.** `pip install reactor-sdk` now finds a wheel on a musl 1.2+ distribution, x86\_64 and aarch64. Before, there was none, and pip resolved to an older release with a different API. Pin `reactor-sdk>=1.0` to get an error instead. * **[`fetch_jwt()`](/sdk-reference/cpp/reactor#constructors).** Exchanges an API key for a token without building a client or opening a session, for a backend that mints tokens somebody else will use. `FetchJwtOptions` scopes the token to a set of models, caps how many sessions it may open and how long each one runs, and sets its lifetime. It returns `std::future`, and a failure arrives as the same typed [`ReactorError`](/sdk-reference/cpp/types#reactorerror) a call throws. * **A constructor that takes no credential.** `reactor::Reactor{model, options}` with `options.local = true` connects to a local runtime, which needs none. * **[`on_capabilities_received()` and `on_session_id_changed()`](/sdk-reference/cpp/reactor#events).** The model's capabilities as they arrive, and the session id whenever it is set or cleared (`std::nullopt`). Register both before `connect()` to catch the first of each. The declared tracks are refreshed before capabilities are delivered, so [`tracks()`](/sdk-reference/cpp/reactor#tracks) is already current inside that handler. * **A [`FileRef`](/sdk-reference/cpp/types#fileref) can go inside a command's arguments.** A parameter that takes several files has no named slot in the `uploads` map. Pass those references in `args` instead: a `FileRef` converts to `Json` as the upload reference the model reads, and `Json::array({first, second})` is that list. A parameter that takes one file is still named in `uploads`. ### Fixed * **A [`FileRef`](/sdk-reference/python/types#fileref) nested inside [`send_command()`](/sdk-reference/python/reactor#send_command)'s `data` now reaches the model.** Put one in a list or a dict, and the SDK sends it as the upload reference the model reads. Before, the call raised `TypeError`, so a parameter that takes several files needed a hand-written `{"upload_id": ...}` dict, which you can now delete. A top-level `FileRef` still travels beside the arguments. * **A [`FileRef`](/sdk-reference/types#fileref) nested inside [`sendCommand()`](/sdk-reference/reactor-class#sendcommand)'s `data` now reaches the model.** Pass one inside an array or object, and the SDK sends it as the upload reference the model reads. Before, it crossed the wire with the class's own field names (`uploadId`, `mimeType`), and the model refused it. A parameter that takes several files needed a hand-written `{ upload_id }` object, which you can now delete. A top-level `FileRef` still travels beside the arguments. **September 4, 2026** C++ SDK 1.0.0 · reactor-sdk 1.3.0 → 1.4.0 (Python) Rolls up the C++ SDK's first release and reactor-sdk 1.3.0 and 1.4.0. ### New * **The Reactor C++ SDK's first release.** A C++17 client for native applications (engines, capture pipelines, desktop clients), built on the same Rust core the Python and JavaScript SDKs bind, and shipped as one prebuilt archive per platform rather than through a package manager. The base `Reactor` class and `Track` cover connecting, commands, uploads, recordings, events, connection-wide and per-track bitrate control, and connection stats — calls return `std::future`, frames arrive as BGRA on the library's delivery thread. `Speaker` and `Microphone` (`reactor::sdk_audio`) play a `recvonly` audio track through real speakers or capture a real microphone into a `sendonly` one. See [Installation](/sdk-reference/cpp/installation) and [Using the SDK](/sdk-reference/using-the-sdk). * **[`get_stats()`](/sdk-reference/python/reactor#get_stats).** A snapshot of the live connection, as a [`ConnectionStats`](/sdk-reference/python/types#connectionstats): RTT, jitter, packet loss, bitrates, and the WebRTC engine's own per-stream counters. An unmeasured field reads `None` rather than zero. The SDK derives the two measured bitrates against the previous call, so they stay `None` until a second call at least 200 ms later. Only callable once the session is `ready`. * **[`Reactor.set_bitrate()`](/sdk-reference/python/reactor#set_bitrate) and [`Track.set_bitrate()`](/sdk-reference/python/track#set_bitrate).** Bound the connection's whole budget, and one sender's share of it, in bits per second. The two apply together and the lower wins. For video, the track-level ceiling is the one to raise: with nothing set, WebRTC caps anything above 960x540 at 2.5 Mbps, 4K included. * **`max_session_duration_seconds` on the [`Reactor()`](/sdk-reference/python/reactor#constructor) constructor.** Terminates every session the client's own minted token creates after that many seconds, whatever the token's expiry says. The same constraint [`fetch_jwt()`](/sdk-reference/python/types#fetch_jwt) takes, now available without minting the token yourself. Ignored when you pass `jwt`. * **`RecorderDisabledError`.** `request_clip()` / `request_recording()` raise this instead of a bare `ReactorError` when the model's recorder is disabled or has crashed. Retrying the call will not help. The recorder has to be restarted on the model side. See [Error codes](/sdk-reference/python/types#error-codes). * **`get_stats()` reports the transport the session uses.** `candidate_type` is `"host"`, `"srflx"`, `"prflx"`, or `"relay"`, and `"relay"` means the media goes through a TURN server. That is the first thing to check when latency is bad. `relay_protocol` names that server's own transport (`"udp"`, `"tcp"`, or `"tls"`). * **Three fields the JavaScript SDK already reported are here too.** `available_incoming_bitrate_bps` and `available_outgoing_bitrate_bps` carry the congestion controller's estimate of what the path can carry, not what flows over it. `frames_per_second` is the rate on the received video stream. * **The per-stream report carries more.** [`InboundStream`](/sdk-reference/python/types#inboundstream) and [`OutboundStream`](/sdk-reference/python/types#outboundstream) now name their `kind` (`"audio"` or `"video"`) and count video frames. A send stream also carries what the far end reports back about it: `total_round_trip_time_s`, `fraction_lost`, and `packets_lost`. [`CandidatePair`](/sdk-reference/python/types#candidatepair) gains `nominated`, `writable`, its own byte and packet totals, and the two bitrate estimates. ### Changed * **[`close()`](/sdk-reference/python/reactor#close) settles operations still in flight.** A `send_command()` whose reply had not arrived when `close()` ran now raises `AbortedError` in the coroutine that awaits it. Before, that `await` stayed pending for the life of the process. `disconnect()` was never affected. * **[`push_frame()`](/sdk-reference/python/track#push_frame) refuses raw bytes that do not match their dimensions.** A BGRA buffer that is not exactly `width * height * 4` bytes raises `ValueError`. Only the dimensions cross to the native side, never the length, so a mismatch used to send the reader past the end of the buffer. Frames pushed as a numpy array are unaffected. * **Prebuilt wheels.** `pip install reactor-sdk` now installs a wheel with the native library already in it, one per platform: Linux on glibc 2.34 or newer (x86\_64, aarch64), macOS 11+ on arm64 and 13+ on x86\_64, and Windows x86\_64. One wheel covers every supported interpreter, 3.10 and up. There is no source distribution, so anywhere else pip quietly resolves to an older release. Pin `reactor-sdk>=1.0` to get an error instead. * **`jitter_s` and `packet_loss_ratio` now come from the received video stream.** That is the stream the JavaScript SDK reads, so the two SDKs report the same number for the same connection. They used to aggregate across every receive stream. An audio-only session still gets both: they fall back to the receive streams there are, where the JavaScript SDK reports nothing. * **The two measured bitrates now cover the candidate pair that carries the media.** `incoming_bitrate_bps` and `outgoing_bitrate_bps` count everything that pair carried, RTCP and the data channel included. Before, they summed RTP payload and read a little low. One consequence: both read `None` until ICE selects a pair, on top of the cases that already read `None`. * **`rtt_ms` comes from that same pair**, rather than from the highest-priority succeeded one. ### Fixed * **An outbound stream's `round_trip_time_s` was always `0.0`.** It now carries the measured value. * **A send stream's `packets_sent` and `retransmitted_packets_sent` wrapped after about 4.3 billion packets**, which is roughly seven weeks at a thousand packets a second. After the wrap, a cumulative counter appeared to go backwards. Both are 64-bit now, as are the candidate pair's. **September 1, 2026** js-sdk 3.0.1 ### New * **[`setTrackBitrate()`](/sdk-reference/reactor-class#settrackbitrate) raises the ceiling on a track you publish.** With no bound set, a Chromium-based browser caps a sender above 960x540 at 2500 kbps, so a 720p or 1080p publish never exceeds 2.5 Mbps even on a fast connection. Call it with `maxBps` after [`publishTrack()`](/sdk-reference/reactor-class#publishtrack) to give the encoder more room. `minBps` sets a floor, which only Chromium honors. There is no connection-wide equivalent, because browsers do not expose one. **August 24, 2026** js-sdk 3.0.0 A major version bump for `@reactor-team/js-sdk`. This release moves session and protocol handling into the same underlying implementation the Python and C++ SDKs share — the SDK's own JavaScript/TypeScript no longer drives the browser's WebRTC APIs by hand; that layer does, over the same wire protocol. ### Breaking * **`sendCommand()` now waits for its reply, and resolves with it.** The returned promise used to resolve as soon as the command was sent, before the model replied. It now genuinely awaits the model's correlated reply, bounded by a timeout, and resolves with the reply payload (or `undefined` if the handler acknowledged the command without sending one back). A call site that awaits or otherwise consumes the returned promise now waits for the real round trip instead of resolving almost immediately; a caller that never awaited it in the first place is unaffected. * **[`ReactorError`](/sdk-reference/types#reactorerror) is a typed class hierarchy, not a flat object.** It's now the base of 16 concrete subclasses (`UnauthorizedError`, `ConflictError`, `RateLimitedError`, and more — see [Error codes](/sdk-reference/types#error-codes)), each carrying a stable `code`, `recoverable`, `status`, `operation`, `retry_after_ms`, and `timestamp_ms`. The old `component` field (`"api"`/`"gpu"`) is gone. `retryAfter`/`timestamp` are kept alongside the new field names for compatibility. ### New * **Track introspection on the base class.** [`tracks()`](/sdk-reference/reactor-class#tracks), [`trackMapping()`](/sdk-reference/reactor-class#trackmapping), [`pausedTracks()`](/sdk-reference/reactor-class#pausedtracks), and [`getTrackByName()`/`getStreamByName()`](/sdk-reference/reactor-class#gettrackbyname-getstreambyname) / [`getTrackByMid()`/`getStreamByMid()`](/sdk-reference/reactor-class#gettrackbymid-getstreambymid) resolve a named or negotiated track to its `MediaStreamTrack`/`MediaStream` directly off a `Reactor` instance. * **[`pauseTrack()`](/sdk-reference/reactor-class#pausetrack) / [`resumeTrack()`](/sdk-reference/reactor-class#resumetrack) are asynchronous.** Both now return a `Promise`, queued behind the same control round-trip as other track operations, instead of applying synchronously. * **[`getSchema()`](/sdk-reference/reactor-class#getschema) / [`schemaReceived`](/sdk-reference/events#schemareceived).** The model's command schema, fetched automatically on the first `"ready"` transition and cached for synchronous reads. * **[`once()`](/sdk-reference/reactor-class#once).** Registers an event listener that fires at most once, then removes itself. * **[`isFileRef()`](/sdk-reference/types#isfileref).** A structural check for anything shaped like a [`FileRef`](/sdk-reference/types#fileref), for callers who'd rather duck-type than rely on `instanceof`. * **[`useReactor()`](/sdk-reference/react-hooks#usereactor) exposes more store state.** `lastMessage`, `jwtToken`, and `connectOptions` are now readable off the store, and `pauseTrack`/`resumeTrack` are store actions alongside `publish`/`unpublish`. ### Removed * **`getState()`.** Read `getStatus()`, `getLastError()`, and `getSessionId()` individually instead. * **The `sessionExpirationChanged` event.** It never carried a real value in any deployment — dropped rather than carried forward. **August 14, 2026** reactor-sdk 1.0.0 (Python) ### Breaking * **`send_command()` now waits for its reply.** Previously fire-and-forget — the call resolved as soon as the command was queued, and any reply from the model arrived later as a separate `message` event. It now returns the model's correlated reply directly: `{"type": ..., "data": ...}`, or `None` if the handler acknowledged the command without returning a message (an auto-generated `set_` setter, for instance). To fire a command without waiting on the reply, schedule the call instead of awaiting it directly — `asyncio.create_task(reactor.send_command(...))` — keeping a reference to the task so it isn't garbage-collected before it completes. * **Errors are now typed exceptions, and [`ReactorError`](/sdk-reference/python/types#reactorerror) is the one class for both.** Every failure used to arrive as one bare exception carrying only a sentence, and separately, `on_error` handed you a same-shaped-but-different dataclass. `ReactorError` is now both: the base of 16 concrete subclasses (`UnauthorizedError`, `ConflictError`, `RateLimitedError`, and more — see [Error codes](/sdk-reference/python/types#error-codes)) that `on_error` and a raised call hand you identically, each with a stable `code`, `recoverable`, `status`, `operation`, `retry_after_ms`, and (event-only) `timestamp_ms`. The old `component` field (`api`/`gpu`) is gone — it split codes by platform tier, which wasn't actionable and could report the same failure under two different codes. `except ReactorError` still catches everything; code relying on `error.component` needs updating. * **Audio devices are synthetic-only.** The constructor's `adm_mode` argument is gone; no `Reactor` instance ever opens a real microphone or speaker on its own. A `sendonly` audio track only ever carries PCM you push yourself with [`Track.push_frame()`](/sdk-reference/python/track#push_frame), and a model's audio must be played back explicitly via [`Track.on_frame()`](/sdk-reference/python/track#on_frame) / [`on_raw_frame()`](/sdk-reference/python/track#on_raw_frame) — or with `Speaker`/`Microphone`, below. * **`reactor.on_frame` (client-wide) is removed.** It only ever worked for video, and a single handler fed every `recvonly` video track couldn't tell them apart. Register on the [`Track`](/sdk-reference/python/track#on_frame) instead, found by name (`reactor.track(name)`) or by filtering [`reactor.tracks`](/sdk-reference/python/types#tracklist) (`reactor.tracks.with_direction("recvonly").with_kind("video").one()`). * **The client-wide `on("frame", ...)` / `on("audio", ...)` events are removed too**, for the same reason. `on()` raises `ValueError` at registration for either name, naming the [`Track`](/sdk-reference/python/track) method to use instead — [`on_frame()`](/sdk-reference/python/track#on_frame) for decoded frames, [`on_raw_frame()`](/sdk-reference/python/track#on_raw_frame) for the same bytes with no NumPy conversion. * **[`publish_track()`](/sdk-reference/python/reactor#publish_track) / [`unpublish_track()`](/sdk-reference/python/reactor#unpublish_track) are the only name-based track methods still public on `Reactor`.** `push_video_frame()`, `push_audio_frame()`, `pause_track()`, and `resume_track()` are now internal — reach the same operations through the [`Track`](/sdk-reference/python/track) object instead: `track.push_frame()`, `track.pause()`, `track.resume()`. `publish_track()` already hands back that same `Track`. * **[`Track.push_frame()`](/sdk-reference/python/track#push_frame) now raises [`InvalidStateError`](/sdk-reference/python/types#reactorerror) on an unpublished `sendonly` track**, rather than silently dropping the frame. Call [`publish()`](/sdk-reference/python/track#publish) first — [`Track.published`](/sdk-reference/python/track#published) says whether that's already happened. * **[`reconnect()`](/sdk-reference/python/reactor#reconnect) resumes `recvonly` tracks automatically, but does not restore a `sendonly` track's publish.** Call [`publish()`](/sdk-reference/python/track#publish) again after reconnecting for anything you were sending before it. * **[`@reactor.on_track`](/sdk-reference/python/decorators#reactor-on-track) hands over the [`Track`](/sdk-reference/python/track) itself, not a bare `(name, mid)`.** The `Track` is already resolved — `reactor.track(name)` done for you — so a handler that wants to push frames or register `on_frame` no longer has to look it up first; `track.mid` still carries the WebRTC media stream ID. * **[`unpublish_track()`](/sdk-reference/python/reactor#unpublish_track) / [`Track.unpublish()`](/sdk-reference/python/track#unpublish) return `None`, not an `int`.** A failure is now logged (`reactor_sdk` at `WARNING`) rather than left for the caller to notice by checking a return value nobody checked — unpublish is commonly the last call in a `finally` block, so it still does not raise. * **[`Reactor()`](/sdk-reference/python/reactor#constructor)'s positional arguments are `model_name`, `api_key` — `api_url` moved to keyword-only.** Matches the old `py-sdk`'s own constructor order exactly, so `Reactor(model, key)` ported from there needs no rewrite to keyword arguments at all. Previously `api_url`/`model_name` were positional (in either order, sniffed by which one looked like a URL); any call relying on that specifically needs updating, but a plain `Reactor("your-org/your-model")` is unaffected. * **[`upload_file()`](/sdk-reference/python/reactor#upload_file) now requires `ready`.** Previously allowed as soon as the session was created, before the WebRTC handshake finished — raises [`InvalidStateError`](/sdk-reference/python/types#reactorerror) now if called earlier, the same guard `request_clip()` and [`Track.pause()`](/sdk-reference/python/track#pause) already used. See [File Uploads](/concepts/file-uploads). ### New * **`reactor.tracks` is now a `TrackList`.** Still a plain `list[Track]` for iterating and indexing, with `with_kind()` / `with_direction()` filters that chain, and `.one()` for the common case of "the track I mean, and an error if that's ambiguous." See [`TrackList`](/sdk-reference/python/types#tracklist). * **The `Track` object.** [`reactor.track(name)`](/sdk-reference/python/reactor#track) and [`reactor.tracks`](/sdk-reference/python/reactor#tracks) return a [`Track`](/sdk-reference/python/track) scoped to one named slot, with `publish()`, `push_frame()`, `on_frame()`/`on_raw_frame()`, and `pause()`/`resume()` that raise on a direction mismatch instead of a silent no-op. * **[`Track.published`](/sdk-reference/python/track#published).** Whether a `sendonly` track is currently activated — readable state for something the session itself doesn't track, cleared automatically whenever the connection leaves `ready`. * **[`download_clip()`](/sdk-reference/python/types#download_clip).** Fetches every segment a `Clip`'s `playlist_url` names. Given a `path`, streams straight to it (returns `None`, never holds more than one segment in memory — the one to use for `request_recording()`); without one, returns the assembled bytes instead. Takes an optional `on_progress` callback either way. Closes a real gap left by the rewrite off the old `py-sdk`, which had this as `download_clip_as_file()`. * **[`reactor.download_clip(seconds)`](/sdk-reference/python/reactor#download_clip) / [`reactor.download_recording()`](/sdk-reference/python/reactor#download_recording).** `request_clip()` / `request_recording()` plus the download above, in one call, for when the file is all you want. `request_clip()` / `request_recording()` still return just the `Clip` for anyone who also wants its `session_id`, markers, or `predicted_ready_at_ms`. * **`connect(connection_id=...)`.** Adopts a WebRTC connection slot a backend already registered for a session, the connection-level analogue of `session_id` adoption — see [Multiple connections per session](/concepts/sessions#multiple-connections-per-session). Also closes a gap left by the rewrite: the old `py-sdk` had this, and the JavaScript SDK still does. * **[`reconnect()`](/sdk-reference/python/reactor#reconnect) now works from `ready`, not only after a drop.** It tears the live connection down itself first — without ending the session, unlike `disconnect()` — so there was never a need to call `disconnect()` immediately before it; that combination is also no longer required. `disconnect()`'s own behavior is unchanged — it has always ended the session server-side, with no recoverable option — a few places in these docs previously described it backwards, now corrected. See [Sessions](/concepts/sessions#disconnecting). * **`Speaker` / `Microphone` (`reactor_sdk.audio_devices`).** Play a `recvonly` audio track through real speakers, or capture a real microphone into a `sendonly` track — context managers wrapping a `sounddevice` stream around a `Track`: `with Speaker(output_track), Microphone(mic_track): ...`. Not re-exported from `reactor_sdk` — the only part of this SDK with a runtime dependency, so `pip install "reactor-sdk[audio]"` and import from `reactor_sdk.audio_devices` directly. `Speaker` promotes what `examples/pygame_app` had hand-rolled; `Microphone` is new. * **`fetch_jwt(api_key, api_url=...)`'s `api_url` is optional now**, defaulting to the same production API `Reactor()` itself defaults to. Pass it explicitly only when minting a token against a different one. **June 7, 2026** js-sdk · Multi-client connections ### Breaking * **Publishing an input track is now explicit.** Output tracks still stream automatically on connect, but `sendonly` (input) tracks send nothing until your app calls [`publishTrack()`](/sdk-reference/reactor-class#publishtrack) (or renders [``](/sdk-reference/react-components#webcamstream)). Apps that relied on input media flowing at connect must now publish explicitly once the connection is `ready`. See [Tracks](/concepts/tracks). ### New * **Output track pause/resume.** New [`pauseTrack()`](/sdk-reference/reactor-class#pausetrack) and [`resumeTrack()`](/sdk-reference/reactor-class#resumetrack) methods, plus an `autoResumeTracks` connect option (default `true`), control when each output track streams. * **Multi-client sessions.** A single session can now back several connections at once. `connect()` accepts `sessionId` and `connectionId` options to attach to a session or connection your backend created. **May 18, 2026** Pricing ### Changed * **Pricing shown per second, in dollars.** Model pricing on the [Pricing & Billing](/resources/billing) page now leads with a per-second US-dollar rate, matching how sessions are billed, with a per-hour figure shown for reference. **May 8, 2026** Docs · Pricing & billing ### New * **Pricing & billing docs.** Published [Pricing & Billing](/resources/billing), covering session pricing, idle vs. active billing, and recoverable-state behavior. * **Beta status callouts.** Added a banner across docs and the [Overview](/overview) noting that Reactor is in beta. APIs and pricing may evolve. **April 21, 2026** Authentication · API ### New * **Token TTL with `expires_after`.** Auth tokens now carry an `expires_after` field so clients can refresh proactively instead of waiting for a 401. See [Authentication](/authentication). **April 15, 2026** js-sdk · reactor-sdk · Concepts ### New * **File uploads in the Python SDK.** `reactor-sdk` now supports `upload_file()` returning a `FileRef` that can be passed into `send_command()`. * **File uploads in the JavaScript SDK.** `uploadFile()` and `FileRef` are available in `@reactor-team/js-sdk` for passing files (images, audio, blobs) as command arguments. * **New concept page:** [File Uploads](/concepts/file-uploads) documents the upload-then-reference pattern in both SDKs. **March 29, 2026** API ### Breaking * **Token endpoint is now POST.** The auth-token endpoint moved from `GET` to `POST` to allow request-body parameters. Update any direct API callers; the SDKs handle this automatically once upgraded. **March 26, 2026** js-sdk 2.7 · reactor-sdk 0.4 ### Breaking * **New SDK protocol.** Wire-level protocol overhaul shipped in `@reactor-team/js-sdk` 2.7 and `reactor-sdk` 0.4. Older SDK versions will no longer connect. Upgrade to the latest release. * **Removed `fetchInsecureToken()` and JWT helpers.** The development-only insecure token helpers were removed; all auth now flows through the standard token endpoint. ### Improved * **Maple theme refresh.** Docs site updated to Mintlify's Maple theme with Lucide icons, new codeblock styling, and refreshed colors. * **Navigation split** into separate "SDK" and "API Reference" tabs. **March 16, 2026** js-sdk 2.6.0 ### Breaking * **API renames in `@reactor-team/js-sdk` 2.6.0.** Several public methods and types were renamed for consistency with the Python SDK. Update import paths and call sites. **March 1, 2026** Docs ### Improved * **Renamed "Realtime AI" → "Realtime Video AI"** across the docs to better reflect what Reactor does. No API or SDK changes. **February 16, 2026** reactor-sdk (Python) ### New * **Python SDK launched.** `reactor-sdk` is now available on PyPI, async-first, with parity for sessions, commands, and message handling. See [Using the SDK](/sdk-reference/using-the-sdk). **February 4, 2026** js-sdk ### Breaking * **`sendCommand()` replaces `sendMessage()`.** The command API was renamed to clarify the distinction between commands (client → model) and messages (model → client). Update all `sendMessage` call sites. See [Commands and messages](/concepts/commands-and-messages). * **Removed message queueing.** Commands now have explicit `waiting` state instead of implicit queueing. Applications can decide whether to drop, replace, or buffer in-flight commands. **February 3, 2026** Authentication · API ### Breaking * **JWT auth replaces `insecureApikey`.** All client connections now require a short-lived JWT minted server-side from your API key. The `insecureApikey` development flow is removed. * **New API Reference section.** Published a complete [API Reference](/sdk-reference/using-the-sdk) covering the `Reactor` class, React components, hooks, types, and events. **January 10, 2026** Docs ### New * **Reactor docs site launched.** Initial release with [Overview](/overview) and [Quickstart](/quickstart). Ported from the legacy readme.io site. # Commands & Messages Source: https://docs.reactor.inc/concepts/commands-and-messages How two-way communication works between your app and a model Alongside the video stream, your app and the model exchange data over a real-time channel. You control the model and receive feedback while it generates. * **Commands** are instructions your app sends to the model. They control what the model generates in real time. * **Messages** are updates the model sends back to your app. They report state, signal events, or deliver data. For example, a video model might accept a `set_prompt` command to change what it generates, and respond with periodic `state` messages reporting the current frame number and active prompt. ![Commands flow from your app to the model, messages flow back](https://mintcdn.com/reactortechnologiesinc/di-lNvbv-_WwgH1P/diagrams/commands-messages.svg?fit=max\&auto=format\&n=di-lNvbv-_WwgH1P\&q=85\&s=77d70236e3feb602ae9b63476d6ef427) *** ## Commands A command is a named action with a payload. ```typescript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} await reactor.sendCommand("set_prompt", { prompt: "a forest at dawn" }); ``` ```tsx React theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} import { useReactor } from "@reactor-team/js-sdk"; function PromptButton() { const sendCommand = useReactor((s) => s.sendCommand); return ( ); } ``` ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} await reactor.send_command("set_prompt", {"prompt": "a forest at dawn"}) ``` ```cpp C++ theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} client.send_command("set_prompt", {{"prompt", "a forest at dawn"}}); ``` ```swift Swift theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} try await reactor.sendCommand("set_prompt", ["prompt": "a forest at dawn"]) ``` Every model defines its own commands with typed parameters. A prompt-driven model might expose `set_prompt`; a model with camera controls might expose `move` or `rotate`. Command names, parameter names, and types are all model-specific. > [!WARNING] > > **Prefer typed methods over string commands?** Models with a published typed SDK (like > [Helios](/model-api-reference/helios/overview) or [LingBot](/model-api-reference/lingbot/overview)) > expose every command as a typed method with autocomplete, parameter hints, and compile-time > validation. No hand-written JSON, no string-typed command names. > > ```typescript Helios typed SDK theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} > import { HeliosModel } from "@reactor-models/helios"; > > const helios = new HeliosModel(); > await helios.setPrompt({ prompt: "a forest at dawn" }); > ``` > > See [Two layers: base SDK and typed SDKs](/sdk-reference/using-the-sdk#two-layers-base-sdk-and-typed-sdks) for the full picture. > [!NOTE] > > Commands can only be sent when the connection is in the `ready` state. ### Replies and refusals A command can answer with a reply, which the awaited call returns. A model can also refuse a command, for example when its queue is full. The refusal fails that call with a stable `code` and a `message` for your user, and reaches only the client that sent the command. ```typescript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} reactor.on("error", (error) => { if (error.operation === "sendCommand") console.warn(error.code, error.message); }); const reply = await reactor.sendCommand("enqueue", { prompt: "a forest at dawn" }); if (reply === undefined) { // Refused: the error event above already carried the model's code. } ``` ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} from reactor_sdk import ReactorError try: reply = await reactor.send_command("enqueue", {"prompt": "a forest at dawn"}) except ReactorError as error: print(error.code, error.message) ``` A model that refuses this way lists its codes on its schema page, as [FastH3](/model-api-reference/fast-h3/schema#refusals) does. See [Replies and refusals](/sdk-reference/using-the-sdk#replies-and-refusals) for the details, including React and models that still broadcast a `command_error` message. *** ## Messages Reactor models can send structured JSON messages to your app at any time during a session. Each model defines its own message types. ```typescript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} reactor.on("message", (msg) => { console.log(msg); }); ``` ```tsx React theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} import { useReactorMessage } from "@reactor-team/js-sdk"; function MessageLogger() { useReactorMessage((msg) => { console.log(msg); }); return null; } ``` ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} @reactor.on_message def on_message(msg): print(msg) ``` ```cpp C++ theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} auto messages = client.on_message([](const reactor::Json& msg) { std::cout << msg.dump() << '\n'; }); ``` ```swift Swift theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} let messages = reactor.onMessage { msg in print(msg) } ``` For the full list of commands and messages per model, see the [Model API Reference](/model-api-reference/overview). # File Uploads Source: https://docs.reactor.inc/concepts/file-uploads How to upload files and pass them to model commands Some models accept file inputs alongside regular parameters. The SDK handles file uploads in two steps: upload the file to get a reference, then pass that reference into a command. 1. **Upload** the file with `uploadFile()` to get a `FileRef`. 2. **Pass** the `FileRef` into `sendCommand()` as a regular parameter. *** ## Uploading a file Call `uploadFile()` with a `File` or `Blob`. It returns a [`FileRef`](/sdk-reference/types#fileref) you can pass into `sendCommand()`, alongside regular arguments. The example below uses Helios's `set_image` command. The commands and file parameters a model accepts vary by model, so check your [model's reference](/model-api-reference/overview) for what it expects. ![File upload flow: your app calls uploadFile() to get a presigned PUT URL and a FileRef from Reactor, PUTs the file bytes directly to object storage, then sends the FileRef in a command to the model, which fetches the bytes from storage itself.](https://mintcdn.com/reactortechnologiesinc/di-lNvbv-_WwgH1P/diagrams/file-upload-flow.svg?fit=max\&auto=format\&n=di-lNvbv-_WwgH1P\&q=85\&s=8d6c704e8f126fd2846a41e1c7ad1aa1) ```typescript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} const input = document.querySelector("input[type=file]") as HTMLInputElement; const file = input.files![0]; const ref = await reactor.uploadFile(file); await reactor.sendCommand("set_image", { image: ref }); ``` ```tsx React theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} import { useReactor } from "@reactor-team/js-sdk"; function ImageUpload() { const { uploadFile, sendCommand, status } = useReactor((s) => s); const handleFile = async (e: React.ChangeEvent) => { const file = e.target.files?.[0]; if (!file) return; const ref = await uploadFile(file); await sendCommand("set_image", { image: ref }); }; return ( ); } ``` ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} ref = await reactor.upload_file("scene.jpg") await reactor.send_command("set_image", {"image": ref}) ``` ```cpp C++ theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} auto ref = client.upload_file("scene.jpg").get(); client.send_command("set_image", {}, {{"image", ref}}).get(); ``` ```swift Swift theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} let ref = try await reactor.uploadFile(at: sceneURL) try await reactor.sendCommand("set_image", uploads: ["image": ref]) ``` > [!NOTE] > > `uploadFile()` / `upload_file()` can only be called when the connection status is `"ready"` — > Python and C++ throw [`InvalidStateError`](/sdk-reference/python/types#reactorerror) otherwise, and > Swift throws a [`ReactorError`](/sdk-reference/swift/types#reactorerror) with code `INVALID_STATE`, > the same guard `request_clip()` uses. Upload URLs expire after 15 minutes. For more information, see > [Rate Limits](/resources/rate-limits#file-uploads). *** ## The FileRef type `uploadFile()` returns a `FileRef` with metadata about the uploaded file. You never construct one directly. ```typescript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} class FileRef { readonly uploadId: string; // Upload identifier readonly name: string; // Filename readonly mimeType: string; // MIME type (e.g. "image/jpeg") readonly size: number; // File size in bytes } ``` ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} @dataclass(frozen=True) class FileRef: upload_id: str # Upload identifier name: str # Filename mime_type: str # MIME type (e.g. "image/jpeg") size: int # File size in bytes ``` ```cpp C++ theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} struct FileRef { std::string upload_id; // Upload identifier std::string name; // Filename std::string mime_type; // MIME type (e.g. "image/jpeg") std::uint64_t size = 0; // File size in bytes }; ``` ```swift Swift theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} struct FileRef: Sendable, Hashable, Codable { let uploadID: String // Upload identifier let name: String // Filename let mimeType: String // MIME type (e.g. "image/jpeg") let size: Int // File size in bytes } ``` *** ## Complete example For a full image-to-video walkthrough that uploads a reference image and conditions the first frame on it, see Helios's [image-to-video example](/model-api-reference/helios/schema#complete-example-image-to-video). # Frame Metadata Source: https://docs.reactor.inc/concepts/frame-metadata Tag an outbound video frame and read the tag back on whatever the model produces from it ## What is frame metadata? A `sendonly` video frame can carry a small tag of opaque bytes alongside its pixels — `user_data`. A model that derives its output from that frame (an echo or video-to-video model, for instance) can mirror the same bytes onto the frame it produces, so your app can tell which outbound frame a given inbound one came from, without a side channel to track the pairing itself. > [!NOTE] > > Currently Python-only. The capability itself is negotiated automatically — `reactor-webrtc` > advertises it in the WebRTC offer and the runtime's answer mirrors it — but only the Python SDK > exposes `user_data` today. Nothing configures this on your side: a model that reads and echoes tags does, and one that doesn't produces frames with empty `user_data` — check for that rather than assuming every frame carries a tag. > [!WARNING] > > Video only. The wire format has no metadata trailer for audio — passing `user_data` to > [`push_frame()`](/sdk-reference/python/track#push_frame) on an audio track raises `TypeError` > rather than silently dropping it. *** ## Tagging an outbound frame Pass `user_data` to [`push_frame()`](/sdk-reference/python/track#push_frame) as raw bytes — encode whatever you need to recover later: ```python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} import json tag = json.dumps({"seq": seq, "sent_us": int(time.time() * 1e6)}).encode() track.push_frame(frame, width=640, height=480, user_data=tag) ``` *** ## Reading it back `user_data` arrives as the last argument to both [`on_frame()`](/sdk-reference/python/track#on_frame) and [`on_raw_frame()`](/sdk-reference/python/track#on_raw_frame) — the NumPy conversion the first one does only touches the pixel data, so the tag comes through unchanged either way: ```python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} @output.on_raw_frame def handle(bgra, width, height, frame_id, timestamp_us, user_data): if not user_data: return # this model doesn't echo tags, or this particular frame carried none tag = json.loads(user_data) print("frame", tag["seq"], "returned") ``` > [!NOTE] > > `frame_id` and `timestamp_us` arrive on every frame, tagged or not — they aren't something you > set. `frame_id` is a per-track counter assigned as each frame is decoded, useful for spotting > gaps or reordering on the track you're reading; `timestamp_us` is that frame's capture time in > microseconds. Neither is preserved from an outbound frame to whatever inbound frame a model > derived from it — `user_data` is the one thing that survives the round trip unchanged, which is > why it's what a correlation tag belongs in. *** ## Putting it together [`examples/frame_metadata_roundtrip.py`](https://github.com/reactor-team/reactor-client-sdks/blob/main/sdks/python/examples/frame_metadata_roundtrip.py) tags each outbound webcam frame with a sequence number and send time, matches the same tag on whatever comes back on the model's output track, and reports how many round-tripped, in what order, and how long each took: ```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} python -m examples.frame_metadata_roundtrip --frames 60 --verbose ``` If nothing comes back at all, that means the model doesn't echo frame metadata — not that anything is misconfigured on the client side. # Recordings Source: https://docs.reactor.inc/concepts/recordings Save clips of a live session, preview them, and download them as MP4 files ## What is a clip? Once a model has recording enabled, your app can ask Reactor for two types of clip from a live session: * **Snap clip**: the last `N` seconds of the session. * **Full recording**: everything from the start of the session up to now. Both return a [`Clip`](/sdk-reference/types#clip) object you can hand to the SDK's player to preview, or to its download helpers to save as a single MP4. The same object works either way. > [!WARNING] > > Reactor does not host clips. The URL you receive from Reactor expires after 24 hours, so it is not > suitable for sharing. If you want users to keep a clip, download it immediately and host the > resulting MP4 yourself. > [!NOTE] > > Reactor holds clips for 24 hours and then deletes them. None of this data is used for training. *** ## Capturing a clip Recording lives on the `Reactor` instance. In React, reach it via `useReactor()` inside a `ReactorProvider`. ```typescript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} const snap = await reactor.requestClip(10); const full = await reactor.requestRecording(); ``` ```tsx React theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} import { useReactor } from "@reactor-team/js-sdk"; function SnapButton() { const { status, reactor } = useReactor((s) => ({ status: s.status, reactor: s.internal.reactor, })); return ( ); } ``` ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} snap = await reactor.request_clip(10) full = await reactor.request_recording() ``` ```cpp C++ theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} auto snap = client.request_clip(10.0).get(); auto full = client.request_recording().get(); ``` ```swift Swift theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}} let snap = try await reactor.requestClip(.seconds(10)) let full = try await reactor.requestRecording() ``` `requestClip` / `request_clip` takes a duration in seconds and grabs the live session up to that point in the past. It is capped server-side at 5 minutes by default. `requestRecording` / `request_recording` takes no arguments and grabs the full session from the start of recording up to now. Both resolve with the same `Clip` object. > [!NOTE] > > Both methods can only be called when the connection status is `"ready"`. Otherwise they throw > (JavaScript: a [`RecordingError`](/sdk-reference/types#recordingerror) with code `DISCONNECTED`; > Python: an [`InvalidStateError`](/sdk-reference/python/types#reactorerror)) — and a request still > in flight when the session disconnects raises > [`DisconnectedError`](/sdk-reference/python/types#reactorerror) the same way. *** ## Previewing a clip Play a captured clip in place. In React, drop a [`ClipPlayer`](/sdk-reference/react-components#clipplayer) into your UI and pass the clip; it renders a native `