Composing the Rail
The rail is the ordered sequence of stages that defines a Spec. You compose it visually in the Spec editor, or set it through the API. When you run the Spec, the rail compiles deterministically into the pipeline phases the One Engine executes. The rail is a faithful description of the run: the compiler preserves order and stage configuration, so what you see in the editor is exactly what the engine does.
A typical rail reads left to right as the document journey: Source (where documents come from), Field Registry (deterministic transfer), Extraction (AI capture of gaps), Resolution (Data Policy normalization), Validation (quality checkpoints), and a terminal Data Product. You add only the stages you need. The minimum runnable rail is a single extraction stage; everything else is optional configuration layered on top.
Rail stage types
| Parameter | Type | Description |
|---|---|---|
| schema | extraction | The extraction stage. Compiles to the Extraction phase that runs Claude over gap fields. The minimum runnable rail is a single schema stage. |
| registry | transfer | Field Registry transfer. Compiles to the Transfer phase that fills cells deterministically from known field occurrences at no AI cost. |
| resolve | resolution | Resolution. Carries json.policy_ids; compiles to one resolution phase per active Data Policy, applied in order. |
| valid | checkpoint | A positional validation checkpoint. Carries json.stage_ids (member gates) and optional json.target_phases. Validates the output of the stages before it. |
| assembly | compose | Post-run compose. Carries json.grouping_field and json.anchor_field. Runs once after every document is terminal. |
| source / deliver | marker | Composition markers for where documents enter and where the data product is delivered. They frame the rail; the per-document phases sit between them. |
Each stage points at server-backed configuration rather than carrying its own copy of the data. A resolve stage references the Data Policies bound to the schema by ID. A valid stage references validation gates configured through the validation-stages endpoints. An assembly stage names the grouping and anchor fields. This indirection keeps the rail small and means editing a policy or a gate updates every Spec that uses it, with no rail rewrite.
Setting the rail via API
Set the rail with a PUT to the schema rail endpoint. Pass an array of stages; an empty array clears the rail. The example below composes a four-stage rail: registry transfer, extraction, resolution against one policy, and a validation checkpoint that covers the extraction output.
curl -X PUT https://api.talonic.com/v1/schemas/sch_delivery_notes/rail \
-H "Authorization: Bearer $TALONIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rail": [
{ "type": "registry", "name": "Field Registry" },
{ "type": "schema", "name": "Extraction" },
{ "type": "resolve", "name": "Normalize",
"json": { "policy_ids": ["pol_dates_amounts"] } },
{ "type": "valid", "name": "Checks",
"json": { "stage_ids": ["vs_required_fields"] } }
]
}'