Concepts
Stations
A station does one job, and it's the unit the Orchestrator runs. A station has a short code (IN1), belongs to a line (IN), and runs on a cron schedule, when work arrives, or when you trigger it.
A station has two halves:
- Its handler, the code:
defineStation()insrc/stations/IN1__check/station.js. It gets the station's config, checked against its zod schema, does the work and returns a JSON-serialisable output. - Its station file, the definition:
.orchestrator/stations/IN1__check.json, with its name, line, trigger, conveyor andconfig. You push it to the Orchestrator with al-orc.
Lines
A line groups the stations of one workflow, such as invoice intake, in order. A line has a location: where its stations run. A factory session (the running process, started with npm start) serves one location, and at most one session is active per organisation and location. Stations on a line hand work to each other through bins. See Cutting work into lines and Run a factory session.
Work records
Each time a station runs, the Orchestrator creates a work record. It is also the run's place in the queue: a factory session at the line's location claims it, runs the station and reports back. It keeps the run's status (pending, running, completed, failed, timed_out, cancelled), the config the run was given, the station's output, and any report and documents the station attaches.
Workpieces and bins
A workpiece is a folder on the factory's disk holding one unit of work: one invoice, one statement, one email. Its pointer.json says what it is, and its log.jsonl records what happened to it. See Workpieces.
Each station has five bins, folders under temp/stations/ named after the station: input, doing, output, done and failed. The bin a workpiece sits in is its state. See Bins.
The first station on a line, the line head, creates workpieces in its own output. Each later station names the bins it takes from in its conveyor, and the factory session pulls each finished workpiece into the station's input. See Stations pull work.
The Orchestrator records each run and the id and outcome of every workpiece in it. Workpieces stay in the factory; the Orchestrator holds only what a station chooses to attach to a run.
Example
An invoice line with two stations:
IN0 seed invoices → output/INV-1001/ … creates one workpiece per invoice
IN1 check invoices ← moves IN0/output → IN1/input, then checks each one
under the limit → IN1/output above it → IN1/failed
To see the bins of a factory you're in, run al-control lines status -f .. To build a line like this, start with the guides.