# AWL reference

Find every AWL construct, word examples and the compiler boundaries.

AWL uses declarations, typed values and a step graph. This reference covers all 112 reserved and positional words served by the language guide, plus value forms, comments and document families.

## Document structure

A file's opening declaration selects a workflow, worker, workloop or binding family. A workflow declares a name, typed inputs and terminal outcomes. Its narration goes immediately before the opening line.

- `workflow`: Opens the document: one `.awl` file declares exactly one workflow, named here. Arguments: form: declaration; positions: top-level.
- `input`: Declares one field of the workflow's start contract; it is repeatable. Arguments: form: header-clause; positions: workflow-header, workloop-header.
- `signal`: Declares a durable signal this workflow receives; a step body takes delivery with `wait`. Arguments: form: header-clause; positions: workflow-header, workloop-header.
- `failure`: Maps a declared outcome to the engine's failed status, and after `on` names a step's compensation block. Arguments: form: statement; positions: workflow-header, step-body, route-target, step-reference.
- `success`: Maps a declared outcome to the engine's completed status. Arguments: form: header-clause; positions: workflow-header, route-target, step-reference.
- `level`: Marks where an `input` or an `outcome` is set — `level board` once when the workflow is connected, `level card` on every card; a declaration with no clause is unmarked and is never defaulted. Arguments: form: header-clause; positions: workflow-header, workloop-header.
- `board`: The level of a fact set ONCE, when the workflow is connected to a board, and the same for every run it starts. Arguments: form: header-clause; positions: workflow-header, workloop-header.
- `card`: The level of a fact carried by every card: read when the card fires the workflow, written back when the run ends. Arguments: form: header-clause; positions: workflow-header, workloop-header.


Use two-space indentation and lowercase names with underscores. Type names and enum alternatives use TitleCase. The formatter writes one canonical rendering.

An outcome is the workflow's terminal value. Successful record outcomes also supply the named card output fields. Scalar, list and enum outcomes return their value directly.

The board and card level clauses mark where an input or outcome belongs. Omission stays unmarked. There is no output keyword.

## Find a construct

[Types and values](/aion/reference/awl-types/)

Records, enums, optional fields, schema imports, constants and expressions.
[Workers and placement](/aion/reference/awl-workers/)

Actions, retries, declared bodies, agent harnesses and relative nodes.
[Steps and decisions](/aion/reference/awl-steps/)

Dependencies, guards, routes and list pipelines.
[Parallel work and loops](/aion/reference/awl-parallel/)

Fork/join, regions, collection and bounded iteration.
[Children, waits and failure](/aion/reference/awl-waits/)

Subflows, child results, sleeps, signal waits and failure handlers.
[Signals and queries](/aion/reference/awl-queries/)

Sending, receiving and registering read-only answers.
[Commands](/aion/reference/awl-commands/)

Headers, arguments, capture forms, working directories and exports.
[Recipes](/aion/reference/awl-recipes/)

Typed parameters, walls, artifacts, preconditions and firing receipts.
[Workloops](/aion/reference/awl-workloops/)

Cadence, carried state, health, detached work and retirement.
[Roles and bindings](/aion/reference/awl-bindings/)

Separate a flow

## Compiler boundaries

- `Failure handlers`: No substeps, per-item regions, bounded loops, forks, timed waits or child spawns in on failure. Untimed wait is supported.
- `Forks`: A collection fork body is exactly one unbound action or child call. Each named branch is one action call.
- `Substeps`: Only a step body’s trailing substep block compiles. No after or max visits clause on a substep.
- `Indexing`: Literal indexing is refused in parallel fork branches, parallel per-item tracks, outcome guards and visit bounds. Sequential tracks accept indexing.
- `Sort`: The sort key must be Int, Float or String.
- `Schema values`: schema of Type compiles in constant position. Bind a const and use it later.
- `Routes`: A route to the middle of a folded fall-through chain is refused.
- `Check scope`: awl check parses and typechecks. Use awl emit --target beam with an output file to verify bytecode compilation locally before deployment.


Compile the document before deploying it. Worker activities also require the declared programs or agent harness on their execution hosts.

## Local guide

The installed command also serves this vocabulary as text or JSON, with a complete example for each word. See [the guide command](/aion/reference/cli-authoring/#command-awl-guide).

## Editor support

Use the [AWL language server and editor setup](/aion/getting-started/editors/) for diagnostics, formatting, completion and navigation.
