AutoReel Contact
← The AutoReel blog
Technology10 Oct 202611 min read

Inside one job: four layers, two places a model decides

A job crosses four layers, and every boundary it crosses asks the same three questions: what goes in, what comes out, and who owns the failure. No code in this article — just the layers, the seams, and why each one sits where it sits.

Tiếng Việt

The job is written down before anything renders

You press a button and go for coffee. The first thing the system does is not render a video — it writes down one row: what this job is, where its input lives, who asked for it, how far it has got.

From that second on, the row is the truth about the job. The button never was.

Four layers, and the top one holds no truth

A diagram of four stacked layers: the interface at the top, Python orchestration in the middle, an engine layer with a separate engine per task, and the data layer at the bottom. A job travels downwards, each layer speaks only to the one beside it, and exactly two arrows leave for the internet: one from the orchestration layer to call a language model, one from the engine layer to look for footage.
Four layers, two ways out to the internet. Everything else runs on your machine.
  1. The interface. Thin, and thin on purpose: it collects choices, calls downwards, and redraws the state it reads back from the data layer. It decides nothing and holds no truth. Swapping the interface does not disturb a job that is already running — that is the test for whether this layer is thin enough.
  2. Orchestration. This is the part written in Python, and the thickest one. It holds the shape of a job, the order of the steps, how many times to retry, the checks, and every call that leaves the machine. If the system has a brain, it is here — but the brain of somebody carrying out a plan, not of somebody inventing one.
  3. Engines. Every heavy task has its own: writing the lines, reading them aloud, building the picture, drawing subtitles, stamping, posting. Each engine is a separate process or service with a clear input and a clear output. This is the only layer allowed to eat the graphics card and eat time.
  4. Data. One file on your machine, holding jobs, state, and the library of videos already made. There is no server in the middle, so there is nowhere for your data to wander off to.

One rule runs through all four layers: a layer knows the one below it, and never the one above. An engine does not know who called it; it takes a path in and gives a path back.

That is what lets the same engine serve several different flows, and what keeps one broken engine from dragging the rest down with it.

The middle layer picks its language by library, not by taste

The middle layer has three jobs, and Python happens to be what all three want.

First, it has to talk to a lot of different things: a language model, a footage search service, a rendering engine, a database, and a phone. Each speaks its own protocol, and Python has a library for every one of them.

Second, it has to express checks a person can read: is it long enough, is the price right, does the file open. That is work for a language you can write quickly and read clearly.

Third, most of the heaviest engines are written in Python too, so calling them is calling family rather than building a bridge.

The first call to a model: it writes the lines, the contract is code

The script is where a model earns its keep: it takes real product data and returns spoken lines split by scene. But both ends of that call are enforced by code, not by good intentions.

The input is a contract, not a prompt. The system hands over exactly what the model is allowed to use — product name, price, material, a few features — along with the return format it must follow. The model may not invent a number: if a line mentions the price, that number has to match the source data.

The output is checked by code. Four cheap checks catch almost every real failure: does the returned format parse, does the scene count match the number of shots, is the length inside the allowed duration, and have the product name or the price drifted from the source.

Fail any one of them and the job stops right there and says so. It does not carry on into rendering, where every mistake costs twenty times more.

The second call: the model may only suggest keywords

The second call is quieter, and it is where a lot of systems get sloppy. Once the lines are split by scene, each scene needs a picture. The system does not ask the model "what should this scene look like" — it asks for a list of keywords per scene, and rules decide the rest.

The reason is concrete: a model is good at turning intent into words, and bad at knowing what exists. So it only gets the first half. The keyword list passes through a filter — drop anything too generic, drop repeats between scenes, prefer the specific — and only then goes looking for footage.

Picking the shot has no AI in it at all, and that is deliberate: it runs on things you can measure. Is the resolution high enough, does the clip cover the scene, can it be cropped vertical without losing the subject, has this clip already appeared in an earlier video. The first three that pass every condition get used — no ranking by feel.

Then there is the ladder underneath, because this step fails more often than people expect: if nothing matches, retry with broader keywords; if there is still nothing, fall back to footage you added yourself; and if there is still nothing, that scene degrades to a still frame with text on it. Uglier, but the video still exists instead of dying halfway.

Every engine returns the same shape, and that is the cheapest decision in the design

Every engine, including one from somebody else, is wrapped in the same shape: a path goes in, progress comes back as a percentage, a path comes out, and a failure arrives with a reason a person can read.

The gain is not tidiness. It is that swapping an engine does not drag the middle layer along: tomorrow there is a better voice engine, and you replace exactly one file.

