Annotations¶
| Annotation | What it does |
|---|---|
@name |
A display name for the cell. |
@worker |
Run the cell on a named worker. |
@timeout |
A time limit for this cell, in seconds. |
@env |
An environment variable for this cell only. |
@mount |
Attach a local or remote folder as a path. |
@fetch |
Bytes from a URL, as a recorded input. |
@dataset |
A registry name, as a recorded input. |
@table |
An Iceberg table, as a versioned input. |
@write_table |
Write a variable into an Iceberg table. |
@output_dir |
A folder whose files are an output. |
@each |
Run once per file or row, each cached on its own. |
@nocache |
Always run; never serve a cached result. |
@stochastic |
Every run is a sample: it always runs and keeps its outputs. |
@after |
An edge from another cell with no variable, keyed on its last run. |
@reads |
Names the cell reads inside a string, where the analysis cannot see them. |
@sql |
Mark a SQL cell and name its connection. |
@cache |
Choose a SQL cell's cache policy. |
@model |
The model a prompt cell calls. |
@temperature |
Sampling temperature. |
@max_tokens |
The most tokens the response may use. |
@system |
The system prompt. |
@output |
Parse the response as JSON. |
@output_schema |
Validate the response against a JSON Schema. |
@validate_retries |
How often to retry a response that fails validation. |
@loop |
Iterate the cell, carrying a variable between steps. |
@loop_until |
Stop a loop when an expression is true. |
@variant |
Mark the cell as one alternative in a group. |
@per_variant |
Run the cell once per variant of its input. |
@live |
Let a control's change run the cheap cells below it. |
@app hide |
Keep the cell out of the app view. |
R cells take a subset of these: see R annotations. SQL cells take eight of them,
written as SQL comments (-- @key value): see What a SQL cell reads.
How annotations are read¶
Annotations are metadata directives written in the leading comment block of a cell. They control display names, execution routing, timeouts, environment variables, filesystem mounts, and cache behavior, without separate configuration UI. The cell source is the single source of truth.
# @name Train Classifier
# @worker my-gpu
# @timeout 120
# @env CUDA_VISIBLE_DEVICES=0
x = embeddings
y = labels
classifier.fit(x, y)
Annotations are parsed from the first contiguous block of #-prefixed lines (-- in a SQL cell). Once a non-comment, non-blank line is encountered, parsing stops. An annotation line after that point is not read, and validation warns about it (annotation_outside_block): move it to the top. Each annotation is one line in the format # @key value. A key that is not an
annotation, such as a misspelled # @wroker gpu, does nothing; validation
warns about it (annotation_unknown, in the cell header and strata validate)
and suggests the annotation it is closest to.
A known annotation whose value cannot be read, such as # @timeout soon,
# @mount data with no URI or # @nocache maybe, stops the cell: it does not
run, on any path (the editor, Run All, strata run, the API), and fails with an
error that names the line and why, such as timeout_not_numeric or
mount_unreadable. The cells that depend on it are skipped too. Running it
anyway would compute, and cache, something other than what the source declares.
strata validate reports the same errors before you run.
In the editor you type them directly into the cell. From a script or agent you can either write them into the source you pass to strata cell add/edit, or splice a single directive without touching the body: strata cell annotate <notebook_dir> <cell_id> --set worker=gpu-box --unset timeout (see the CLI).
Precedence rules¶
When the same setting is configured at multiple levels, the most specific wins:
| Setting | Annotation | Cell config (notebook.toml) | Notebook default |
|---|---|---|---|
| Worker | # @worker X |
cell.worker field |
notebook.worker field |
| Timeout | # @timeout N |
cell.timeout field |
notebook.timeout field, else 300 seconds |
| Env vars | # @env K=V |
cell.env overrides |
notebook.env defaults |
| Mounts | # @mount ... |
cell.mounts overrides |
notebook.mounts defaults |
| SQL connection | -- @sql connection=X |
(annotation only) | none; required for SQL cells |
| Cache policy | -- @cache <policy> |
(annotation only) | fingerprint (read); a write cell is reused in its session, and after while it is the only writer of a SQLite file that is as it left it |
| Cache opt-out | # @nocache |
(annotation only) | cache on (serve provenance hits) |
Annotations always take priority. This lets you override per-cell behavior without editing notebook.toml.