OptraCloudAI Inference · powered by Globussoft Start free — 150M tokens

Engineering · the architecture

From a written script to a finished film, checked at every step.

Optra Studio turns a script into an animated film on our own GPUs: Qwen boards every shot, the farm draws and animates them, the rules held in code decide what may reach a GPU, nothing waits for a person before a picture or a clip is drawn, and the movie is cut first and then goes to a person's review, shot by shot. This page is built from the code. Every part below names the file that does it, and every number was counted from that code on 4 November 2026 (commit 582162496d).

121stages in the engine, one function each in studio/kit.py
59properties every production must answer for, at 5 rungs
191checks in one registry that says whether each one blocks
6,159test files: 5,355 for the Python, 804 for the web app

Two programs that never share a process

The studio is a web server and a farm. The web server is a Node service (studio/app/: Express 5 on MySQL, its tables made by 203 numbered migrations in studio/schema/). It listens on loopback only, behind nginx and TLS, as its own service (studio_deploy.py). The farm is the live checkout of the code on our Windows machine: the scheduler (farm_run.py), the engine (studio/kit.py, started as studiokit.py) and the feed (studio_push.py).

The page never calls the farm. A press on the page is only recorded: studio/app/src/actions.js stores it, and the feed collects it, carries it out with the farm's own commands and answers. The feed also posts each project's progress, which studio/app/src/ingest.js makes the truth in one transaction. So the web server needs no way into the farm. Stills, clips and cuts go to a media store; a customer's files are never at a public address, and the page reaches them only through an address studio/app/src/mediasign.js has signed.

Work is pulled, not pushed. A stage puts what a project owes into the web server's pull door (studio/app/src/pull.js) as jobs, each named by its content, so the same job is one job however often it is asked for: the clips (studio/pullrun.py), the stills, the voices and the segment encodes of a cut (studio/cutpull.py) go this way, and so do upscales. A worker (farm_pull/worker.py) on a card claims a job of a kind it takes, draws it on its own box and reports it done. The worker dials out to the door, so nothing reaches into the card's machine. At 10:32 UTC on 4 November 2026 the door's worker list showed 14 cards with a live worker claiming work (read then, so it is as old as that time: a card joins when its worker starts), and farm_pull/leaserule.py keeps such a card out of the scheduler's push plan. A door that does not answer is said, and the stage falls back to the leased cards, so a pull that cannot start never stops the work.

The text model is reached through a gateway. Every call to the Qwen goes through optra_llm.py to the gateway (portal/gateway.py) with a key, over our private network, never a public address. The gateway holds ONE SSH link to the Qwen box (tools/hosts/boxlink.py) and dials it again only when it breaks, so a call never opens a connection of its own.