It is also that the pipeline becomes testable: a fake engine that returns a path in half a second lets the whole chain run in seconds instead of waiting ten minutes for a real video. And it is that failure stays small — a dead engine kills one job, not the system.

Whatever keeps the middle layer busy gets pushed out of it

This is the architecture question people answer last, and the one that charges the longest for a wrong answer: what runs inside the orchestrating process, and what has to move out.

One sentence covers it: whatever keeps that process busy goes outside. A call to a model is a network wait, so it runs asynchronously with an explicit timeout.

Rendering eats the graphics card and can run for tens of minutes, so it lives in its own process — if it dies, it restarts without taking the middle layer with it. Posting has to sit furthest out of all, because it is the only action that cannot be undone.

Small, fast work goes the other way and stays in: reading product data, checking a script, writing state. Splitting those out only adds a place to break and buys nothing.

One job leaves a record; thirty jobs leave a trend

A system that runs overnight breaks at three in the morning, and you are the one reading the log. So every step leaves the same marks: which step, when it started, how long it took, and where it broke.

The valuable part is not the log, though. It is the record kept per job: which engine it used, how many seconds each step took, where the footage came from.

One job tells you how that job ran. Thirty jobs show you a trend — which step is slowing down, which engine keeps failing, which hours are congested.

Those are the questions that, without a record, you can only guess at.

Three things deliberately left out

  • No split into small services. On one machine with one user, splitting only trades one process that is easy to fix for ten that are hard to chase. The one boundary worth drawing is the failure boundary, and the system draws that one and stops.
  • No lock-in to a single AI provider. The model is the fastest-moving thing in the whole system, so it sits behind a thin layer and can be changed in configuration. That is also why the checks are not handed to the model: changing supplier must not change the standard.
  • No plugin marketplace. An open interface for third-party engines sounds great until you have to guarantee it cannot break the rest. The way to extend this is to replace a built-in engine, not to install something nobody has tested.

Four questions that judge an architecture faster than a feature list

If you are reading to decide whether to use this, the four questions below tell you more than any feature table. They ask about seams, not features — features can be added; a seam in the wrong place is expensive to move.

  1. Where does the job live when nobody is watching? If the answer is "in the browser session", nothing else needs asking.
  2. How long does swapping an engine take? If the answer is "edit several files across several layers", the engine layer is not really separated.
  3. What checks the model’s output? If the answer is "ask the model whether it is right", there are no checks at all.
  4. What is lost when something breaks halfway? If the answer is "start the batch again", the queue is not doing its job.
An architecture that is good for one user is not a company architecture shrunk down. It is designed for exactly one machine, one person, and a dozen jobs running overnight. Copying a company design into that does not make the software sturdier — it multiplies the places that can break, and leaves you watching ten of them instead of one.

Frequently asked questions

What is the system written in?

The orchestration layer and the engines are written in Python, because that is where the video, speech and model libraries live. The interface is not — it uses a different language whose ecosystem fits better. Choosing a language per layer is deliberate, not mixing things up for the sake of it.

Can I swap an engine myself?

Yes, as long as it returns the same shape: a path in, progress reports, a path out. The middle layer only knows that shape, so replacing an engine does not force edits anywhere else.

Does the AI pick the footage for a video?

No. It only proposes keywords for each scene. The actual choice follows measurable conditions — resolution, duration, framing, whether a clip has been used before — so the same script run twice gives a consistent result instead of depending on what the model happened to feel that day.

Does this architecture work on a personal computer?

That is the machine it was designed for. Rendering is the heavy step, so your graphics card decides the speed; everything else runs fine on an ordinary desktop. Because it all lives on your machine, there is no server bill and no data leaving except the calls you configure yourself.

Automate the repetitive part

AutoReel does most of what these articles describe: reads the product, writes the script, builds the video, then publishes it to Shopee Video and Facebook/Reels. Rent it from $6.99 a month, or buy it once and keep it.

See pricing Talk to us

More articles

Technology29 Oct 2026

One machine, no cloud: what runs where

Interface, orchestrator, engines, one data file, a licence guard and Chrome — all on one machine. The map of the five roads out, and why each exists.

Technology29 Oct 2026

Why a job survives the app being restarted

A job lives on disk, not in memory: where the row is written before the work starts, what comes back after a restart, and why three queues differ.

Technology29 Oct 2026

Six video sources, three ways to fetch

Four platforms answer a keyword, two take only a link. When yt-dlp is enough, when Chrome is needed, when a page read will do — the decision tree for six sources.