# Assembly Line

Assembly Line is a method for running SOP-driven work, the repeatable procedures people do at a computer, as an assembly line: an AI agent designs the line once, and stations that are mostly plain code run it, with no person at any station. These docs cover its reference implementation.

The reference implementation runs work as **lines** of **stations**. Each station runs a handler of your own Node.js code in your own **factory**: a repo of lines and stations, running on your machine or server. The **Orchestrator** schedules station runs and records every run as a **work record**. Work moves between stations as **workpieces**: folders that pass through `input`, `doing`, `output` and `failed` bins, so you can always see where each piece of work is.

It's for anyone who runs repeatable work through an AI agent: invoice intake, email capture, transcription, a sync between two systems.

Assembly Line is in Beta. Pricing is usage-based with no per-seat plans; rates aren't published yet. Running stations on your machine needs no account.

## The pieces

| Piece | What it is | Where |
| --- | --- | --- |
| Orchestrator | Stores your lines and stations, runs them on a schedule or on demand, and records every run | [orchestrator.assemblyline.sh](https://orchestrator.assemblyline.sh) |
| Factory repo | Your Node.js project: station handlers under `src/stations/`, line and station files under `.orchestrator/` | Start from [factory-template](https://github.com/assemblyline-sh/factory-template) (MIT) |
| lib-factory | The library a factory is built on: `defineStation()`, the polling loop, workpiece helpers, and the `npx factory` station runner | [assemblyline-sh/lib-factory](https://github.com/assemblyline-sh/lib-factory) (MIT); installed by the template |
| al-orc | CLI that pushes line and station definitions to the Orchestrator, triggers runs and reads work records | `npm install -g @assemblyline/al-orc` (Apache-2.0) |
| al-control | CLI that shows what's in each bin, follows workpieces, and starts and stops factory sessions under pm2 | `npm install -g @assemblyline/al-control` (Apache-2.0) |

`npx factory` and al-control read and write files in your factory repo only; they never call the Orchestrator. al-orc does that.

## How a run works

1. The Orchestrator starts a station run, on a schedule or when you trigger it, and creates a work record with the station's config. The work record waits in the queue for the line's location.
2. Your factory session at that location (the running process, started with `npm start`) polls the Orchestrator, claims the run, and calls the station's handler with its config.
3. The factory session reports what the handler returned as the run's output, and the work record is complete, with any report and documents your station attached. A run that throws is retried from the start.

Your code, your data and your credentials for other systems stay in your factory. The Orchestrator records runs, each workpiece's outcome, and only what your stations choose to attach.

## Next

- [Quickstart](/docs/quickstart): a station running on your machine in about 15 minutes, no account needed.
- [Concepts](/docs/concepts): lines, stations, work records, workpieces and bins.
- [Use with AI agents](/docs/ai-agents): let a coding agent write, run and debug stations.
- [The method](/docs/method): how to design work as a line, and why each rule holds.
- [Guides](/docs/guides): how to do each job with Assembly Line.
- [Debug a run](/docs/guides/debug-a-run): find out why a run or a workpiece went wrong.
- Reference: the READMEs of [lib-factory](https://github.com/assemblyline-sh/lib-factory), [al-orc](https://github.com/assemblyline-sh/al-orc) and [al-control](https://github.com/assemblyline-sh/al-control).