How a press on the page reaches the farm, and a picture reaches the page 23 parts and 30 connections, drawn from data-flow.mmd. A connection with words has a number; the list under the drawing gives each number its words. The web server (Node, MySQL) The farm (the live tree on our Windows machine) The cards and models A person, or a dashboard agent presses and types on the page The media door studio/app/src/ mediasign.js, studio/app/src/ mediadir.js The page studio/app/public/ app.js The API studio/app/src/api.js, studio/app/server.js MySQL studio/schema/ The media store (the NAS) one folder a project, then one a kind The pull door: the clips waiting to be drawn studio/app/src/pull.js The gateway: every text call, with a key portal/gateway.py The Qwen box: vLLM on two cards tools/hosts/boxlink.py The watchdog farm_watchdog.py The studio's steps farm_pipelines/ studio.py The feed studio_push.py The queue farm_queue.py farm.db: queue, leases farmdb.py, farm_lease.py The scheduler farm_run.py The engine's stages studiokit.py, studio/kit.py The rules and a person's Wrong studio/rules.py, studio/checks.py, studio/reviewpin.py, studio/item.py The project folder written by the stages When no door answers: ComfyUI on the leased cards comfy_farm.py, studio/graphs.py Pull workers: a card claims, draws farm_pull/worker.py Voices and speech recognition studio/voices.py, studio/asr_runtime.py The picture reader: a person's Wrong, the content screen studio/seeing.py The text model optra_llm.py, studio/qwen.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
How a press on the page reaches the farm, a picture reaches the page, a clip is drawn and a text call is answered. The feed polls out to the web server and a pull worker dials out to the door; nothing reaches into the farm. A numbered line's words are in the list below.
  1. A person → The page: presses
  2. The page → The API: requests
  3. The feed → The API: polls the presses GET /api/farm/actions
  4. The feed → The API: posts progress POST /api/farm/ingest
  5. The feed → The API: posts usage rows POST /api/farm/usage
  6. The feed → The studio's steps: apply_actions: a redo or a pick goes through the pipeline type's hook (names: farm_pipelines/hooks.py)
  7. The feed → The queue: apply_actions: a queue press
  8. The studio's steps → The scheduler: the next steps for each project
  9. The scheduler ↔ farm.db: reads and writes
  10. The watchdog → farm.db: checks every 15 s (a dotted line)
  11. The scheduler → The engine's stages: launch(step) studiokit.py --project p stage
  12. The engine's stages → The pull door: the work owed, as jobs: clips, stills, voices, a cut's encodes (with no door answering, the leased cards instead) studio/pullrun.py
  13. Pull workers → The pull door: claims, draws, reports done: the worker dials out, nothing dials in
  14. The scheduler → Pull workers: a card with a live worker leaves the push plan farm_pull/leaserule.py (a dotted line)
  15. The text model → The gateway: over the tailnet
  16. The gateway → The Qwen box: one held SSH link per box tools/hosts/boxlink.py
  17. The rules and a person's Wrong → The picture reader: reads a picture against a person's Wrong
  18. The rules and a person's Wrong → The text model: rewrites a shot a person marked wrong
  19. The engine's stages → The project folder: writes the files
  20. The project folder → The feed: media() lists them
  21. The feed → The media store (the NAS): copies them, posts POST /api/farm/media
  22. The media store (the NAS) → The media door: signed address
  23. The media door → The page: the page draws it

A project's path, script to finished film

The farm runs a project's steps in this order. farm_pipelines/studio.py decides which step is next for each project, and the engine does the work. One engine and that one module drive every project; nothing is written per project.

  1. The script. It arrives in the studio's scene format, and studio/scriptmd.py reads it back into its scenes and lines. studio/analyse.py breaks it down on Qwen into every character, place, prop, scene and spoken line, held to the script word for word.
  2. The scene plan. In studio/scene.py, Qwen plans each scene under rules Claude writes: its coverage, a continuity ledger per shot, and the beats it must show.
  3. The board. studio/board.py writes every shot from the plan, on Qwen. Claude writes the rules, never the shots.
  4. The review. studio/rules.py holds every reason a shot must not reach a GPU that the text alone can show.
  5. The rewrite, then STUCK. Where QA is the approval, a shot that fails is rewritten with its reasons: code fixers first, then Qwen, at most 3 times, and last, Claude rewrites that one shot's words once (studio/clauderung.py; the call is the Claude Code command line, in studio/claude_write.py), checked by code before they are used. A shot that still fails waits on the page as STUCK: a problem for the code to fix, never a loop and never a hand edit. These are rules about words; no model reads a drawn picture or a clip to decide anything.
  6. The approval to draw. The rules passing is the approval for what reaches a GPU (the studio's rule is "QA is the approval"): when every shot passes, the farm records its own approval of exactly that board version and starts drawing, with no person and no vision model before it. The approval is pinned, and render_gate.py refuses any render it does not cover by exact name, before a GPU is spent on it.
  7. Cast, places and voices. Character sheets, and place pictures where a project turns them on, are drawn and screened first. studio/voices.py speaks each character through the voice model the character's own data names: Chatterbox is the default and the others are Audar Turbo (Arabic and English) and Veena (Hindi and English) and Maya 2 Native (Indian languages). OmniVoice, which designs a voice from a sex and an age, speaks a child character's lines on a project that sets it, and 6 more voice models (for the Indian languages, and for Mandarin and Japanese) are built and not offered: each waits to be measured by ear before a project can name it.
  8. Stills. Every shot is drawn from its references. No take is screened: the still screen went with the vision QA, and a person reviews the shots in the cut.
  9. Clips. A new project starts on MiniMax H3 image-to-video; the project can choose another at its start (studio/models.py). A shot with a spoken line is drawn lip-synced by Wan 2.2 S2V (lip sync). The clips go to the pull door and are drawn by the workers on the cards, or on the leased cards (comfy_farm.py) when no door answers; the graphs are in studio/graphs.py. MiniMax H3 has two file sets, FP8 (the card-sized files) and INT8 (the full ones), and a project draws all its clips on one of them (studio/plan.py; a new project starts on FP8), so no two clips of a film come from different versions. No frame is read: the 24 fps read went with the vision QA. A picture is read only against a person's Wrong, and for the customer content screen (studio/seeing.py).
  10. The cut. One file: the picked clips, one mastered voice track and a subtitle file. The movie is cut first: the cut is made as soon as every clip is made, and the review comes after. A project can set its cut gate to "person", and then the cut waits until every shot is accepted and the reviewer presses Cut. The cut's sound is data: studio/audiotimeline.py lists every cue (voice, narration, music, effects and ambience), each tied to a shot's edge so a re-timed shot moves its cues. Behind an owner-only setting, off by default, the cut lays its score through that timeline (studio/cutsound.py); voices, narration and beds are laid as before. A person's own sound edit (move, level or swap one cue) is read by studio/audioedits.py and laid by the next cut, with no video redrawn. A cut short of its length is owed story: new scenes are written once, and studio/addstory.py adds them by code to a script that stays exactly as it was.
  11. Review. The finished movie goes to a person's review and is given to them shot by shot: a fault found there is a Wrong, which the engine carries out.

The rules decide what reaches a GPU; a person reviews the finished movie

The approval to draw is the farm's own. When a script and its board pass the rules held in code, the farm pins that board version, and no job that approval does not cover by name is ever sent to a card. Nothing waits for a person before a picture or a clip is drawn, and since 15 October 2026 no model reads a drawn picture or a clip to decide anything: the general vision QA is gone. The person comes after the cut. The movie is cut first, as soon as every clip is made, and a person reviews the finished movie and is given it shot by shot: the page shows each shot as Accepted or Needs you (studio/app/public/app.js), and a fault found there is a Wrong, which the engine carries out. Who reviews a project's shots is one setting with one reader, studio/reviewmode.py.

One setting can hold the cut for a person (studio/reviewcut.py; studio/kit.py, "Who releases the cut"): where a producer sets the cut gate to "person", the cut is made only when every shot of the board has an accepted take that still holds (a shot with a clip needs its clip accepted, since the clip is what the cut is made of) and a person pressed Cut after the last accept. The default releases the cut with no accept and no Cut press, and the setting changes nothing else: no shot is rewritten, redrawn or reopened because of it.

What the code checks is held in four places:

The contract

qa_contract.py lists what must be true of a finished film, for every production the farm renders: 59 properties, each decided at one of 5 rungs (script, board, still, clip and cut). gatekit.py builds one gate per rung, the same gate for every production.

One registry of checks

studio/checks.py decides whether each check blocks, and nothing else does: 191 checks, each blocking or only reporting, and 4 more in the making. A check is measured against a truth written by eye before it may block; the bar is 90% precision.

Derived means current

In derive.py, a derived file records what it was made from and is rebuilt when that changes, because "it exists" was once read as "it is current". And in studio/item.py, one shot's fault is said and held, and never stops the rest of its film.

What is never made

Two screens read a customer's work for what Optra Studio never makes: studio/wordsafety.py reads the brief and the script before anything is built from them, and studio/safety.py reads every picture.

The scheduler, and only the scheduler, starts work

farm_run.py starts every generation on the farm, and nothing else does: no stage is launched by hand, and no model is loaded by hand. It serves farm_queue.py, every piece of production in the order the farm should serve it, and farm_lease.py says which piece of work owns each generation card right now. Their state is one SQLite database that every reader and writer goes through (farmdb.py). Every 15 seconds, farm_watchdog.py asks whether every GPU is being used and whether the pipeline is actually moving. Every production type answers the page's 80 hooks (farm_pipelines/hooks.py).

JobModelReached through
Boards and reviewsoptra-coder (Qwen3.8-27B)optra_llm.py, with a key, through the gateway (portal/gateway.py); at most 24 calls in flight across every process (optra_llm_slots.py)
A person's Wrong against its picture; the content screenoptra-coder (Qwen3.8-27B)studio/seeing.py
StillsFLUX.2 klein 9B for a new project; Qwen-Image 2.1 can be chosenthe pull door and a worker on the card, or ComfyUI on a leased card, studio/graphs.py
ClipsMiniMax H3 image-to-video for a new project; Wan 2.1 image-to-video, InfiniteTalk (every shot), LTX 2.5 image-to-video, LTX 2.5 (two passes), Wan 2.2 image-to-video and Wan 2.2 5B image-to-video can be chosen; Wan 2.2 S2V (lip sync) for a spoken linethe pull door and a worker on the card, or ComfyUI on a leased card, studio/graphs.py
Voicesthe voice model each character's data names: Chatterbox by default, then Audar Turbo (Arabic and English) and Veena (Hindi and English) and Maya 2 Native (Indian languages)studio/voices.py
The last rewrite of a STUCK shot's wordsClaudestudio/claude_write.py, metered and logged

Customers: the same engine, metered and capped

A customer's project runs on the same engine as ours, and QA is the approval for its shots. studio/app/src/usage.js keeps every customer's GPU time and model calls by the unit; the farm reports quantities, never money. studio/app/src/plans.js is the one plan table: 3 plans, each setting how many projects a customer runs at the same time (1, 5 or 20). A project holds its place from the moment it is made until it is finished or deleted (studio/app/src/slots.js). A customer's own Claude, or any client that speaks MCP, can connect to the studio's MCP server (studio/app/src/mcp.js), and can do exactly what that customer can do on the page, never more (studio/app/src/mcptools.js).

How a change reaches the farm and the web server

Every change is made in its own worktree and handed over as READY, and one session, the deployer, ships it from a CI box, and ship.py catches that box's checkout up to origin before every ship. It merges the branch onto the newest main under one lock and runs the smoke (every changed file compiles, the modules the farm starts from import, the source guards run) before the live checkout moves. deploy_guard.py refuses a deploy from any other session but the main agent, the deployer's fallback, and 114 entry points ask it first. The main gate in promote.py is off by default, so a passing smoke moves main; with it on, a change lands on staging and main moves only if no test that passed on main fails on it. After every landing the farm reloads what changed, and tools/agents/sentinel.py runs the whole suite on the CI box and names the landing that turned a test red.

How a change reaches the farm and the web server 8 parts and 11 connections, drawn from deploy-line.mmd. A connection with words has a number; the list under the drawing gives each number its words. A developer's branch, or an agent's worktree The car: the branch merged onto the newest main (a worktree under .worktrees/) The deployer: READY line then ship.py The smoke, under one lock: compile, import, source guards, export leak scan The whole suite, after the landing tools/agents/sentinel.py The CI box runs the tests tools/agents/ci_test.py The web release studio_deploy.py The live tree: main (what the farm runs) 1 2 3 4 5 6 7
How a change lands. A numbered line's words are in the list below.
  1. The car → The deployer: READY
  2. The smoke → The live tree: passes: fast-forward (the main gate is off today)
  3. The smoke → The live tree: main gate on, promote.py gate_on: the car lands on staging, and main moves only if no test that passed on main fails on it (a dotted line)
  4. The smoke → The car: refused: exact words go back
  5. The live tree → The live tree: the farm reloads what changed
  6. The live tree → The web release: when studio/app changed
  7. The whole suite → A developer's branch: a red names its landing

About this page

This page is written by tools/site/architecture_page.py from the code on main. Its two drawings are drawn from docs/optra-studio/architecture/data-flow.mmd and docs/optra-studio/architecture/deploy-line.mmd, the same files the project's README draws, and a test holds the page's drawings to them. Every part names its file, and a test refuses the page when a file no longer says what the page says it does.